fix: crash markdown render code block without triple backtick (#4248)
This commit is contained in:
parent
21389070fb
commit
893d6ff40e
@ -41,7 +41,6 @@
|
|||||||
"rehype-highlight": "^7.0.1",
|
"rehype-highlight": "^7.0.1",
|
||||||
"rehype-highlight-code-lines": "^1.0.4",
|
"rehype-highlight-code-lines": "^1.0.4",
|
||||||
"rehype-katex": "^7.0.1",
|
"rehype-katex": "^7.0.1",
|
||||||
"rehype-raw": "^7.0.0",
|
|
||||||
"remark-math": "^6.0.0",
|
"remark-math": "^6.0.0",
|
||||||
"sass": "^1.69.4",
|
"sass": "^1.69.4",
|
||||||
"slate": "latest",
|
"slate": "latest",
|
||||||
|
|||||||
@ -7,8 +7,9 @@ import Markdown from 'react-markdown'
|
|||||||
|
|
||||||
import rehypeHighlight from 'rehype-highlight'
|
import rehypeHighlight from 'rehype-highlight'
|
||||||
import rehypeHighlightCodeLines from 'rehype-highlight-code-lines'
|
import rehypeHighlightCodeLines from 'rehype-highlight-code-lines'
|
||||||
|
|
||||||
import rehypeKatex from 'rehype-katex'
|
import rehypeKatex from 'rehype-katex'
|
||||||
import rehypeRaw from 'rehype-raw'
|
|
||||||
import remarkMath from 'remark-math'
|
import remarkMath from 'remark-math'
|
||||||
|
|
||||||
import 'katex/dist/katex.min.css'
|
import 'katex/dist/katex.min.css'
|
||||||
@ -198,12 +199,10 @@ export const MarkdownTextMessage = memo(
|
|||||||
remarkPlugins={[remarkMath]}
|
remarkPlugins={[remarkMath]}
|
||||||
rehypePlugins={[
|
rehypePlugins={[
|
||||||
[rehypeKatex, { throwOnError: false }],
|
[rehypeKatex, { throwOnError: false }],
|
||||||
rehypeRaw,
|
|
||||||
rehypeHighlight,
|
rehypeHighlight,
|
||||||
[rehypeHighlightCodeLines, { showLineNumbers: true }],
|
[rehypeHighlightCodeLines, { showLineNumbers: true }],
|
||||||
wrapCodeBlocksWithoutVisit,
|
wrapCodeBlocksWithoutVisit,
|
||||||
]}
|
]}
|
||||||
skipHtml={true}
|
|
||||||
>
|
>
|
||||||
{text}
|
{text}
|
||||||
</Markdown>
|
</Markdown>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user