import classNames from 'classnames'; import Markdown from 'react-markdown'; import { Prism as SyntaxHighlighter } from 'react-syntax-highlighter'; import { oneDark, oneLight, } from 'react-syntax-highlighter/dist/esm/styles/prism'; import rehypeKatex from 'rehype-katex'; import rehypeRaw from 'rehype-raw'; import remarkGfm from 'remark-gfm'; import remarkMath from 'remark-math'; import 'katex/dist/katex.min.css'; // `rehype-katex` does not import the CSS for you import { preprocessLaTeX } from '@/utils/chat'; import { useIsDarkTheme } from '../theme-provider'; import styles from './index.less'; const HighLightMarkdown = ({ children, }: { children: string | null | undefined; }) => { const isDarkTheme = useIsDarkTheme(); return ( {String(children).replace(/\n$/, '')} ) : ( {children} ); }, } as any } > {children ? preprocessLaTeX(children) : children} ); }; export default HighLightMarkdown;