import ReactMarkdown from 'react-markdown'; import { Prism as SyntaxHighlighter } from 'react-syntax-highlighter'; import { vscDarkPlus } from 'react-syntax-highlighter/dist/esm/styles/prism'; import remarkGfm from 'remark-gfm'; import remarkMath from 'remark-math' import rehypeKatex from 'rehype-katex' import { Button, CopyButton } from '@mantine/core'; import { useMemo } from 'react'; import { FormattedMessage, useIntl } from 'react-intl'; export interface MarkdownProps { content: string; className?: string; } export function Markdown(props: MarkdownProps) { const intl = useIntl(); const classes = useMemo(() => { const classes = ['prose', 'dark:prose-invert']; if (props.className) { classes.push(props.className); } return classes; }, [props.className]) const elem = useMemo(() => (
{children}
)
}
}}>{props.content}
), [props.content, classes, intl]);
return elem;
}