Revert "mdx: add remark-frontmatter to pipeline, fix rehype-pretty-code line numbers visitor"
This reverts commit 9867a74bdd.
This commit is contained in:
@@ -9,7 +9,7 @@ const nextConfig: NextConfig = {
|
|||||||
|
|
||||||
const withMDX = createMDX({
|
const withMDX = createMDX({
|
||||||
options: {
|
options: {
|
||||||
remarkPlugins: ['remark-frontmatter', 'remark-smartypants', 'remark-math', 'remark-gfm'],
|
remarkPlugins: ['remark-smartypants', 'remark-math', 'remark-gfm'],
|
||||||
rehypePlugins: [
|
rehypePlugins: [
|
||||||
'rehype-slug',
|
'rehype-slug',
|
||||||
['rehype-external-links', { target: '_blank', rel: ['nofollow', 'noopener', 'noreferrer'] }],
|
['rehype-external-links', { target: '_blank', rel: ['nofollow', 'noopener', 'noreferrer'] }],
|
||||||
@@ -17,18 +17,9 @@ const withMDX = createMDX({
|
|||||||
['rehype-pretty-code', {
|
['rehype-pretty-code', {
|
||||||
theme: { light: 'github-light', dark: 'github-dark-dimmed' },
|
theme: { light: 'github-light', dark: 'github-dark-dimmed' },
|
||||||
keepBackground: false,
|
keepBackground: false,
|
||||||
|
lineNumbers: true,
|
||||||
grid: true,
|
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',
|
'rehype-katex',
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user