'use client';
import React from 'react';
import {
ShieldCheck,
CheckCircle2,
Lock,
Cpu,
Zap,
FileCheck,
AlertCircle,
ExternalLink,
ChevronRight
} from 'lucide-react';
interface RichTextSectionProps {
markdown?: string;
}
export function RichTextSection({ markdown = '' }: RichTextSectionProps) {
// Helper to parse inline markdown (bold, italic, code, links)
const renderInline = (text: string): React.ReactNode[] => {
// Split on markdown tokens: **bold**, *italic*, `code`, [link](url)
const regex = /(\*\*.*?\*\*|\*.*?\*|`.*?`|\[.*?\]\(.*?\))/g;
const parts = text.split(regex);
return parts.map((part, i) => {
if (!part) return null;
if (part.startsWith('**') && part.endsWith('**')) {
return (
{part.slice(2, -2)}
);
}
if (part.startsWith('*') && part.endsWith('*')) {
return (
{part.slice(1, -1)}
);
}
if (part.startsWith('`') && part.endsWith('`')) {
return (
{part.slice(1, -1)}
);
}
if (part.startsWith('[') && part.includes('](') && part.endsWith(')')) {
const linkMatch = part.match(/\[(.*?)\]\((.*?)\)/);
if (linkMatch) {
const [, linkText, linkHref] = linkMatch;
return (
{linkText}
{linkHref.startsWith('http') &&
| {renderInline(h.trim())} | ))}
|---|
| {renderInline(cell.trim())} | ))}
{renderInline(line)}
); } if (inTable) { const tableNode = flushTable(lines.length); if (tableNode) nodes.push(tableNode); } return nodes; }; return (