import React from 'react'; import ReactMarkdown from 'react-markdown'; import remarkGfm from 'remark-gfm'; import rehypeHighlight from 'rehype-highlight'; import 'highlight.js/styles/vs2015.css'; // Dark theme that matches VS Code interface MarkdownRendererProps { content: string; className?: string; } const MarkdownRenderer: React.FC = ({ content, className }) => { return (
{ const match = /language-(\w+)/.exec(className || ''); const inline = !className?.includes('language-'); return !inline && match ? (
                                
                                    {children}
                                
                            
) : ( {children} ); }, // Custom rendering for links to open externally a: ({ node, children, href, ...props }) => ( {children} ), // Custom rendering for tables table: ({ node, children, ...props }) => (
{children}
), // Custom rendering for blockquotes blockquote: ({ node, children, ...props }) => (
{children}
), }} > {content}
); }; export default MarkdownRenderer;