{showCopyButton ? (
@@ -121,16 +103,18 @@ export function CodeBlock(props: {
) : null}
-
-
- {props.code}
-
-
+
+ {typeof highlighted === 'string' ? (
+
+ ) : (
+
+ {highlighted ?? props.code}
+
+ )}
+
)
}
diff --git a/web/src/components/MarkdownRenderer.tsx b/web/src/components/MarkdownRenderer.tsx
index 99f9a310..106a5ce5 100644
--- a/web/src/components/MarkdownRenderer.tsx
+++ b/web/src/components/MarkdownRenderer.tsx
@@ -1,50 +1,30 @@
-import ReactMarkdown, { Components } from 'react-markdown'
-import remarkGfm from 'remark-gfm'
-import { CodeBlock } from '@/components/CodeBlock'
-
-function getLanguageFromClassName(className?: string): string | null {
- if (!className) return null
- for (const token of className.split(/\s+/g)) {
- if (token.startsWith('language-')) {
- return token.slice('language-'.length) || null
- }
- }
- return null
-}
-
-const defaultComponents: Components = {
- code({ className, children, ...props }) {
- const language = getLanguageFromClassName(className) || 'text'
- const code = String(children).replace(/\n$/, '')
-
- if (language !== 'text' || code.includes('\n')) {
- return (
-