'use client'; import ReactMarkdown from 'react-markdown'; import remarkGfm from 'remark-gfm'; import Image from 'next/image'; import Link from 'next/link'; import { Prism as SyntaxHighlighter } from 'react-syntax-highlighter'; import { vscDarkPlus } from 'react-syntax-highlighter/dist/esm/styles/prism'; interface MarkdownRendererProps { content: string; } export default function MarkdownRenderer({ content }: MarkdownRendererProps) { return ( (

{children}

), h2: ({ children }) => (

{children}

), h3: ({ children }) => (

{children}

), h4: ({ children }) => (

{children}

), h5: ({ children }) => (
{children}
), h6: ({ children }) => (
{children}
), p: ({ children }) => (

{children}

), ul: ({ children }) => ( ), ol: ({ children }) => (
    {children}
), li: ({ children }) => (
  • {children}
  • ), blockquote: ({ children }) => (
    {children}
    ), code: ({ inline, className, children, ...props }: any) => { const match = /language-(\w+)/.exec(className || ''); return !inline && match ? ( {String(children).replace(/\n$/, '')} ) : ( {children} ); }, img: ({ src, alt }) => { if (!src || typeof src !== 'string') return null; const isExternal = src.startsWith('http://') || src.startsWith('https://'); if (isExternal) { return ( {alt ); } return (
    {alt
    ); }, a: ({ href, children }) => { if (!href) return <>{children}; const isExternal = href.startsWith('http://') || href.startsWith('https://'); if (isExternal) { return ( {children} ); } return ( {children} ); }, table: ({ children }) => (
    {children}
    ), thead: ({ children }) => ( {children} ), tbody: ({ children }) => ( {children} ), tr: ({ children }) => ( {children} ), th: ({ children }) => ( {children} ), td: ({ children }) => ( {children} ), }} > {content}
    ); }