Product
Introducing License Enforcement in Socket
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
remark-mdx
Advanced tools
The remark-mdx npm package is a plugin for remark, a markdown processor powered by plugins part of the unified collective. It enables MDX syntax in markdown documents processed by remark. MDX is an authorable format that lets you seamlessly write JSX in your markdown documents. This package allows you to parse and serialize MDX files, making it possible to use MDX with the remark ecosystem.
Parsing MDX syntax
This feature allows you to parse strings of MDX and transform them into a markdown abstract syntax tree (AST).
const remark = require('remark');
const remarkMdx = require('remark-mdx');
remark().use(remarkMdx).processSync('<h1>Hello, MDX!</h1>').toString();
Serializing MDX
This feature enables you to serialize the markdown AST back into a string of MDX, which can then be saved to a file or processed further.
const remark = require('remark');
const remarkMdx = require('remark-mdx');
const vfile = require('to-vfile');
const file = vfile.readSync('example.mdx');
const result = remark().use(remarkMdx).processSync(file).toString();
console.log(result);
Remark is the core library that powers the remark ecosystem, which includes remark-mdx. It is a markdown processor that can be extended with plugins but does not support MDX syntax out of the box.
Rehype is another processor in the unified collective that works with HTML instead of markdown. It can be used in conjunction with remark-mdx to transform the markdown AST into a rehype (HTML) AST and manipulate it further.
:warning: This project is currently in alpha
MDX syntax support for remark.
npm install --save remark-mdx
See the Support and Contributing guidelines on the MDX website for ways to (get) help.
This project has a Code of Conduct. By interacting with this repository, organisation, or community you agree to abide by its terms.
MIT © Titus Wormer and John Otander
FAQs
remark plugin to support MDX syntax
The npm package remark-mdx receives a total of 2,298,221 weekly downloads. As such, remark-mdx popularity was classified as popular.
We found that remark-mdx demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
Product
We're launching a new set of license analysis and compliance features for analyzing, managing, and complying with licenses across a range of supported languages and ecosystems.
Product
We're excited to introduce Socket Optimize, a powerful CLI command to secure open source dependencies with tested, optimized package overrides.