Skip to content

Commit

Permalink
docs: note MDX with remark-gfm usage (vercel#41391)
Browse files Browse the repository at this point in the history
MDX no longer supports GitHub flavored markdown (GFM) by default since v2, instead requiring a plugin: https://mdxjs.com/guides/gfm/

Since GFM is extremely popular (for example, you need it if you want to use markdown tables), this change paves the cow path, making it clear that next.config.mjs is now supported and allows you to import remark-gfm.
  • Loading branch information
WestonThayer authored and Kikobeats committed Oct 24, 2022
1 parent c4da3cd commit 7ed106c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion docs/advanced-features/using-mdx.md
Expand Up @@ -16,7 +16,7 @@ However, because markdown is essentially static content, you can't create _dynam

## MDX Plugins

Internally MDX uses remark and rehype. Remark is a markdown processor powered by a plugins ecosystem. This plugin ecosystem lets you parse code, transform `HTML` elements, change syntax, extract frontmatter, and more.
Internally MDX uses remark and rehype. Remark is a markdown processor powered by a plugins ecosystem. This plugin ecosystem lets you parse code, transform `HTML` elements, change syntax, extract frontmatter, and more. Using [remark-gfm to enable GitHub flavored markdown (GFM)](https://mdxjs.com/guides/gfm/) is a popular option.

Rehype is an `HTML` processor, also powered by a plugin ecosystem. Similar to remark, these plugins let you manipulate, sanitize, compile and configure all types of data, elements and content.

Expand Down Expand Up @@ -44,6 +44,9 @@ The following steps outline how to setup `@next/mdx` in your Next.js project:
const withMDX = require('@next/mdx')({
extension: /\.mdx?$/,
options: {
// If you use remark-gfm, you'll need to use next.config.mjs
// as the package is ESM only
// https://github.com/remarkjs/remark-gfm#install
remarkPlugins: [],
rehypePlugins: [],
// If you use `MDXProvider`, uncomment the following line.
Expand Down

0 comments on commit 7ed106c

Please sign in to comment.