Topbar, Step Cards, Chips: Polishing Generator Docs Pages
A manual full of screenshots with no wayfinding gets admins lost. The fix is generator-level chrome: sticky topbar, step cards, chips, and exit links.
TL;DR
The generated manual pages lacked navigation, so I moved page chrome into the generator with a single stylesheet and template covering topbar, sticky headers, and exit links. Step cards, capacity chips, and tables now render from data using CSS grid and color-mix tokens. Video frames use aspect-ratio to prevent layout shift, all applied automatically at regeneration.
The manual generator finished running, and the first page I opened showed screenshots stretching from top to bottom without a break. No marker of where the admin was, no shortcut back to the module list. Page context was nil. Every page was isolated like a loose file that did not know the others existed.
My first guess: add navigation to every markdown template. But that meant editing two dozen files whenever the structure changed, and a single missed template was enough to break consistency. The approach was wrong. What was missing was not content but page chrome — the framing layer that wraps generated content.
The decision I made: move chrome to the generator level. One stylesheet, one template, every page gets it.
A topbar that survives scrolling
The topbar uses position: sticky with top: 0. As the admin scrolls, the element travels with its container until it reaches the top offset, then stops and stays visible [1]. Positioning without JavaScript, pure CSS; the feature has been supported across browsers since July 2015 [1].
It holds three things: a brand link to the index, a group breadcrumb with text-overflow: ellipsis for long names, and a theme toggle at the far right. The breadcrumb is simple, just › group-name, yet it answers the question "which page is this?" without scrolling back up.
The way out of the page is also wired twice. A ← Index pill in the topbar, and a ← Back to module list link in the footer, next to the database evidence row. An admin who finished reading at the bottom does not scroll up just to switch pages. Exit navigation belongs where the eye stops.
Step cards and chips driven by data
Every tour step renders as a numbered card. The number is not a CSS counter but a span the generator writes: <span class="step-n">1</span> inside <figure class="step">. What aligns them is grid: grid-template-columns: 2.1rem 1fr, first column for the number, second for the step body [4]. Small round numbers, aligned content, no manual margins between the two.
Module capacity status is no longer plain text but chips: add/edit/delete shows green, add/edit without delete shows a dashed red border, read-only shows an accent chip. The capacityChips() and capacityPill() functions in the generator map crud data to those chip variants, and CSS just renders them. A status change in the manifest shows up on the page without editing markup.
Chip colors define no new hex values per status. The green variant uses color-mix() to blend the --ok token into the border color, for example color-mix(in srgb, var(--ok) 40%, var(--border)). The function returns the mixed color in the given colorspace and percentage [2], and has been widely available in browsers since May 2023 [2]. In practice: one accent color token, every derivative computed. Swapping tokens for the dark theme is enough; the chips follow on their own.
Tables and video that do not shift
The module table uses border-collapse: separate, because separated mode lets border-spacing control the gap between cells [5]. The table corners can then be rounded with border-radius plus overflow hidden. For comparison: with collapse mode, the rounded corners never appear. Quick proof, swap that one value in the browser and watch the table corners.
The table head is sticky: thead th with top: 3.4rem. That number is not decorative — the offset must sit below the topbar height, which is itself sticky at top: 0. Drop it, and the table head hides under the topbar while scrolling, and the admin loses the column names exactly when needed. The value must match each project's actual topbar height.
The tour video is wrapped in .video-wrap with aspect-ratio: 16/10. The property defines the box's width-to-height ratio, and the browser maintains that ratio as the container resizes, as long as one dimension stays automatic [3]. Before the video metadata loads, the frame already stands at its final size — no layout shift, no page jumping when the video arrives.
All of this lives in the generator's stylesheet, not in the pages. The next regeneration carries no risk of chrome missing on a particular page, and a new module automatically gets the same topbar, cards, chips, and way back. That is what made the early decision feel right: chrome is fixed once, at its source.