Files
Remco HaszingandGitHub 8de423c9f7 Fix types of @next/mdx (#82238)
### What?

This fixes a couple of things:
- Although it’s rare for MDX plugins to accept more than 1 option, they
may accept any number of arguments.
- In addition to `remarkPlugins` and `rehypePlugins`, now `recmaPlugins`
is also patched to accept strings
- TypeScript property Descriptions are preserved for patched values.

### Why?

Because it is broken.

### How?

Fixes #77297
2025-10-27 11:12:35 +01:00

25 lines
564 B
TypeScript

import nextMDX from '@next/mdx'
const withMDX = nextMDX({
extension: /\.mdx?$/,
options: {
remarkPlugins: ['remark-gfm', ['remark-toc', { heading: 'The Table' }]],
rehypePlugins: [
'rehype-slug',
['rehype-katex', { strict: true, throwOnError: true }],
],
recmaPlugins: ['recma-export-filepath'],
},
})
/**
* @type {import('next').NextConfig}
*/
const nextConfig = {
pageExtensions: ['js', 'jsx', 'ts', 'tsx', 'mdx'],
experimental: {
mdxRs: process.env.WITH_MDX_RS === 'true',
},
}
export default withMDX(nextConfig)