import React from 'react'; import ReactMarkdown from 'react-markdown'; import remarkGfm from 'remark-gfm'; import { Prism as SyntaxHighlighter } from 'react-syntax-highlighter'; import { vscDarkPlus } from 'react-syntax-highlighter/dist/esm/styles/prism'; export interface MarkdownPreviewProps { content?: string; fileName?: string; } export const MarkdownPreview: React.FC = ({ content = '', fileName }) => { if (!content) { return (
No content available
); } return (
{children} ); } if (match) { return ( {codeString} ); } return (
                  
                    {codeString}
                  
                
); }, // 链接 a: ({ href, children }) => ( {children} ), // 表格 table: ({ children }) => (
{children}
), thead: ({ children }) => ( {children} ), th: ({ children }) => ( {children} ), td: ({ children }) => ( {children} ), }} > {content}
); };