Plan: publish ./docs as a GitHub Pages site
Issue: #48. Implemented in #49.
A published site for this repo’s documentation at https://branes-ai.github.io/racing-drone/, set up like reflex’s and cortex’s (Astro Starlight, a Doxygen C++ API reference, deployed by GitHub Actions). One difference from them: here the site is always generated from docs/. Nothing is authored in docs-site/; the documents we write and review stay in docs/, where GitHub renders them too.
Design
Section titled “Design”docs-site/: Starlight, with the same Astro and Starlight versions as reflex and cortex, and the same base-path link rewriting for Pages.docs-site/scripts/sync-docs.mjsgeneratesdocs-site/src/content/docs/(gitignored) fromdocs/, before everydevandbuild:- every
docs/**/*.mdbecomes a page; a folder’sREADME.mdbecomes that folder’s index, anddocs/README.mdthe home page (since #52,docs/index.mdxis the home page anddocs/README.mdthe documentation map: landing-page plan); - the page title is the document’s first
#heading, which is removed from the body (Starlight renders the title); - each page’s “Edit page” link opens its source in
docs/; - a relative link to another document in
docs/becomes a link to its page, with the anchor kept; - a relative link to any other file in the repo (source, data, the top-level README) becomes a link to that file on GitHub, at
main; - a relative link whose target does not exist fails the build, naming the file and line. The site cannot publish a broken link that GitHub would also show broken.
- every
- The sidebar is generated too: one group per top-level folder of
docs/, in the order of the table indocs/README.md; within a group, the folder’s index first, then the pages in file-name order, labeled by title. - The API reference: Doxygen over
sdk/include,sim/includeandbaselines/glue/include, at<base>api/. - Deploy:
.github/workflows/deploy-docs.yml, copied from reflex’s without the WebAssembly steps. It runs on pushes to main that touchdocs/,docs-site/, the public headers, or the workflow. - CI: a
Docs sitejob inci.ymlbuilds the site on every PR, so a broken link fails the PR instead of the deploy after merge.
Acceptance
Section titled “Acceptance”npm run buildindocs-site/builds a page for everydocs/**/*.md, and the count matches.- Every relative link in the generated pages resolves: to a generated page, or to an existing file on GitHub.
- A deliberately broken relative link in
docs/failsnpm run buildwith the file and line. - CI’s
Docs sitejob passes on the PR. - After merge, the deploy workflow publishes the site (requires the one-time Pages setting below).
One-time setting
Section titled “One-time setting”Settings → Pages → Build and deployment → Source = “GitHub Actions”. A repo admin sets it once (or gh api -X POST repos/branes-ai/racing-drone/pages -f build_type=workflow).
Departures from reflex and cortex
Section titled “Departures from reflex and cortex”- Content is generated from
docs/, not authored indocs-site/src/content/docs/. - No KaTeX: no document in
docs/uses math yet, andremark-mathwould read a dollar amount in prose as math. Add it with the first document that needs it. - No WebAssembly widgets or traces.