38 lines
1.2 KiB
TypeScript
38 lines
1.2 KiB
TypeScript
import type { NextConfig } from 'next'
|
|
import createMDX from '@next/mdx'
|
|
|
|
const nextConfig: NextConfig = {
|
|
output: 'export',
|
|
trailingSlash: true,
|
|
images: { unoptimized: true },
|
|
}
|
|
|
|
const withMDX = createMDX({
|
|
options: {
|
|
remarkPlugins: ['remark-frontmatter', 'remark-smartypants', 'remark-math', 'remark-gfm'],
|
|
rehypePlugins: [
|
|
'rehype-slug',
|
|
['rehype-external-links', { target: '_blank', rel: ['nofollow', 'noopener', 'noreferrer'] }],
|
|
'rehype-autolink-headings',
|
|
['rehype-pretty-code', {
|
|
theme: { light: 'github-light', dark: 'github-dark-dimmed' },
|
|
keepBackground: false,
|
|
grid: true,
|
|
}],
|
|
(tree) => {
|
|
const { visit } = require('unist-util-visit')
|
|
visit(tree, 'element', (node: any) => {
|
|
if (node.tagName === 'pre' && node.children?.length === 1 && node.children[0].type === 'element' && node.children[0].tagName === 'code') {
|
|
const code = node.children[0]
|
|
code.properties = code.properties || {}
|
|
code.properties['data-line-numbers'] = ''
|
|
}
|
|
})
|
|
},
|
|
'rehype-katex',
|
|
],
|
|
},
|
|
})
|
|
|
|
export default withMDX(nextConfig)
|