Docs site

Status: plan, not built.

What it must do

Pick: a small Rust site builder

The repo is all Rust (Code style rule 1). So the site is a small Rust program, not VitePress, Starlight or another Node tool. It uses pulldown-cmark to turn markdown into HTML. That keeps the rule with no exception.

NeedHow
Read docs/ in placeThe builder walks docs/ and reads each .md file
README.md as section pagedir/README.md becomes dir/index.html
Relative .md linksRewrite x.md to x.html (and README.md to index.html) while rendering
SidebarBuilt from front matter: folder title and place from README.md, pages by order
SearchA small JSON index (title, description, headings) and a few lines of plain script in the page
Dark mode, phone layoutOur own CSS from the tokens
Design showcasePlain HTML parts the builder adds under each docs/design/*.md page

Trade-off: we build search, dark mode and the phone layout ourselves. They are small, and the look is ours.

Build steps

  1. Crate. A new binary crate, docs-site/ at the repo root (outside docs/). Few crates, exact pins, a reason beside each: pulldown-cmark for markdown; front matter parsed by hand (three keys) or with the YAML crate the server already uses.
  2. Pages. Render every .md under docs/ to HTML in docs-site/out/. One HTML template, no outside scripts, fonts or CSS from the web. Inter is bundled.
  3. Links. Rewrite relative .md links. Fail the build on a link to a file that does not exist.
  4. Sidebar. One section per folder, ordered by the README.md order, pages by their own order. MIGRATION.md goes under "About these docs".
  5. Theme. A tokens.css made from the token file (see rollout step 1). Until it exists, a hand-made copy of Tokens. Follow the motion curves and reduced motion. Use Lucide icons.
  6. Search. Write search.json (title, description, headings, path). The page searches it in the browser.
  7. Design showcase. Swatches in light and dark, the type scale, spacing and corners, motion demos with a play button, the icon grid, and live copies of buttons, bubbles, cards, sheet and toast. The docs/design/*.md pages stay plain markdown.
  8. Checks. cargo run -j1 -- check (in docs-site/) fails on: missing front matter, a title that does not match the # heading, a page not listed in its folder's README.md, a broken relative link, and likely secrets (a built-in scan for keys, tokens and private IP ranges). It runs without gitleaks; gitleaks is an extra when installed.
  9. Build. cargo run -j1 -- build makes static files in docs-site/out/. Tests: a golden test per check, in Rust.

Hosting

Local only, by default. The docs map the attack surface: routes, sandbox notes, bridge calls, deploy paths. So they are never public unless the owner says so.

Docs hold no secrets, tokens or private addresses (Writing docs); the check in step 8 keeps it that way.

Staying in sync with code

Not in this plan

Versioned docs, other languages, comments.