atproto utils for zig zat.dev
atproto sdk zig

docs: nicer sidebar titles

Changed files
+15 -3
scripts
+15 -3
scripts/build-wisp-docs.mjs
··· 57 57 return fallback.replace(/\.md$/i, ""); 58 58 } 59 59 60 + function normalizeTitle(title) { 61 + let t = String(title || "").trim(); 62 + // If pages follow a "zat - ..." style, drop the redundant prefix in the nav. 63 + t = t.replace(/^zat\s*-\s*/i, ""); 64 + // Cheaply capitalize (keeps the rest as-authored). 65 + if (t.length) t = t[0].toUpperCase() + t.slice(1); 66 + return t; 67 + } 68 + 60 69 async function getBuildId() { 61 70 try { 62 71 const { stdout } = await execFileAsync("git", ["rev-parse", "HEAD"], { ··· 110 119 if (await exists(readme)) { 111 120 const md = await readFile(readme, "utf8"); 112 121 await writeFile(path.join(outDocsDir, "index.md"), md, "utf8"); 113 - pages.push({ path: "index.md", title: titleFromMarkdown(md, "index.md") }); 122 + pages.push({ 123 + path: "index.md", 124 + title: normalizeTitle(titleFromMarkdown(md, "index.md")), 125 + }); 114 126 } 115 127 } 116 128 ··· 121 133 await writeFile(path.join(outDocsDir, "changelog.md"), md, "utf8"); 122 134 pages.push({ 123 135 path: "changelog.md", 124 - title: titleFromMarkdown(md, "changelog.md"), 136 + title: normalizeTitle(titleFromMarkdown(md, "changelog.md")), 125 137 }); 126 138 } 127 139 ··· 134 146 await cp(src, dst); 135 147 136 148 const md = await readFile(src, "utf8"); 137 - pages.push({ path: rel, title: titleFromMarkdown(md, rel) }); 149 + pages.push({ path: rel, title: normalizeTitle(titleFromMarkdown(md, rel)) }); 138 150 } 139 151 140 152 await writeFile(