import * as React from 'react'; import { cn } from '@/lib/utils'; /** * Renders the light markup the capabilities emit — `**bold**`, bullets, * numbered items, `_asides_`, and ✓/⚠ check lines. * * A full markdown renderer is available in the project, but this content is * produced locally in a known shape, and parsing five constructs keeps the * assistant's typography inside the design system rather than inheriting a * library's defaults. */ const BOLD = /\*\*(.+?)\*\*/g; function inline(line, keyPrefix) { const parts = []; let last = 0; let match; BOLD.lastIndex = 0; while ((match = BOLD.exec(line)) !== null) { if (match.index > last) parts.push(line.slice(last, match.index)); parts.push( {match[1]} ); last = match.index + match[0].length; } if (last < line.length) parts.push(line.slice(last)); return parts.length ? parts : line; } export function RichText({ text, className }) { const lines = React.useMemo(() => String(text).split('\n'), [text]); return (
{inline(line.slice(1, -1), i)}
); } /* Bullet. */ if (line.startsWith('• ')) { return ({inline(line.trim(), i)}
); } /* Numbered item. */ const numbered = line.match(/^(\d+)\.\s+(.*)$/); if (numbered) { return ({inline(line, i)}
; })}Stopped early.
)}