Open source Loom alternative. Beautiful, shareable screen recordings.
Rust appcapcossloommacnextjsnextjs15open-sourceossreactrecordrustscreen-capturescreen-recorderscreenshotsolidjstauritauri-apptypescriptvite
refactor(web): harden docs headings and release metadata parsing
Richie McIlroy858d4c1308c9
diff --git a/apps/web/utils/docs.ts b/apps/web/utils/docs.tsindex 84b0a89e0..d05eaf19d 100644--- a/apps/web/utils/docs.ts+++ b/apps/web/utils/docs.ts@@ -96,8 +96,8 @@ export function extractHeadings(content: string): DocHeading[] {const headingRegex = /^(#{2,3})\s+(.+)$/gm;const headings: DocHeading[] = [];for (const match of content.matchAll(headingRegex)) {- const level = match[1]!.length;- const text = match[2]!.trim();+ const level = match[1]?.length;+ const text = match[2]?.trim();const slug = text.toLowerCase().replace(/\s+/g, "-")diff --git a/apps/web/utils/releases.ts b/apps/web/utils/releases.tsindex c02eb5a03..c681c9409 100644--- a/apps/web/utils/releases.ts+++ b/apps/web/utils/releases.ts@@ -28,7 +28,7 @@ function parseDownloadsFromBody(body: string): ReleaseDownloads {const jsonMatch = body.match(/<!--\s*DOWNLOADS_JSON\s*(\{[^}]+\})\s*-->/);- if (jsonMatch && jsonMatch[1]) {+ if (jsonMatch?.[1]) {try {const parsed = JSON.parse(jsonMatch[1]);if (parsed["macos-arm64"])