Skip to content

feat(docs): sidebar TOC for language reference#9

Merged
kollhof merged 1 commit intomainfrom
docs-sidebar
Mar 19, 2026
Merged

feat(docs): sidebar TOC for language reference#9
kollhof merged 1 commit intomainfrom
docs-sidebar

Conversation

@kollhof
Copy link
Member

@kollhof kollhof commented Mar 19, 2026

Summary

  • Auto-generated sidebar from ## headings in markdown
  • extract_toc() in markdown.rs extracts headings and slugifies them
  • render() injects id= attributes on h2 elements for anchor links
  • New docs template with two-column layout (aside sidebar + prose)
  • Sidebar is sticky, clears header, scrollable if content overflows
  • language/index.md uses the new template
  • Used <aside> instead of <nav> to avoid inheriting nav { height: 3.5rem }

Test plan

  • Language reference page shows sidebar with all section links
  • Clicking a sidebar link scrolls to the correct section
  • Sidebar sticks correctly when scrolling
  • Other pages (guides, contributing, home) unaffected
  • Mobile: sidebar hidden below 800px

- markdown.rs: extract_toc() pulls ## headings + slugifies them; render() injects id= on h2 elements
- main.rs: passes toc as Vec<HashMap> to all page templates
- New docs.html template: aside sidebar + prose content in two-column layout
- style.css: docs-layout, docs-sidebar, docs-content styles; sidebar sticky below header
- language/index.md: switched to docs template
- Used <aside> not <nav> to avoid inheriting nav { height: 3.5rem }
@kollhof kollhof merged commit 9a998cb into main Mar 19, 2026
4 checks passed
@kollhof kollhof deleted the docs-sidebar branch March 19, 2026 14:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant