Skip to content

Docs Conventions — what's generated, what's hand-owned, and what not to edit

What's generated vs. hand-owned

zensical reads mkdocs.yml natively (make docs); the C API pages are prebuilt separately with real mkdocs against a second nav file (make gen-c-api runs mkdocs build -f mkdocs-capi.yml). Most of docs/ is hand-written prose, but several pieces are generated and must never be hand-edited — check this table before editing anything that looks suspiciously uniform or mechanical:

Path Generated by Regenerate with
docs/c-api/** (except index.md) mkdoxy, from native/inc/ Doxygen comments make gen-c-api
docs/c-api/index.md (hand-written — restored via git checkout after gen-c-api wipes it) —
reference/doppler/<module>/ (the Python reference; no source file) mkdocs-api-autonav + mkdocstrings, from each package's __all__, at build time
the site navigation docs/.nav.yml and one .nav.yml per section directory (hand-written; each section ends in a glob, see Navigation)
docs/example-projects/<name>.md (every project but the index) scripts/gen_example_projects.py, from the project folder: its README body, a Get the code block, and a tab per tracked file make docs-relink
README.md — entire body below the badges scripts/gen_readme.py, from docs/index.md make docs-relink
tests/install/build-*-deps.sh (rendered into install docs) scripts/gen_install_scripts.py, from bootstrap.toml's [dev.*] lists make docs-relink
docs/api/index.md, docs/dev/index.md (hand-written landing pages)
docs/guide/wfmgen/options.md (field reference) scripts/gen_wfm_defaults.py, from modules/wfm_compose.toml and wfm/wfm_compose.h edit the field's header comment or manifest row, then gen_wfm_defaults.py --write
docs/schema/wfmgen.schema.json — the source/segment field properties scripts/gen_wfm_defaults.py (the rest of the file is hand-owned) as above; --check runs in make lint
docs/benchmarks.md make bench-docs make bench-docs
docs/specan/frames.json make record-demo make record-demo
docs/assets/*.png (gallery figures) make gallery make gallery
everything else under docs/ (hand-written) —

The general rule: if a path above says "generated by," never hand-edit it — a hand edit is either silently discarded on the next regen (c-api/) or just drifts further from reality until someone notices (benchmarks, specan frames). Edit the source the generator reads from instead (a Doxygen comment, a Python docstring, a benchmark run) and re-run the command in the table.

The CI-enforced completeness gates

The checks in CI's docs job keep the docs tree from rotting. All follow the same house idiom used by Doc Examples and check_surface.py — discovered, not registered — so a new page is covered the moment it exists, with no opt-in list to remember.

Check Script What it needs from you
Python surface scripts/check_surface.py Every package declares __all__; every public name renders in the reference
wfmgen flag docs scripts/check_wfmgen_flag_docs.py Every flag wfmgen accepts named in a guide page
README sync scripts/gen_readme.py Nothing — see below
Install-script sync scripts/gen_install_scripts.py Nothing — edit bootstrap.toml, run make docs-relink
Version strings scripts/check_version_strings.py Never hand-type the current release version in prose
Site internal links scripts/check_site_links.py Internal links/anchors resolve in the built site
Nav reach scripts/check_nav_reach.py Nothing: a page in a section with a glob is reached; a page deliberately out of the nav goes in mkdocs.yml not_in_nav
Strict build zensical build --strict Zero build warnings (bad refs, includes)
Init-param optionality scripts/check_init_param_optionality.py A published constructor signature is callable

(The three fence gates and the example gate live in the python job, "Python 3.x" in the checks list — see Doc Examples for the whole testing story.)

Init-param optionality (check_init_param_optionality.py)

A constructor argument must be optional on both faces or neither. jm can render a stub parameter as x: T = ... — omittable — while the generated PyArg_ParseTupleAndKeywords format string places it before the | and requires it. Nothing else catches that: the stub parses, the extension compiles, the tests pass because they pass every argument, and the only symptom is that following the published signature raises TypeError. A type checker blesses the failing call, because the stub is all it can see.

The check parses the committed .pyi and the committed _ext_*.c — no import and no construction, so classes whose constructors need live resources are covered like the rest. It matches on names via the kwlist, never on position: stub order and binding order can differ (jm reports that separately as kwargs-drift), and comparing positionally names the wrong parameter.

Accepted divergences live in scripts/.init-param-optionality-ignore as Class.param, with the reason. Both faces are jm-generated, so the entries there are upstream-blocked rather than deferred work — and the check reports an entry that has stopped diverging, so the list cannot outlive its reason.

Run it locally: python scripts/check_init_param_optionality.py.

wfmgen flag docs (check_wfmgen_flag_docs.py)

Every flag wfmgen's dispatcher accepts must be named in some docs/guide/wfmgen/*.md page. A review once counted 50 of 56 — the missing six were the whole channel-coding stage — and the count was put right by hand, which kept it right until the next flag landed.

Three decisions worth knowing before you meet it:

  • Aliases count. An alias exists to be typed, so an undocumented one is a secret. On its first run this found --randomize: the guide documented --randomise at length and never said the parser takes the other spelling. Document an alias beside the name it aliases, not on a page of its own.
  • There is no allow-list. A flag costs one table cell to document, which is cheaper than an exemption list that goes stale and has to be audited to find out whether its entries are still true.
  • Pages are discovered, not registered. A new page under docs/guide/wfmgen/ counts the moment it exists, so the gate cannot be satisfied by editing a list inside it. An empty guide directory fails — otherwise every flag is vacuously documented and it would print OK having read nothing.

Flag discovery is dispatcher_flags(), imported from scripts/gen_wfmgen_flag_matrix.py rather than re-derived, so this gate and the flag-matrix ctest cannot disagree about what the parser accepts.

It asks one direction only. A page citing a flag the parser no longer accepts is real doc rot and is not covered — see #1054.

Run it locally: python scripts/check_wfmgen_flag_docs.py.

The nav is discovered, not listed (#3000). mkdocs.yml has no nav:; zensical builds it from docs/.nav.yml (the top level) and one .nav.yml per section directory (awesome-nav). Every section's list ends in a glob:

nav:
  - Guides: index.md
  - glob: "*.md"
    ignore_no_matches: true

so a new page appears in its section's nav by existing, under its # heading. A section that needs a curated order (install/, examples/) lists its pages first; the glob then adds whatever it did not name, so a page it forgets still appears. The Python reference is its own entry (Python API: reference), generated by mkdocs-api-autonav.

What to do for a new page: give it a # heading and a one-line description: front matter (the page's meta description and search summary):

---
description: "One line on what the page is for."
---

# Title

There is no index bullet and no nav entry to add. A new top-level section is the one edit to docs/.nav.yml.

Linking to the reference

A guide, gallery or design page links an API entry with a cross-reference, not a path:

A pool runs N receivers off one search: see
[AsyncDsssPool][doppler.dsss.AsyncDsssPool].

The build resolves the identifier to the entry's anchor, so the link survives a page move, and the entry lists the page among its backlinks. Three rules:

  • Name the package path, the name a user imports: doppler.dsss.Acquirer, never doppler.dsss.orchestrator.Acquirer. The reference renders each package's __all__, so only the package path has an entry. A module's own entry is [doppler.resample][doppler.resample].
  • Leave the brackets alone. mdformat escapes a reference link with no definition in the page into literal \[text\], which renders as text with no warning. .mdformat.toml sets ignore_missing_references so make format does not, and check_site_links fails a cross-reference left as page text (code spans and blocks, where a page may show the syntax, are not read).
  • An unknown identifier fails the strict build, so a typo cannot ship.

From outside the docs, an entry's URL is reference/doppler/<module>/#doppler.<module>.<Name>.

README sync (gen_readme.py)

docs/index.md and README.md deliberately show the identical landing content, but the two pages render on different engines — mkdocs-material admonitions (!!! tip) on the docs site, GitHub's native alert syntax (> [!TIP]) on GitHub — so they can never be byte-identical. Keeping them in sync by hand rotted repeatedly (a live tagline edit, a missing git clone step, a stale quickstart link — and later a Performance/Licensing drift in exactly the sections a first, quickstart-only version of the generator didn't cover), so docs/index.md is the single source of truth: gen_readme.py extracts everything after its <!-- readme-sync:source-start --> marker (tagline, navigation, Why, Performance, Quick start, Build, Docs, Licensing — through end of file), rewrites admonitions into GitHub's alert syntax, rewrites relative doc links to their docs/-prefixed form (README.md lives at the repo root, one level shallower than docs/index.md), and writes the result into README.md between <!-- readme-sync:start --> … <!-- readme-sync:end --> markers. Only the wordmark + badge header above the markers stays hand-owned in each file (the two heads genuinely differ: image sizing, glightbox classes, absolute-vs-relative badge targets).

What NOT to do: never hand-edit the block between the readme-sync:start/:end markers in README.md. Edit docs/index.md below its readme-sync:source-start marker instead, then run make docs-relink (or python scripts/gen_readme.py --write) and commit the result.

Regenerating locally: make docs-relink, or python scripts/gen_readme.py --check to preview drift without writing anything.

Install-script sync (gen_install_scripts.py)

bootstrap.toml's [dev.*] package lists are the single source of truth for doppler's system dependencies — make install-deps, CI, and both Dockerfiles read them via just-bashit. The per-distro tests/install/build-*-deps.sh scripts that the install docs render via --8<-- includes are generated projections of those lists (minus patchelf and rust, which only the wheel-repair and Rust-test paths need — see the script's docstring). Never edit the scripts: change bootstrap.toml and run make docs-relink; CI fails on any drift.

Linking the repository from a page

A reader of the deployed docs installed a release, so a link into the repository points at that release, never at main:

https://github.com/doppler-dsp/doppler/blob/v<version>/path/to/file

Write it once with any released version; make docs-relink re-stamps it on every release (gen_doc_versions.py), anywhere in a page, with no marker around it. A git clone in a page takes --branch v<version> inside a doc-version region for the same reason.

A page that must keep naming an OLD state (a record of what a past release did) links a commit, not a tag: .../blob/<40-hex sha>/path is never re-stamped or held to the current tag. A frozen page under archive/ is left alone by the stamper altogether.

scripts/check_repo_links.py (make lint) holds it: no blob/main or tree/main link and no unpinned git clone outside the pages docs/.main-links-allowed lists (the contributing pages, which are about main), and every pinned link must name a file that exists in the tree and at the tag. The tag is fetched when it is not local; in CI a tag that cannot be fetched is a failure, and a version with no tag on the remote yet (the release PR) is checked against the working tree only, and says so. A link to a file added since the last release fails until that release ships.

Running an example from a page

A page tells a reader to run an example as python -m doppler.examples.<name>: the wheel ships every script under doppler/examples/, so the command works from a plain pip install doppler-dsp with no clone. python src/doppler/examples/<name>.py exists only in a clone and scripts/check_repo_links.py refuses it outside docs/dev/. A script that draws or designs with matplotlib or scipy needs the [examples] extra, so its Reproduce block starts with pip install "doppler-dsp[examples]" (test_docs_name_the_examples_extra.py holds it, discovered over the docs).

The install paths the docs walk

Every other gate here reads a page; this one does what it says, from a blank machine (doppler#2857). make docs-walk runs one bare container per stage with the commands the pages give, extracted from the pages (tests/install/docs-walk.sh plan prints them):

stage page what it runs
pip gallery, quick start pip install "doppler-dsp[examples]", a python -m doppler.examples.… demo, the broker-free Python blocks, the wfmgen lines
tarball C quick start jbx get-doppler, then the three compile faces
clone C examples, build from source the pinned git clone, the page's apt packages, make build, a C example
deb install C, consumer project consumer-walk.sh: the .deb install, then building and running the consumer project
docker Docker docker run … doppler --help, on the host

A command that stops being extractable is an error, never a stage that runs nothing. Published (release.yml, after the tag) runs the commands as the pages write them against PyPI, the GitHub Release and the pinned tag. Candidate (make docs-walk WALK_MODE=candidate; docs-walk.yml on a PR that touches pyproject.toml or the walk) is the dry run for a tree with no tag: the wheel, C tarball and .debs are built from a clone of HEAD in a container of the walk's own image, and each page command gets exactly ONE substitution (the package name becomes the wheel, git clone --branch vX <url> becomes a clone of the tree, jbx get-doppler becomes unpacking the tarball). The toolchain that builds the artifacts is confined to that build container; the walked containers stay bare, so a package a page forgets to install fails there. CONTAINER=podman works where the box has no docker.