Skip to content

Commit 0913781

Browse files
hinsleycursoragent
andauthored
Improve markdown rendering for non-markdown text with code block styling (#46)
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
1 parent e818d10 commit 0913781

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/lib/markdown.tsx

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import rehypeHighlight from 'rehype-highlight';
66
import rehypeSanitize, { defaultSchema } from 'rehype-sanitize';
77
import { useSettingsStore } from '@state/settings';
88
import 'katex/dist/katex.min.css';
9-
import 'highlight.js/styles/github-dark.css';
109

1110
interface MarkdownViewProps {
1211
text: string;
@@ -16,7 +15,16 @@ interface MarkdownViewProps {
1615
export default function MarkdownView({ text, className }: MarkdownViewProps) {
1716
const { markdownEnabled, katexEnabled, imageMaxWidthPx } = useSettingsStore();
1817
if (!markdownEnabled) {
19-
return <pre className={className}>{text}</pre>;
18+
return (
19+
<div className={`md ${className ?? ''}`}>
20+
<div className="code-block">
21+
<div className="code-lang">text</div>
22+
<pre>
23+
<code>{text}</code>
24+
</pre>
25+
</div>
26+
</div>
27+
);
2028
}
2129
// Preserve math classes through sanitization so rehype-katex can detect them.
2230
const sanitizeOptions: any = {

0 commit comments

Comments
 (0)