Skip to content

docs: browsable widget catalog site (Astro + Starlight + xtask snapshot generator) #52

Closed

Description

@unhappychoice

Motivation

The Fetcher × Renderer × Options design produces a combinatorial surface that's hard to grok from AGENTS.md prose alone. Users can't currently browse what clock + ratio = \"year\" + gauge actually looks like without writing a config and running it. The dogfood .splashboard/config.toml covers a handful of combos as a visual smoke test, but it's not browsable, not searchable, and grows unwieldy as widgets multiply.

Goal: a published docs site that's

  1. Browsable — one page per fetcher, showing every supported (shape, renderer, option-preset) combination with a rendered example next to the config snippet.
  2. Accurate by construction — the fetcher × shape and shape × renderer matrices are generated from code, not hand-maintained. Snapshots are re-rendered from the actual runtime, not drawn by hand.
  3. Readable — color-preserving snapshots (not plain ASCII), so badges, gauges, heatmaps look right.
  4. Public — GitHub Pages, linked from the README.

Pipeline

handwritten MDX (docs-site/src/content/widgets/<fetcher>.mdx)   ┐
generated matrices MD (from Registry metadata)                  ├→ Astro + Starlight → static HTML → GH Pages
generated snapshots (HTML span-per-cell)                        ┘

Components

xtask crate (workspace-level)

  • cargo xtask gen-matrix — reads the built-in Registry, emits docs-site/src/content/reference/matrix.md with:
    • Fetcher × Shape table (each fetcher's shapes())
    • Shape × Renderer table (each renderer's accepts())
    • Safety-class column per fetcher
  • cargo xtask snapshot — for each registered (fetcher, renderer, option-preset) tuple, renders the widget via ratatui TestBackend into a Buffer, then converts to an HTML fragment: <pre class=\"splash-snapshot\"> containing one <span style=\"color:#…;background:#…\"> per contiguous same-style cell run. Writes to docs-site/src/content/widgets/<fetcher>/<preset>.html.
    • Presets declared in xtask/src/presets.rs (Rust-typed) so adding a showcase is a code PR, not config sprinkled across the docs tree.
  • cargo xtask docs — convenience target: runs both generators then astro build.

docs-site/ (Astro + Starlight)

  • docs-site/ at repo root, Node-based.
  • Starlight theme (sidebar per fetcher / renderer / reference, built-in search).
  • Handwritten docs-site/src/content/widgets/<fetcher>.mdx with prose on options, then <Snapshot id=\"…\" /> MDX components that inline the generated HTML fragments.
  • GitHub Actions builds and publishes to gh-pages on every merge to main.

Snapshot format

  • Self-contained HTML fragments: <pre class=\"splash-snapshot\">…<span style=\"…\">X</span>…</pre>.
  • Color mapping: ratatui Color → hex via a small table (ANSI 16 baseline; truecolor passes through).
  • Style runs: collapse adjacent same-style cells into one <span> to keep the DOM tiny.
  • Plain-text fallback (ANSI stripped) written alongside for GitHub-MD viewing contexts.

Open decisions (document + revisit in PR)

  • Presets in Rust (xtask) vs TOML (docs-site/presets.toml). Rust keeps it typed; TOML keeps it writable by non-Rust contributors.
  • <Snapshot /> implementation: MDX integration that reads files at build, or plain raw-HTML include?
  • Dark / light theme: CSS invert at runtime, or two snapshots per preset?
  • Link from README as soon as first page ships, or wait for GA?

Out of scope

  • SVG / PNG rendering. HTML spans cover color and selectability; SVG adds font-metrics complexity for no win on monospace widgets.
  • Self-hosting beyond GH Pages.
  • Runtime-embedded docs (a splashboard help <fetcher> CLI). Revisit if users ask.
  • Screensaver / persistent animation previews — the existing 2 s animation window is enough for the site to capture motion via the animation frames it already renders.

Done looks like

  • cargo xtask docs from a clean clone produces a full site at docs-site/dist/.
  • Every fetcher in the Registry has a page with ≥1 snapshot.
  • Matrices regenerate from code — adding a new fetcher / renderer and re-running cargo xtask gen-matrix updates the tables without a human editing markdown.
  • Site published at https://unhappychoice.github.io/splashboard/.
  • README links to the site.

Related

Activity

  1. added a commit that references this issue on Apr 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions