diff --git a/website/app/lib/release.ts b/website/app/lib/release.ts index 8800c60f..4299e354 100644 --- a/website/app/lib/release.ts +++ b/website/app/lib/release.ts @@ -99,6 +99,7 @@ export type SparkleRelease = SparkleItem & { export type AppReleaseNote = SparkleRelease & { tag: string; isPrerelease: boolean; + releaseNotesMarkdown: string | null; }; function pickTag(xml: string, tag: T): string | null { @@ -199,74 +200,6 @@ export async function getSparkleReleases(): Promise { } } -function escapeHtml(value: string): string { - return value - .replace(/&/g, "&") - .replace(//g, ">") - .replace(/"/g, """); -} - -function inlineMarkdownToHtml(value: string): string { - return escapeHtml(value) - .replace(/\*\*([^*]+)\*\*/g, "$1") - .replace(/`([^`]+)`/g, "$1"); -} - -function releaseMarkdownToHtml(markdown: string): string { - const lines = markdown.split(/\r?\n/); - const html: string[] = []; - let inList = false; - - const closeList = () => { - if (inList) { - html.push(""); - inList = false; - } - }; - - for (const line of lines) { - const trimmed = line.trim(); - if (!trimmed) { - closeList(); - continue; - } - - if (trimmed.startsWith("### ")) { - closeList(); - html.push(`

${inlineMarkdownToHtml(trimmed.slice(4))}

`); - continue; - } - - if (trimmed.startsWith("## ")) { - closeList(); - html.push(`

${inlineMarkdownToHtml(trimmed.slice(3))}

`); - continue; - } - - if (trimmed.startsWith("# ")) { - closeList(); - html.push(`

${inlineMarkdownToHtml(trimmed.slice(2))}

`); - continue; - } - - if (trimmed.startsWith("- ")) { - if (!inList) { - html.push("