Documentation site
The public /docs area renders this wiki using the app’s design tokens. A build-time compiler keeps article bodies and linked source files on the server.
Single content source
Edit HTML articles under docs/codebase and register their navigation in
js/docs.js. The standalone site still opens locally.
bun run docs:generate extracts article content, preserves or assigns section
IDs, rewrites local links, and checks article destinations. Dev, build, and typecheck run
generation automatically. Rerun it or restart dev after editing the wiki.
Server rendering and navigation
Generated article and source JSON are server imports. The client receives the selected article plus a small navigation index containing titles, descriptions and topics. It does not download the full wiki or repository. Sidebar filtering is local; internal article links use client navigation. Link prefetch is disabled to avoid fetching every listed page. A shared layout keeps the sidebar mounted, with a collapsible mobile menu and per-article section and previous/next links.
The documentation frame uses the application’s background, foreground, card, border, font and accent tokens. It inherits appearance preferences without loading the review editor. Notification polling pauses while the pathname is under /docs and resumes on returning to the application.
Linked source files
The generator collects explicitly linked repository files into a build-time allowlist. The source route renders an escaped text snapshot from that build; it never reads a requested filesystem path. Secrets and generated documentation blobs are excluded. Reference Markdown is available as source text. Browser Back returns to the referring article. Unknown article or source paths return Not Found.
Changing the integration
Keep wiki HTML trusted and reviewed; it is rendered as HTML rather than treated as user input. Update the compiler and its tests together when changing markup conventions or link resolution. Browser checks cover navigation without a document reload, source visibility, unknown paths, mobile layout and the landing/staff links. Generated JSON is ignored and must be rebuilt, while wiki HTML is included in commits.
Read the code
-
scripts/generate-docs.ts -
src/features/docs/compile.ts -
src/features/docs/navigation.tsx -
src/features/docs/article-links.tsx -
src/features/docs/docs.css -
src/app/docs/layout.tsx -
src/app/docs/[[...slug]]/page.tsx -
src/app/docs/source/[...path]/page.tsx -
src/features/docs/compile.test.ts -
e2e/documentation.spec.ts