feat: import ramarkBreaks plugin

This commit is contained in:
RugerMc 2023-03-30 12:48:38 +08:00
parent 8b4db412d8
commit 2c5420ab9e
2 changed files with 3 additions and 1 deletions

View File

@ -1,6 +1,7 @@
import ReactMarkdown from "react-markdown"; 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 RemarkBreaks from "remark-breaks";
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";
@ -29,7 +30,7 @@ export function PreCode(props: { children: any }) {
export function Markdown(props: { content: string }) { export function Markdown(props: { content: string }) {
return ( return (
<ReactMarkdown <ReactMarkdown
remarkPlugins={[RemarkMath, RemarkGfm]} remarkPlugins={[RemarkMath, RemarkGfm, RemarkBreaks]}
rehypePlugins={[RehypeKatex, [RehypePrsim, { ignoreMissing: true }]]} rehypePlugins={[RehypeKatex, [RehypePrsim, { ignoreMissing: true }]]}
components={{ components={{
pre: PreCode, pre: PreCode,

View File

@ -23,6 +23,7 @@
"react": "^18.2.0", "react": "^18.2.0",
"react-dom": "^18.2.0", "react-dom": "^18.2.0",
"react-markdown": "^8.0.5", "react-markdown": "^8.0.5",
"remark-breaks": "^3.0.2",
"rehype-katex": "^6.0.2", "rehype-katex": "^6.0.2",
"rehype-prism-plus": "^1.5.1", "rehype-prism-plus": "^1.5.1",
"remark-gfm": "^3.0.1", "remark-gfm": "^3.0.1",