mirror of
https://github.com/OpenCut-app/OpenCut.git
synced 2026-07-13 21:52:53 +02:00
fix: copy to markdown formatting
This commit is contained in:
@@ -29,14 +29,12 @@ function buildMarkdown({
|
|||||||
for (const type of orderedTypes) {
|
for (const type of orderedTypes) {
|
||||||
if (isSectionCollapsible({ type })) {
|
if (isSectionCollapsible({ type })) {
|
||||||
lines.push(
|
lines.push(
|
||||||
"<details>",
|
buildCollapsibleMarkdownSection({
|
||||||
`<summary>${getSectionTitle({ type })}</summary>`,
|
title: getSectionTitle({ type }),
|
||||||
|
changes: grouped[type],
|
||||||
|
}),
|
||||||
"",
|
"",
|
||||||
);
|
);
|
||||||
for (const change of grouped[type]) {
|
|
||||||
lines.push(`- ${change.text}`);
|
|
||||||
}
|
|
||||||
lines.push("", "</details>", "");
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -50,6 +48,18 @@ function buildMarkdown({
|
|||||||
return lines.join("\n").trimEnd();
|
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({
|
export function CopyMarkdownButton({
|
||||||
description,
|
description,
|
||||||
changes,
|
changes,
|
||||||
|
|||||||
Reference in New Issue
Block a user