From 9aa485280a6c77e10266605668572c0e911a8ebc Mon Sep 17 00:00:00 2001 From: James Swirhun Date: Wed, 1 Apr 2026 12:32:14 -0600 Subject: [PATCH 1/2] Improve sidebar navigation and fix doc cleanup issues - Default sidebar sections to collapsed, auto-expand active page's ancestor chain, persist state in sessionStorage (resets on tab close) - Fix section ID generation to handle multi-word names with special chars - Group Language Reference into subsections: Core Concepts, Data & Types, Expressions & Functions, Aggregation & Analysis, Composition - Add 13 missing pages to TOC that were linked but not in sidebar nav - Restyle nested sidebar sections with left border instead of gray boxes - Make active sidebar item visually distinct from hover state - Remove empty window.malloynb (moved to GA as calculations_windows) - Fix broken link in experiments.malloynb to point to calculations_windows - Add experimental flag callout to sql_expressions docs Signed-off-by: James Swirhun --- scripts/page.ts | 8 +- src/css/document.css | 24 +- .../experiments/experiments.malloynb | 2 +- .../experiments/sql_expressions.malloynb | 4 +- src/documentation/experiments/window.malloynb | 2 - src/js/sidebar_state.js | 25 +- src/table_of_contents.json | 217 ++++++++++++------ 7 files changed, 185 insertions(+), 97 deletions(-) delete mode 100644 src/documentation/experiments/window.malloynb diff --git a/scripts/page.ts b/scripts/page.ts index 4e29ee8a..8f5a1a61 100644 --- a/scripts/page.ts +++ b/scripts/page.ts @@ -56,7 +56,7 @@ function isSectionItem(item: SectionItem | Section): item is SectionItem { function enrichTableOfContents(sections: Section[]): EnrichedSection[] { return sections.map((section) => { return { - id: section.title.toLowerCase().replace(" ", "_"), + id: section.title.toLowerCase().replace(/[^a-z0-9]+/g, "_").replace(/(^_|_$)/g, ""), title: section.title, items: section.items.map((item) => { if (isSectionItem(item)) { @@ -101,11 +101,7 @@ function renderSection(section: EnrichedSection | EnrichedSectionItem): string { } else { return `