feat(cli): preserve leading numeric prefixes in Blume group slugs

This commit is contained in:
Prad Nukala committed 2026-09-24 15:17:04 -04:00
1 parent a2d32c5f06
commit 9d535c6826
2 files changed
+269 -7

No files matched your search

+8 -1
View File
@@ -475,7 +475,14 @@ for (const sol of ordered) {
// An unplanned problem's category may share a folder with a numbered topic
// (`Hash Table` warm-ups under topic 1); the numbered one owns the meta.
const topic = topics.get(sol.num) ?? { name: sol.category };
const group = topic.name.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "");
// Blume reads a leading `<digits>-` on a folder as a sidebar-order prefix and
// strips it from the route (`1-d-…` → `/d-…`), so a slug that would start that
// way keeps the digits glued to the next token (`1d-dynamic-programming`).
const group = topic.name
.toLowerCase()
.replace(/[^a-z0-9]+/g, "-")
.replace(/^-|-$/g, "")
.replace(/^(\d+)-/, "$1");
if (groups.get(group)?.order === undefined) groups.set(group, topic);
const name = `${group}/${sol.num}-${sol.slug}.mdx`;
const existing = pages.get(sol.num);