Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion ui/desktop/src/components/MarkdownContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,25 @@ import remarkGfm from 'remark-gfm';
import remarkBreaks from 'remark-breaks';
import { Prism as SyntaxHighlighter } from 'react-syntax-highlighter';
import { oneDark } from 'react-syntax-highlighter/dist/esm/styles/prism';
// Improved oneDark theme for better comment contrast and readability
const customOneDarkTheme = {
...oneDark,
'code[class*="language-"]': {
...oneDark['code[class*="language-"]'],
color: '#e6e6e6',
fontSize: '14px',
},
'pre[class*="language-"]': {
...oneDark['pre[class*="language-"]'],
color: '#e6e6e6',
fontSize: '14px',
},
comment: { ...oneDark.comment, color: '#a0a0a0', fontStyle: 'italic' },
prolog: { ...oneDark.prolog, color: '#a0a0a0' },
doctype: { ...oneDark.doctype, color: '#a0a0a0' },
cdata: { ...oneDark.cdata, color: '#a0a0a0' },
};

import { Check, Copy } from './icons';
import { wrapHTMLInCodeBlock } from '../utils/htmlSecurity';

Expand Down Expand Up @@ -62,7 +81,7 @@ const CodeBlock = memo(function CodeBlock({

return (
<SyntaxHighlighter
style={oneDark}
style={customOneDarkTheme}
language={language}
PreTag="div"
customStyle={{
Expand All @@ -76,6 +95,7 @@ const CodeBlock = memo(function CodeBlock({
wordBreak: 'break-all',
overflowWrap: 'break-word',
fontFamily: 'var(--font-sans)',
fontSize: '14px',
},
}}
// Performance optimizations for SyntaxHighlighter
Expand Down
Loading