fix: #5 crash if code block cannot be highlighted

This commit is contained in:
Yifei Zhang 2023-03-23 11:28:07 +00:00
parent fa8667ec19
commit e55520e93c

View File

@ -2,12 +2,18 @@ import ReactMarkdown from "react-markdown";
import "katex/dist/katex.min.css"; import "katex/dist/katex.min.css";
import RemarkMath from "remark-math"; import RemarkMath from "remark-math";
import RehypeKatex from "rehype-katex"; import RehypeKatex from "rehype-katex";
import RemarkGfm from 'remark-gfm' import RemarkGfm from "remark-gfm";
import RehypePrsim from 'rehype-prism-plus' import RehypePrsim from "rehype-prism-plus";
export function Markdown(props: { content: string }) { export function Markdown(props: { content: string }) {
return ( return (
<ReactMarkdown remarkPlugins={[RemarkMath, RemarkGfm]} rehypePlugins={[RehypeKatex, RehypePrsim]}> <ReactMarkdown
remarkPlugins={[RemarkMath, RemarkGfm]}
rehypePlugins={[
RehypeKatex,
[RehypePrsim, { ignoreMissing: true }],
]}
>
{props.content} {props.content}
</ReactMarkdown> </ReactMarkdown>
); );