diff options
| author | Maze Winther <mazewinther@gmail.com> | 2026-04-15 00:29:04 +0200 |
|---|---|---|
| committer | Maze Winther <mazewinther@gmail.com> | 2026-04-15 00:29:04 +0200 |
| commit | 3eccc2f9e338f63e6e0f84ad70b3b7f0439110e1 (patch) | |
| tree | f262161cd4992a4aaaec8d0265655e5c67c4d08d /apps/web/src | |
| parent | 368a20ddc2707661e6fbedcafddb4bb8f6333677 (diff) | |
| download | opencut-3eccc2f9e338f63e6e0f84ad70b3b7f0439110e1.tar.gz | |
fix: copy to markdown formatting
Diffstat (limited to 'apps/web/src')
| -rw-r--r-- | apps/web/src/app/changelog/components/copy-markdown-button.tsx | 22 |
1 files changed, 16 insertions, 6 deletions
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( - "<details>", - `<summary>${getSectionTitle({ type })}</summary>`, + buildCollapsibleMarkdownSection({ + title: getSectionTitle({ type }), + changes: grouped[type], + }), "", ); - for (const change of grouped[type]) { - lines.push(`- ${change.text}`); - } - lines.push("", "</details>", ""); 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 `<details>\n<summary>${title}</summary>\n\n${bulletLines}\n\n</details>`; +} + export function CopyMarkdownButton({ description, changes, |
