Fix: Fixed an issue where math formulas could not be displayed correctly #4405 (#4506)

### What problem does this PR solve?

[remarkjs/react-markdown/issues/785](https://github.com/remarkjs/react-markdown/issues/785)
Fix: Fixed an issue where math formulas could not be displayed correctly
#4405

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
balibabu
2025-01-16 15:13:40 +08:00
committed by GitHub
parent 39be08c83d
commit 37235315e1
3 changed files with 20 additions and 2 deletions

View File

@ -8,6 +8,7 @@ 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 styles from './index.less';
const HightLightMarkdown = ({
@ -43,7 +44,7 @@ const HightLightMarkdown = ({
} as any
}
>
{children}
{children ? preprocessLaTeX(children) : children}
</Markdown>
);
};