ADR-0016: Rich artifacts in the Book — markdown spine, served HTML, Mermaid diagrams
ADR-0016: Rich artifacts in the Book — markdown spine, served HTML, Mermaid diagrams
Status
Accepted
Date
2026-06-25
Context
The Book (apps/book) is an Astro Starlight site that sources canon Markdown from the repo-root
docs/ directory via a glob content loader, and provides full-text search through Pagefind,
which indexes only the Starlight-rendered doc pages (those carrying data-pagefind-body) — not files
served from public/.
We increasingly produce rich visual artifacts that are not plain prose: self-contained
Vinxi-branded HTML explainers (e.g. the SmartProjects one-pager, the fiber and oil-gas
courses) and diagrams (architecture, flow, state machines). These already exist in two forms — the
courses are served as standalone HTML from apps/book/public/courses/… — but they are not
discoverable through search or the sidebar, and there was no agreed convention for diagrams.
We need a durable answer to: how do rich HTML and diagrams live in the Book while staying highly
discoverable and searchable, alongside the canon Markdown? The constraints that shape it: Pagefind
indexes doc pages only; the build runs in CI/Vercel and must not depend on a headless browser;
everything visual must follow the Vinxi design system (see the vinxi-brand skill).
Decision
Markdown/MDX is the searchable spine; rich artifacts hang off it.
- Every rich artifact has a Markdown (or MDX) doc page in the appropriate room. That page is the
canonical, navigable, Pagefind-indexed unit (and flows into the generated
llms.txt). It carries a distilled, searchable summary even when the richness lives elsewhere. - Standalone rich HTML (Vinxi explainers, courses) lives in
apps/book/public/<category>/, served at/<category>/…, and is linked — and optionally<iframe>-embedded — from its doc page. Because Pagefind does not indexpublic/, the paired doc page is the searchable proxy. - Diagrams, in order of preference:
- Mermaid (
```mermaidfences) for flow / architecture / sequence / state diagrams. Rendered client-side via theastro-mermaidintegration (no build-time browser dependency), themed to the Vinxi palette. The fence source is text, so diagrams are diffable, LLM-readable, and the source words are indexed by Pagefind. - Inline SVG in Markdown for bespoke schematics that Mermaid cannot express.
- tldraw (or similar canvas tools) used as an authoring tool only: export to SVG, commit
the SVG (keeping the
.tldrsource alongside for editing). No live tldraw canvases in docs.
- Mermaid (
- MDX is enabled (
@astrojs/mdx) so doc pages may embed components/iframes inline; plain.mdcontinues to work unchanged. The content-loader globs accept.mdand.mdx. - All generated visuals use the Vinxi design system (per the
vinxi-brandskill / Patterns).
Alternatives Considered
- Raw HTML in
public/only, no Markdown proxy. Simplest, but the artifact is invisible to search and the sidebar — exactly the gap we hit with the courses. Rejected: discoverability is the whole point. - Build-time Mermaid (
rehype-mermaid+mermaid-isomorphic/Playwright). Produces static SVG indexable as markup, but adds a headless-browser dependency that is heavy and fragile in CI/Vercel. Rejected: build safety outweighs the marginal indexing benefit, and the fence source is already searchable. - Live tldraw React islands in docs. Interactive, but requires a React renderer, ships a heavy canvas, and is not searchable. Rejected for docs; tldraw remains fine as an authoring tool.
- Custom Pagefind scope over the
public/HTML. Possible, but the standalone explainers are not structured with Pagefind’sdata-pagefind-bodyregions, so results would be noisy. The Markdown-proxy rule gives a curated, higher-quality search surface instead.
Consequences
- Easier: rich explainers and diagrams become first-class, discoverable canon — searchable, in
the nav, and in
llms.txt. Diagrams are diffable text. Brand consistency is enforced. Authors get three clear, ranked diagram options. - What we now owe: each rich HTML needs a paired Markdown page (a small, deliberate summary
duplication) and a copy/sync step keeping
apps/book/public/<category>/aligned with any canonical source underdocs/. Mermaid renders client-side, so a diagram needs JS to draw (its source text is still indexed); this is acceptable for an internal docs site. - Sensitive to: if we later require full-text search inside a rich HTML explainer, this ADR
should be revisited — either by converting that explainer to MDX (so Starlight renders and indexes
it) or by scoping Pagefind over selected
public/pages.