({ line }: { line: string })
| 98 | } |
| 99 | |
| 100 | function ProseLine({ line }: { line: string }): React.ReactElement { |
| 101 | // Headings — clear hierarchy by level. |
| 102 | const h = line.match(/^(#{1,6})\s+(.*)$/); |
| 103 | if (h) { |
| 104 | const level = h![1].length; |
| 105 | const text = h![2]; |
| 106 | if (level === 1) return <Text bold color="magenta">{renderInline(text)}</Text>; |
| 107 | if (level === 2) return <Text bold color="cyan">{renderInline(text)}</Text>; |
| 108 | if (level === 3) return <Text bold color="blue">{renderInline(text)}</Text>; |
| 109 | return <Text bold>{renderInline(text)}</Text>; |
| 110 | } |
| 111 | // Blockquote |
| 112 | const q = line.match(/^>\s?(.*)$/); |
| 113 | if (q) { |
| 114 | return <Text><Text color="gray">▏ </Text><Text dimColor>{renderInline(q![1])}</Text></Text>; |
| 115 | } |
| 116 | // Bullets |
| 117 | const b = line.match(/^(\s*)[-*]\s+(.*)$/); |
| 118 | if (b) { |
| 119 | return <Text>{b![1]}<Text color="cyan">• </Text>{renderInline(b![2])}</Text>; |
| 120 | } |
| 121 | // Numbered list |
| 122 | const n = line.match(/^(\s*)(\d+)\.\s+(.*)$/); |
| 123 | if (n) { |
| 124 | return <Text>{n![1]}<Text color="cyan">{n![2]}. </Text>{renderInline(n![3])}</Text>; |
| 125 | } |
| 126 | return <Text>{renderInline(line)}</Text>; |
| 127 | } |
| 128 | |
| 129 | // --------------------------------------------------------------------------- |
| 130 | // Lightweight, verbatim-safe syntax highlighting. |
nothing calls this directly
no test coverage detected