diff --git a/apps/web/src/app/changelog/components/copy-markdown-button.tsx b/apps/web/src/app/changelog/components/copy-markdown-button.tsx index ddf7bbb1..bc7e94bf 100644 --- a/apps/web/src/app/changelog/components/copy-markdown-button.tsx +++ b/apps/web/src/app/changelog/components/copy-markdown-button.tsx @@ -29,14 +29,12 @@ function buildMarkdown({ for (const type of orderedTypes) { if (isSectionCollapsible({ type })) { lines.push( - "
", - `${getSectionTitle({ type })}`, + buildCollapsibleMarkdownSection({ + title: getSectionTitle({ type }), + changes: grouped[type], + }), "", ); - for (const change of grouped[type]) { - lines.push(`- ${change.text}`); - } - lines.push("", "
", ""); continue; } @@ -50,6 +48,18 @@ function buildMarkdown({ return lines.join("\n").trimEnd(); } +function buildCollapsibleMarkdownSection({ + title, + changes, +}: { + title: string; + changes: Change[]; +}): string { + const bulletLines = changes.map((change) => `- ${change.text}`).join("\n"); + + return `
\n${title}\n\n${bulletLines}\n\n
`; +} + export function CopyMarkdownButton({ description, changes,