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}
}, ul({ 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}