fix: copy to markdown formatting

This commit is contained in:
Maze Winther 2026-04-15 00:29:04 +02:00
parent 368a20ddc2
commit 3eccc2f9e3
1 changed files with 16 additions and 6 deletions

View File

@ -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,