Add strict: false and trust: true to KaTeX plugin configuration

• Relaxes KaTeX parsing rules
• Enables trusted LaTeX commands
• Improves math rendering compatibility
• Applied to both markdown processors
This commit is contained in:
yangdx 2025-09-25 17:28:01 +08:00
parent b4cc249dca
commit 72039e0b4e

View file

@ -138,7 +138,13 @@ export const ChatMessage = ({ message }: { message: MessageWithError }) => { //
remarkPlugins={[remarkGfm, remarkFootnotes, remarkMath]} remarkPlugins={[remarkGfm, remarkFootnotes, remarkMath]}
rehypePlugins={[ rehypePlugins={[
rehypeRaw, rehypeRaw,
...(katexPlugin ? [[katexPlugin, { errorColor: theme === 'dark' ? '#ef4444' : '#dc2626', throwOnError: false, displayMode: false }] as any] : []), ...(katexPlugin ? [[katexPlugin, {
errorColor: theme === 'dark' ? '#ef4444' : '#dc2626',
throwOnError: false,
displayMode: false,
strict: false,
trust: true
}] as any] : []),
rehypeReact rehypeReact
]} ]}
skipHtml={false} skipHtml={false}
@ -167,7 +173,9 @@ export const ChatMessage = ({ message }: { message: MessageWithError }) => { //
{ {
errorColor: theme === 'dark' ? '#ef4444' : '#dc2626', errorColor: theme === 'dark' ? '#ef4444' : '#dc2626',
throwOnError: false, throwOnError: false,
displayMode: false displayMode: false,
strict: false,
trust: true
} }
] as any] : []), ] as any] : []),
rehypeReact rehypeReact