Documentation build pipeline¶
This project uses a MkDocs-based documentation site under documentation/.
This page explains where the docs come from, which commands to run, and what is generated automatically.
Overview¶
There are three main parts to the documentation system:
- A MkDocs project in
documentation/mkdocs/(theme, navigation, static assets, etc.). - A set of hand-written docs:
documentation/index.md(canonical top-level index)documentation/technical_reference_manual/(main manual)- A generation script,
documentation/mkdocs/gen_docs.py, which: - Copies the canonical index into the MkDocs project.
- Collects
README.mdfiles from the repository. - Drops them into
documentation/mkdocs/docs/generated/in a structured way.
Everything is orchestrated via just recipes defined in the Justfile at the repo root.
Quick commands¶
From the repo root:
- Full docs build in CI-style container
This calls .docker/scripts/run_docs.sh, which builds the documentation inside the CI Docker image. Use this if you want a clean, reproducible build that matches CI.
- Build docs using your local environment
This runs the MkDocs pipeline directly under documentation/ (no container). You need a working Python + MkDocs environment on your host.
- Clean everything and rebuild
Equivalent to:
- Serve the built docs locally
This runs a simple HTTP server in documentation/docs on port 8000.
Open http://localhost:8000/ in your browser (the MkDocs site is under the mkdocs/ subdirectory).
- Clean generated / build artifacts
- Spellcheck & lint docs (optional, requires Docker):
These use an aspell Docker image against the technical reference manual.
- Watch docs and rebuild on changes (requires
inotifywait):
What docs_build actually does¶
The main work happens in two layered recipes:
1. docs_build_mkdocs¶
In the Justfile:
Step by step:
-
cd "$DOCS_ROOT"DOCS_ROOTis defined as${WORKSPACE_ROOT}/documentation, i.e. thedocumentation/directory in the repo root. -
mkdir -p mkdocs/docsEnsure the MkDocsdocs/directory exists. -
rm -rf mkdocs/docs/generated mkdocs/site -
Remove the previous generated docs subtree.
-
Remove the previous MkDocs site output.
-
cp -r technical_reference_manual mkdocs/docs/technical_reference_manualCopy the hand-written technical reference manual into the MkDocsdocs/tree. Inside the MkDocs project, it appears underdocs/technical_reference_manual/. -
python3 mkdocs/gen_docs.pyRun the documentation generation script (details below). This: -
Copies
documentation/index.md→documentation/mkdocs/docs/index.md. -
Scans the entire repo for
README.mdfiles and copies them tomkdocs/docs/generated/.... -
cd mkdocs && mkdocs buildRun MkDocs, which: -
Reads
mkdocs.ymland the Markdown files inmkdocs/docs/. - Produces a static HTML site under
mkdocs/site/.
2. docs_build¶
After docs_build_mkdocs completes:
This:
- Removes any previous
documentation/docs/directory. - Creates a fresh
documentation/docs/. - Copies the built MkDocs site (
mkdocs/site/) todocumentation/docs/mkdocs. - Copies static images from
mkdocs/imgintodocumentation/docs/mkdocs.
The final, self-contained documentation tree is thus at:
This is what just docs_serve serves, and it can also be used directly for publishing (e.g. to gh-pages).
How gen_docs.py works¶
gen_docs.py lives in documentation/mkdocs/ and is responsible for gathering Markdown sources from the repo into the MkDocs project.
Key paths:
-
MKDOCS_DIR = Path(__file__).resolve().parent→documentation/mkdocs/ -
DOCS_DIR = MKDOCS_DIR / "docs"→documentation/mkdocs/docs/(MkDocs content root) -
GENERATED_DIR = DOCS_DIR / "generated"→documentation/mkdocs/docs/generated/ -
REPO_ROOT = MKDOCS_DIR.parent.parent→ repo root (two levels up fromdocumentation/mkdocs/) -
SOURCE_INDEX = MKDOCS_DIR.parent / "index.md"→documentation/index.md(canonical top-level index) -
DEST_INDEX = DOCS_DIR / "index.md"→documentation/mkdocs/docs/index.md(MkDocs landing page)
1. Ensuring docs/ exists¶
If documentation/mkdocs/docs/ does not exist, it is created. This makes the script robust even if called before any other build step.
2. Copying the canonical index¶
- If
documentation/index.mdexists, it is copied todocumentation/mkdocs/docs/index.md. - This means the canonical top-level documentation page lives in
documentation/, not insidemkdocs/. - MkDocs sees this as the root
index.mdof the doc site.
If documentation/index.md is missing, the script logs a warning and skips this step.
3. Cleaning the generated/ subtree¶
The generated/ directory is completely recreated on each run:
- Anything under
documentation/mkdocs/docs/generated/is considered generated content and will be removed. - Do not hand-edit files there; changes will be overwritten on the next build.
4. Collecting README.md files¶
The script scans the repo for README.md files, with some directories excluded:
The helper:
- Any path whose components (directory names) include one of the ignore names is skipped.
-
This prevents:
-
Git internals, IDE configs, Python caches, build and install artifacts, etc.
- The
documentation/tree itself (so we don’t recursively ingest docs into themselves). - The
.docker/and.venv/directories.
The main loop:
For each README.md:
- It computes its path relative to the repo root (e.g.
src/nodes/foo/README.md). - It copies the file to
documentation/mkdocs/docs/generated/src/nodes/foo/README.md, preserving the directory structure undergenerated/.
Result:
- Every
README.mdin the repo (outside ignored directories) appears undergenerated/in the MkDocs docs tree. - This makes it easy to surface local package docs in the website without duplicating content.
What you should (and shouldn’t) edit¶
-
Edit by hand:
-
documentation/index.md→ top-level landing page. documentation/technical_reference_manual/**/*.md→ main manual.-
Any other manually created
.mdfiles underdocumentation/mkdocs/docs/(exceptgenerated/). -
Do not edit by hand:
-
Anything under
documentation/mkdocs/docs/generated/→ regenerated fromREADME.mdfiles. -
Anything under
documentation/docs/→ derived build artifacts. -
To update package-level docs:
-
Edit the relevant
README.mdin the package directory. - Rebuild docs:
just docs_build(orjust docs).
Publishing and CI¶
just docsis the recommended entry point for CI-style docs builds. It runs.docker/scripts/run_docs.sh, which uses the CI Docker image for a controlled environment.just docs_publish_gh_pages(wrapped byjust docs_publish) callsdocumentation/publish_gh-pages.shto push the built site to thegh-pagesbranch.- Docs are also included in the broader CI flow via
just ci, which runs tests and documentation together.
Summary¶
- MkDocs drives the HTML site under
documentation/mkdocs/. - Hand-written docs live in
documentation/index.mdanddocumentation/technical_reference_manual/. - Generated docs are created by
gen_docs.pyfrom repositoryREADME.mdfiles and placed indocumentation/mkdocs/docs/generated/. - The main commands you will use are: