import Markdown from 'react-markdown' import remarkGfm from 'remark-gfm' import { Match } from './mentions_editor'; export default function MarkdownContent({ content, atValues = [] }: { content: string; atValues?: Match[]; }) { return
{children} }, h2({ children }) { return

{children}

}, h3({ children }) { return

{children}

}, h4({ children }) { return

{children}

}, h5({ children }) { return
{children}
}, h6({ children }) { return
{children}
}, strong({ children }) { return {children} }, p({ children }) { return

{children}

}, ul({ children }) { return }, ol({ children }) { return }, table({ children }) { return {children}
}, th({ children }) { return {children} }, td({ children }) { return {children} }, blockquote({ children }) { return
{children}
; }, a(props) { const { children, href, className, node, ...rest } = props; // If this is a mention link, render it with mention styling if (href === '#mention') { let label: string = ''; // Check if children is an array and get the first text element if (Array.isArray(children) && children.length > 0) { const text = children[0]; if (typeof text === 'string') { const parts = text.split('@'); if (parts.length === 2) { label = parts[1]; } } } else if (typeof children === 'string') { // Fallback for direct string children const parts = children.split('@'); if (parts.length === 2) { label = parts[1]; } } // check if the the mention is valid const invalid = !atValues.some(atValue => atValue.id === label); if (atValues.length > 0 && invalid) { return ( @{label} (!) ); } return ( @{label} ); } // Otherwise render normal link (your existing link component) return {children} }, }} > {content}
; }