fix: markdown parse error
This commit is contained in:
+12
-8
@@ -98,6 +98,9 @@ export const renderPageContent = (
|
||||
.use(remarkPangu)
|
||||
.use(emoji)
|
||||
.use(remarkRehype, { allowDangerousHtml: true })
|
||||
.use(rehypeRaw, {
|
||||
passThrough: allowedCustomWrappers,
|
||||
} as RehypeRawOptions)
|
||||
.use(rehypeCustomWrapper, {
|
||||
rules: defaultRules,
|
||||
})
|
||||
@@ -127,6 +130,13 @@ export const renderPageContent = (
|
||||
.use(rehypeEmbed, {
|
||||
transformers,
|
||||
})
|
||||
.use(rehypePrism, {
|
||||
ignoreMissing: true,
|
||||
showLineNumbers: true,
|
||||
})
|
||||
.use(rehypeKatex, {
|
||||
strict: false,
|
||||
})
|
||||
.use(rehypeRewrite, {
|
||||
selector: "p, li, h1",
|
||||
rewrite: (node: any) => {
|
||||
@@ -164,17 +174,10 @@ export const renderPageContent = (
|
||||
}
|
||||
},
|
||||
})
|
||||
// TODO
|
||||
.use(rehypeRaw, {
|
||||
passThrough: allowedCustomWrappers,
|
||||
} as RehypeRawOptions)
|
||||
// Move it to the end as it generates a lot of DOM and requires extensive traversal.
|
||||
.use(rehypeKatex, {
|
||||
strict: false,
|
||||
})
|
||||
.use(rehypePrism, {
|
||||
ignoreMissing: true,
|
||||
showLineNumbers: true,
|
||||
})
|
||||
|
||||
const file = new VFile(content)
|
||||
|
||||
@@ -205,6 +208,7 @@ export const renderPageContent = (
|
||||
}
|
||||
})
|
||||
|
||||
// images audio
|
||||
visit(hastTree, (node, index, parent) => {
|
||||
if (node.type === "element") {
|
||||
if (node.tagName === "img" && typeof node.properties.src === "string") {
|
||||
|
||||
Reference in New Issue
Block a user