From 72039e0b4ea71e4539a78d932c8dba7889f20893 Mon Sep 17 00:00:00 2001 From: yangdx Date: Thu, 25 Sep 2025 17:28:01 +0800 Subject: [PATCH] Add strict: false and trust: true to KaTeX plugin configuration MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit • Relaxes KaTeX parsing rules • Enables trusted LaTeX commands • Improves math rendering compatibility • Applied to both markdown processors --- .../src/components/retrieval/ChatMessage.tsx | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/lightrag_webui/src/components/retrieval/ChatMessage.tsx b/lightrag_webui/src/components/retrieval/ChatMessage.tsx index 7ac208ef..544b65c2 100644 --- a/lightrag_webui/src/components/retrieval/ChatMessage.tsx +++ b/lightrag_webui/src/components/retrieval/ChatMessage.tsx @@ -138,7 +138,13 @@ export const ChatMessage = ({ message }: { message: MessageWithError }) => { // remarkPlugins={[remarkGfm, remarkFootnotes, remarkMath]} rehypePlugins={[ 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 ]} skipHtml={false} @@ -167,7 +173,9 @@ export const ChatMessage = ({ message }: { message: MessageWithError }) => { // { errorColor: theme === 'dark' ? '#ef4444' : '#dc2626', throwOnError: false, - displayMode: false + displayMode: false, + strict: false, + trust: true } ] as any] : []), rehypeReact