import React from 'react'; // Minimal inline-markdown renderer (bold, italic, code) // IMPORTANT: regex must have NO nested capture groups — split() includes captured // groups in the result, and nested groups produce undefined entries that crash on .startsWith() function renderInline(text: string): React.ReactNode[] { const parts = text.split(/(\*\*[^*]+\*\*|\*[^*]+\*|`[^`]+`)/g); 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)}; return part; }); } /** Renders a GitHub release body as themed changelog markup. */ export default function Changelog({ body }: { body: string }) { return ( <> {body.split('\n').map((line, i) => { if (line.startsWith('### ')) return
{renderInline(line.slice(4))}
; if (line.startsWith('#### ')) return
{renderInline(line.slice(5))}
; if (line.startsWith('## ')) return null; // skip nested release headers in body if (line.startsWith('- ')) return
{renderInline(line.slice(2))}
; if (line.trim() === '') return null; return
{renderInline(line)}
; })} ); }