|
@@ -3,7 +3,7 @@ import remarkGfm from "remark-gfm";
|
|
|
import rehypeRaw from "rehype-raw";
|
|
|
import { Prism as SyntaxHighlighter } from "react-syntax-highlighter";
|
|
|
import { vscDarkPlus } from "react-syntax-highlighter/dist/esm/styles/prism";
|
|
|
-import { useState } from "react";
|
|
|
+import { useMemo, useState } from "react";
|
|
|
import "./index.less";
|
|
|
|
|
|
interface MarkdownViewerProps {
|
|
@@ -33,6 +33,11 @@ const CodeHeader: React.FC<{
|
|
|
|
|
|
const MarkdownViewer: React.FC<MarkdownViewerProps> = ({ content }) => {
|
|
|
const [copiedIndex, setCopiedIndex] = useState<number | null>(null);
|
|
|
+ const filterContent = useMemo(() => {
|
|
|
+ return content
|
|
|
+ .replaceAll("<think>", '<div class="think">')
|
|
|
+ .replaceAll("</think>", "</div>");
|
|
|
+ }, [content]);
|
|
|
|
|
|
const handleCopy = (code: string, index: number) => {
|
|
|
navigator.clipboard.writeText(code);
|
|
@@ -86,7 +91,7 @@ const MarkdownViewer: React.FC<MarkdownViewerProps> = ({ content }) => {
|
|
|
},
|
|
|
}}
|
|
|
>
|
|
|
- {content}
|
|
|
+ {filterContent}
|
|
|
</ReactMarkdown>
|
|
|
</div>
|
|
|
);
|