import React, { useMemo } from 'react'; interface MarkdownRendererProps { text: string; } const MarkdownRenderer = ({ text }: MarkdownRendererProps) => { const content = useMemo(() => { if (!text) return null; const blocks = text.split(/(\n{2,})/g); return blocks.map((block, i) => { if (/^\s*$/.test(block)) { return null; } const lines = block.trim().split('\n'); const isList = lines.length > 0 && lines.every((line) => line.trim().startsWith('* ') || line.trim().startsWith('- ')); if (isList) { return (
{line .split(boldRegex) .map((part, k) => (k % 2 === 1 ? {part} : part))}
))}