20
dsfgdfg

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();
To have Next.js treat
.mdx
files in the pages directory as pages use the pageExtensions
property:// next.config.js
const withMDX = require('@next/mdx')({
extension: /\.mdx?$/
});
module.exports = withMDX({
pageExtensions: ['js', 'jsx', 'mdx']
});
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']
});
In
next.config.js
you can also provide MDX plugins from remark and rehypeconst withMDX = require('@next/mdx')({
options: {
remarkPlugins: [],
rehypePlugins: []
}
});
module.exports = withMDX();
const withMDX = require('@next/mdx')({
extension: /\.mdx?$/
});
module.exports = withMDX({
pageExtensions: ['js', 'jsx', 'ts', 'tsx', 'md', 'mdx']
});