import React from 'react'; interface MarkdownLiteProps { children: string; className?: string; } // Supports [text](url) and `code` only const MarkdownLite: React.FC = ({ children, className }) => { if (!children) return null; // Regex for [text](url) and `code` const regex = /(`[^`]+`|\[[^\]]+\]\([^\)]+\))/g; const parts = children.split(regex); const matches = children.match(regex) || []; let matchIdx = 0; return ( {parts.map((part, i) => { if (i === parts.length - 1 && part === '') return null; if (i % 2 === 0) { // Plain text return part; } else { const match = matches[matchIdx++]; if (!match) return null; if (match.startsWith('`') && match.endsWith('`')) { // Inline code return ( {match.slice(1, -1)} ); } else { // Link const linkMatch = match.match(/\[([^\]]+)\]\(([^\)]+)\)/); if (linkMatch) { const [, text, url] = linkMatch; return ( {text} ); } } return match; } })} ); }; export default MarkdownLite;