fix: remove non-serializable rehype-pretty-code callbacks from @next/mdx config
This commit is contained in:
@@ -9,8 +9,6 @@ import rehypeAutolinkHeadings from 'rehype-autolink-headings'
|
||||
import rehypePrettyCode from 'rehype-pretty-code'
|
||||
import { transformerCopyButton } from '@rehype-pretty/transformers'
|
||||
import rehypeKatex from 'rehype-katex'
|
||||
import type { Element } from 'hast'
|
||||
import type { LineElement } from 'rehype-pretty-code'
|
||||
|
||||
const nextConfig: NextConfig = {
|
||||
output: 'export',
|
||||
@@ -31,30 +29,6 @@ const withMDX = createMDX({
|
||||
lineNumbers: true,
|
||||
filterMetaString: (metaString: string | undefined) => (metaString || '') + ' showLineNumbers',
|
||||
grid: true,
|
||||
onVisitLine(node: LineElement) {
|
||||
if (node.children.length === 0) {
|
||||
node.children = [{ type: 'text', value: ' ' }]
|
||||
}
|
||||
},
|
||||
onVisitTitle(element: Element) {
|
||||
const existingClassNames = Array.isArray(element.properties.className)
|
||||
? element.properties.className
|
||||
: []
|
||||
element.properties.className = [...existingClassNames, 'vscode-title']
|
||||
element.children = [
|
||||
{
|
||||
type: 'element',
|
||||
tagName: 'span',
|
||||
properties: { className: ['vscode-dots'] },
|
||||
children: [
|
||||
{ type: 'element', tagName: 'span', properties: { className: ['dot-red'] }, children: [] },
|
||||
{ type: 'element', tagName: 'span', properties: { className: ['dot-yellow'] }, children: [] },
|
||||
{ type: 'element', tagName: 'span', properties: { className: ['dot-green'] }, children: [] },
|
||||
],
|
||||
},
|
||||
element.children[0],
|
||||
]
|
||||
},
|
||||
transformers: [
|
||||
transformerCopyButton({ visibility: 'hover', feedbackDuration: 2500 }),
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user