Skip to content
MDX logo
v1.5.9GitHub logoTwitter logo
GitHub logoTwitter logo

Next.js

Next.js provides an official plugin to simplify MDX importing into your project.

npm install --save @next/mdx @mdx-js/loader

To configure MDX, add the following to your next.config.js:

const withMDX = require('@next/mdx')()
module.exports = withMDX()

Use MDX for .md files

The Next.js MDX plugin allows for you to also use MDX parsing for .md files:

const withMDX = require('@next/mdx')({
extension: /\.mdx?$/
})
module.exports = withMDX({
pageExtensions: ['js', 'jsx', 'md', 'mdx']
})
Edit this page on GitHub
Previous:
Getting Started
Next:
Gatsby