fix(webui): handle undefined language in code blocks
When fenced code blocks have no language specifier, react-syntax-highlighter receives undefined for the language prop, causing a white screen crash. - CodeBlock.tsx: fallback to 'text' when language is undefined - MarkdownTextRenderer.tsx: defensive fallback at fence rendering site - Added test cases for both components Fixes #4116
This commit is contained in:
@@ -33,7 +33,7 @@ const LazyHighlightedCode = lazy(async () => {
|
||||
default({ language, code, isDark }: HighlightedCodeProps) {
|
||||
return (
|
||||
<SyntaxHighlighter
|
||||
language={language}
|
||||
language={language || "text"}
|
||||
style={isDark ? oneDark : oneLight}
|
||||
customStyle={{
|
||||
margin: 0,
|
||||
|
||||
Reference in New Issue
Block a user