@@ -222,41 +222,42 @@ export const ChatMessage = ({
222222 { /* Main content display */ }
223223 { finalDisplayContent && (
224224 < div className = "relative" >
225- < ReactMarkdown
226- className = { `prose dark:prose-invert max-w-none text-sm break-words prose-headings:mt-4 prose-headings:mb-2 prose-p:my-2 prose-ul:my-2 prose-ol:my-2 prose-li:my-1 [&_.katex]:text-current [&_.katex-display]:my-4 [&_.katex-display]:max-w-full [&_.katex-display_>.base]:overflow-x-auto [&_sup]:text-[0.75em] [&_sup]:align-[0.1em] [&_sup]:leading-[0] [&_sub]:text-[0.75em] [&_sub]:align-[-0.2em] [&_sub]:leading-[0] [&_mark]:bg-yellow-200 [&_mark]:dark:bg-yellow-800 [&_u]:underline [&_del]:line-through [&_ins]:underline [&_ins]:decoration-green-500 [&_.footnotes]:mt-8 [&_.footnotes]:pt-4 [&_.footnotes]:border-t [&_.footnotes_ol]:text-sm [&_.footnotes_li]:my-1 ${
227- message . role === 'user' ? 'text-primary-foreground' : 'text-foreground'
228- } ${
229- message . role === 'user'
230- ? '[&_.footnotes]:border-primary-foreground/30 [&_a[href^="#fn"]]:text-primary-foreground [&_a[href^="#fn"]]:no-underline [&_a[href^="#fn"]]:hover:underline [&_a[href^="#fnref"]]:text-primary-foreground [&_a[href^="#fnref"]]:no-underline [&_a[href^="#fnref"]]:hover:underline'
231- : '[&_.footnotes]:border-border [&_a[href^="#fn"]]:text-primary [&_a[href^="#fn"]]:no-underline [&_a[href^="#fn"]]:hover:underline [&_a[href^="#fnref"]]:text-primary [&_a[href^="#fnref"]]:no-underline [&_a[href^="#fnref"]]:hover:underline'
232- } `}
233- remarkPlugins = { [ remarkGfm , remarkFootnotes , remarkMath ] }
234- rehypePlugins = { [
235- rehypeRaw ,
236- ...( ( katexPlugin && ( message . latexRendered ?? true ) ) ? [ [
237- katexPlugin ,
238- {
239- errorColor : theme === 'dark' ? '#ef4444' : '#dc2626' ,
240- throwOnError : false ,
241- displayMode : false ,
242- strict : false ,
243- trust : true ,
244- // Add silent error handling to avoid console noise
245- errorCallback : ( error : string , latex : string ) => {
246- // Only show detailed errors in development environment
247- if ( process . env . NODE_ENV === 'development' ) {
248- console . warn ( 'KaTeX rendering error in main content:' , error , 'for LaTeX:' , latex ) ;
225+ < div className = { `prose dark:prose-invert max-w-none text-sm break-words prose-headings:mt-4 prose-headings:mb-2 prose-p:my-2 prose-ul:my-2 prose-ol:my-2 prose-li:my-1 [&_.katex]:text-current [&_.katex-display]:my-4 [&_.katex-display]:max-w-full [&_.katex-display_>.base]:overflow-x-auto [&_sup]:text-[0.75em] [&_sup]:align-[0.1em] [&_sup]:leading-[0] [&_sub]:text-[0.75em] [&_sub]:align-[-0.2em] [&_sub]:leading-[0] [&_mark]:bg-yellow-200 [&_mark]:dark:bg-yellow-800 [&_u]:underline [&_del]:line-through [&_ins]:underline [&_ins]:decoration-green-500 [&_.footnotes]:mt-8 [&_.footnotes]:pt-4 [&_.footnotes]:border-t [&_.footnotes_ol]:text-sm [&_.footnotes_li]:my-1 ${
226+ message . role === 'user' ? 'text-primary-foreground' : 'text-foreground'
227+ } ${
228+ message . role === 'user'
229+ ? '[&_.footnotes]:border-primary-foreground/30 [&_a[href^="#fn"]]:text-primary-foreground [&_a[href^="#fn"]]:no-underline [&_a[href^="#fn"]]:hover:underline [&_a[href^="#fnref"]]:text-primary-foreground [&_a[href^="#fnref"]]:no-underline [&_a[href^="#fnref"]]:hover:underline'
230+ : '[&_.footnotes]:border-border [&_a[href^="#fn"]]:text-primary [&_a[href^="#fn"]]:no-underline [&_a[href^="#fn"]]:hover:underline [&_a[href^="#fnref"]]:text-primary [&_a[href^="#fnref"]]:no-underline [&_a[href^="#fnref"]]:hover:underline'
231+ } `} >
232+ < ReactMarkdown
233+ remarkPlugins = { [ remarkGfm , remarkFootnotes , remarkMath ] }
234+ rehypePlugins = { [
235+ rehypeRaw ,
236+ ...( ( katexPlugin && ( message . latexRendered ?? true ) ) ? [ [
237+ katexPlugin ,
238+ {
239+ errorColor : theme === 'dark' ? '#ef4444' : '#dc2626' ,
240+ throwOnError : false ,
241+ displayMode : false ,
242+ strict : false ,
243+ trust : true ,
244+ // Add silent error handling to avoid console noise
245+ errorCallback : ( error : string , latex : string ) => {
246+ // Only show detailed errors in development environment
247+ if ( process . env . NODE_ENV === 'development' ) {
248+ console . warn ( 'KaTeX rendering error in main content:' , error , 'for LaTeX:' , latex ) ;
249+ }
249250 }
250251 }
251- }
252- ] as any ] : [ ] ) ,
253- rehypeReact
254- ] }
255- skipHtml = { false }
256- components = { mainMarkdownComponents }
257- >
258- { finalDisplayContent }
259- </ ReactMarkdown >
252+ ] as any ] : [ ] ) ,
253+ rehypeReact
254+ ] }
255+ skipHtml = { false }
256+ components = { mainMarkdownComponents }
257+ >
258+ { finalDisplayContent }
259+ </ ReactMarkdown >
260+ </ div >
260261 </ div >
261262 ) }
262263 { /* Loading indicator - only show in active tab */ }
0 commit comments