Migrate to Netlify Today

Netlify announces the next evolution of Gatsby Cloud. Learn more

Customizing Markdown Components

Using MDX, you can replace every HTML element that Markdown renders with a custom implementation. This allows you to use a set of design system components when rendering.

Note: You can also provide your own custom components to the MDXProvider that make them globally available while writing MDX. You can find more details about this pattern in the Importing and Using Components in MDX guide.

The following components can be customized with the MDXProvider:

TagNameSyntax
pParagraph
h1Heading 1#
h2Heading 2##
h3Heading 3###
h4Heading 4####
h5Heading 5#####
h6Heading 6######
thematicBreakThematic break***
blockquoteBlockquote>
ulList-
olOrdered list1.
liList item
tableTable`---
trTable row`This
td/thTable cell
prePre```js console.log()```
codeCode`console.log()`
emEmphasis_emphasis_
strongStrong**strong**
deleteDelete~~strikethrough~~
codeInlineCode`console.log()`
hrBreak---
aLinkhttps://mdxjs.com or [MDX](https://mdxjs.com)
imgImage![alt](https://mdx-logo.now.sh)

How does this work?

Components passed to the MDXProvider are used to render the HTML elements that Markdown creates. It uses React’s Context API.

Start building today on Netlify!
Edit this page on GitHub
© 2024 Gatsby, Inc.