diff --git a/src/components/MarkdownRenderer.tsx b/src/components/MarkdownRenderer.tsx index 2f18762..14739ba 100644 --- a/src/components/MarkdownRenderer.tsx +++ b/src/components/MarkdownRenderer.tsx @@ -6,7 +6,8 @@ import { CheckCheck, Copy as CopyIcon, Brain } from 'lucide-react'; import Markdown, { MarkdownToJSX } from 'markdown-to-jsx'; import { useState } from 'react'; import { Prism as SyntaxHighlighter } from 'react-syntax-highlighter'; -import { oneDark } from 'react-syntax-highlighter/dist/cjs/styles/prism'; +import { oneDark, oneLight } from 'react-syntax-highlighter/dist/cjs/styles/prism'; +import { useTheme } from 'next-themes'; import ThinkBox from './ThinkBox'; // Helper functions for think overlay @@ -49,6 +50,8 @@ const CodeBlock = ({ className?: string; children: React.ReactNode; }) => { + const { theme } = useTheme(); + // Extract language from className (format could be "language-javascript" or "lang-javascript") let language = ''; if (className) { @@ -68,30 +71,34 @@ const CodeBlock = ({ setTimeout(() => setIsCopied(false), 2000); }; + // Choose syntax highlighting style based on theme + const syntaxStyle = theme === 'light' ? oneLight : oneDark; + const backgroundStyle = theme === 'light' ? '#fafafa' : '#1c1c1c'; + return ( -
{children}
);
},
},
+ strong: {
+ component: ({ children }) => (
+
+ {children}
+
+ ),
+ },
pre: {
component: ({ children }) => children,
},
@@ -177,9 +191,10 @@ const MarkdownRenderer = ({