How documentation works and how to update it
This page explains the documentation pipeline in this repository and gives practical steps for common edits.
If you are new to this repo, read this first before editing docs.
Why docs look unusual in this repo
The docs are assembled from multiple sources at build time:
docs/contains user-facing contentdocs_dev/contains developer-facing contentdocs_dev/utils/generate_logging_autodocs.pygenerates API reference pages from Python registriesdocs_dev/utils/mirror_docs.pymirrors everything into a virtual docs treedocs_anchor/is the build input directory used by MkDocs (docs_dir: docs_anchor)
This means the final site structure is not a direct 1:1 mirror of a single folder on disk.
Documentation structure at a glance
Source content folders
docs/- User docs (tutorial, explanation, how-to, reference)
-
Mirrored to
user/...in the virtual MkDocs filesystem -
docs_dev/ - Developer docs and docs tooling scripts
- Mirrored to
dev/...in the virtual MkDocs filesystem - Excludes
utils/,requirements.txt, andreadme_toplevel.mdfrom mirrored output
Generated content
APIref/(virtual at MkDocs build time)- Generated by
generate_logging_autodocs.py - Includes:
- logger API pages (
get_daq_logger,setup_root_logger,setup_daq_ers_logger) - handlers and filters index pages
- per-handler and per-filter pages from spec registries
- logger API pages (
Top-level landing page
docs_dev/readme_toplevel.md- Mirrored to virtual
README.md - Acts as the top-level landing page in MkDocs nav
Build flow: what happens when MkDocs runs
The mkdocs.yml plugin section drives this sequence:
gen-filesloadsdocs_dev/utils/generate_logging_autodocs.py- GeneratesAPIref/...docs into MkDocs virtual filesgen-filesloadsdocs_dev/utils/mirror_docs.py- Mirrors:docs/->user/docs_dev/->dev/docs_dev/readme_toplevel.md->README.md
- MkDocs builds from
docs_anchorwith the generated virtual files included
Important: docs_anchor/ is a build anchor, while the real authored content is mainly in docs/ and docs_dev/.
How to modify existing docs (simple edits)
Edit user docs
- Edit files under
docs/... - Example:
docs/how-to/route-messages.md
Edit developer docs
- Edit files under
docs_dev/... - Example:
docs_dev/how-to/add-a-handler.md
Edit top-level docs landing page
- Edit
docs_dev/readme_toplevel.md - This becomes
README.mdin the built docs
Edit API reference content
- Do not directly edit generated pages in
APIref/ - Instead edit source code/registries used by generator:
- logger APIs list in
generate_logging_autodocs.py - handler/filter specs in Python logging modules
After changes, rebuild docs and confirm nav + links.
How to add a new documentation page
1) Create the page in the right source folder
- User-facing page: create under
docs/... - Developer-facing page: create under
docs_dev/...
Follow existing naming style (kebab-case.md) and heading conventions.
2) Add links to discovery pages
Update the relevant tables so people can find the page:
docs_dev/readme_toplevel.md(site landing page)docs_dev/index.md(developer docs home)- Any local index/reference page where it belongs
3) Add it to MkDocs navigation
Update mkdocs.yml under nav: to place the page in the desired section/order.
4) Build and validate
From repo root (with environment sourced):
. /nfs/home/emmuhamm/nightly/NFD_DEV_260410_A9/env.sh
cd /nfs/home/emmuhamm/nightly/NFD_DEV_260410_A9/sourcecode/daqpytools
mkdocs build -f mkdocs.yml
Then run mkdocs serve if you want to inspect the live nav and page rendering.
How to add or change generated API reference pages
Use docs_dev/utils/generate_logging_autodocs.py.
Common tasks:
- Add/remove logger API pages: update
LOGGER_APIS - Change generated index wording/sections: edit
_render_logging_index() - Change per-type page structure: edit
_render_type_page()
If generation depends on runtime imports, keep docs-time stubs (like erskafka) working so MkDocs can import safely in CI/docs environments.
Common pitfalls
- Editing generated APIref files directly (they get regenerated)
- Forgetting to update
mkdocs.ymlnav after creating a new page - Editing
docs_anchor/manually (it is build-oriented, not primary authored docs) - Running
mkdocswithout sourcing the workarea environment first - Breaking links by moving pages without updating references in landing/index docs
Quick checklist for doc PRs
- Page added in correct source folder (
docs/ordocs_dev/) - Page linked from index/landing docs
mkdocs.ymlnav updated (if required)mkdocs build -f mkdocs.ymlsucceeds in sourced environment- Generated API docs changes come from generator/source, not manual edits in output