Skip to navigation

Note: V2 is around the corner. This website is for that. It hasn’t been released yet. But you can try out the RC. You can be of great help by reading through these docs and letting us know what’s confusing or wrong or other suggestions you have. See § Support for where to ask questions and § Contribute for how to help.

Markdown for the
component era

MDX allows you to use JSX in your markdown content. You can import components, such as interactive charts or alerts, and embed them within your content. This makes writing long-form content with components a blast. 🚀 Continue reading »

New: MDX 2!

Version 2 of MDX was released after years of hard work, and has many improvements. Here are the highlights:

  • 📝 Improved syntax makes it easier to use markdown in JSX
  • 🧑‍💻 JavaScript expressions turn {2 * Math.PI} into 6.283185307179586
  • 🔌 New esbuild, Rollup, and Node.js integrations
  • ⚛️ Any JSX runtime: React, Preact, Vue, Emotion, you name it, they’re all supported
  • 🌳 Improved AST exposes more info in greater detail
  • 🏃‍♀️ Compiles at least 25% faster
  • 🚴 Generated code runs twice as fast (100% faster)
  • 🚄 Bundle size of @mdx-js/mdx is more than three times as small (250% smaller)
  • 🧵 …and much, so much more

Continue reading »

What does MDX do?

You write markdown with embedded components through JSX:

example.mdx
import {Chart} from './snowfall.js'
export const year = 2018

# Last year’s snowfall

In {year}, the snowfall was above average.
It was followed by a warm spring which caused
flood conditions in many of the nearby rivers.

<Chart year={year} color="#fcb32c" />

It gets compiled to JavaScript that you can use in any framework that supports JSX:

Last year’s snowfall

In 2018, the snowfall was above average. It was followed by a warm spring which caused flood conditions in many of the nearby rivers.

We made an interactive playground where you can try MDX out and see what it turns into. Play »

Get started

There are integrations for most bundlers, frameworks, and editors. Whether you build with Next.js, Docusaurus, or Gatsby. You prefer esbuild, Rollup, or webpack. You’re using React, Preact, or Vue. Get started »

MDX in short

  • ❤️ Powerful: MDX blends markdown and JSX syntax to fit perfectly in JSX-based projects
  • 💻 Everything is a component: Use existing components in your MDX and import other MDX files as components
  • 🔧 Customizable: Decide which component is rendered for each markdown construct ({h1: MyHeading})
  • 📚 Markdown-based: The simplicity and elegance of markdown remains, you use JSX only when you want to
  • 🔥 Blazingly blazing fast: MDX has no runtime, all compilation occurs during the build stage

It’s extremely useful for using design system components to render markdown and weaving interactive components in with existing markdown.

@chrisbiscardi