Feat: Support for formulas #1954 (#3747)

### What problem does this PR solve?

Feat: Support for formulas #1954

### Type of change


- [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
balibabu
2024-11-29 16:34:30 +08:00
committed by GitHub
parent c93e0355c3
commit 0dafce31c4
4 changed files with 191 additions and 4 deletions

View File

@ -1,8 +1,12 @@
import classNames from 'classnames';
import Markdown from 'react-markdown';
import { Prism as SyntaxHighlighter } from 'react-syntax-highlighter';
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 styles from './index.less';
@ -13,8 +17,8 @@ const HightLightMarkdown = ({
}) => {
return (
<Markdown
remarkPlugins={[remarkGfm]}
rehypePlugins={[rehypeRaw]}
remarkPlugins={[remarkGfm, remarkMath]}
rehypePlugins={[rehypeRaw, rehypeKatex]}
className={classNames(styles.text)}
components={
{