mirror of
				https://github.com/ChatGPTNextWeb/ChatGPT-Next-Web.git
				synced 2025-11-04 16:23:41 +08:00 
			
		
		
		
	fix: #5 crash if code block cannot be highlighted
This commit is contained in:
		@@ -2,13 +2,19 @@ import ReactMarkdown from "react-markdown";
 | 
			
		||||
import "katex/dist/katex.min.css";
 | 
			
		||||
import RemarkMath from "remark-math";
 | 
			
		||||
import RehypeKatex from "rehype-katex";
 | 
			
		||||
import RemarkGfm from 'remark-gfm'
 | 
			
		||||
import RehypePrsim from 'rehype-prism-plus'
 | 
			
		||||
import RemarkGfm from "remark-gfm";
 | 
			
		||||
import RehypePrsim from "rehype-prism-plus";
 | 
			
		||||
 | 
			
		||||
export function Markdown(props: { content: string }) {
 | 
			
		||||
    return (
 | 
			
		||||
        <ReactMarkdown remarkPlugins={[RemarkMath, RemarkGfm]} rehypePlugins={[RehypeKatex, RehypePrsim]}>
 | 
			
		||||
            {props.content}
 | 
			
		||||
        </ReactMarkdown>
 | 
			
		||||
    );
 | 
			
		||||
}
 | 
			
		||||
  return (
 | 
			
		||||
    <ReactMarkdown
 | 
			
		||||
      remarkPlugins={[RemarkMath, RemarkGfm]}
 | 
			
		||||
      rehypePlugins={[
 | 
			
		||||
        RehypeKatex,
 | 
			
		||||
        [RehypePrsim, { ignoreMissing: true }],
 | 
			
		||||
      ]}
 | 
			
		||||
    >
 | 
			
		||||
      {props.content}
 | 
			
		||||
    </ReactMarkdown>
 | 
			
		||||
  );
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user