How it works
An MDX file is compiled to JavaScript. Headings, lists and links are written as ordinary Markdown, and between them you can import and place JSX components such as a chart with its data, use JavaScript expressions in curly braces, and export values. It works with React, Preact, Vue and other JSX runtimes, and frameworks such as Next.js, Astro, Docusaurus and Nextra support it; remark and rehype plugins add GFM tables, maths and syntax highlighting.
It is stricter than Markdown. Raw HTML must be valid JSX, characters such as < and { need escaping, and indented code blocks and angle-bracket autolinks are not supported, so converting existing Markdown takes some clean-up. Because MDX compiles to code, content from untrusted users should never be compiled as MDX.
MDX pricing
MDX vs the alternatives
Related terms
More in Media and documents
Writing formats