Skip to content

Write Documentation#

This page gives the rules of the documentation and the commands that build and check it.

Rules#

  1. The code is the authority. Each command, option, file path and number on a page must exist in the code or in a result file. Name the source file.
  2. A number has a source. Write a measured number only with the result file that it comes from.
  3. Language. Write in ASD-STE100 Simplified Technical English. Use short sentences: 20 words in a procedure step, 25 words in a description. Use the active voice, one instruction in each sentence and one term for one thing. Do not use idioms.
  4. Names. Say "the current model" and "the current release". Do not write internal release tags or internal model versions. Write the versions of external tools that a user must install.
  5. Headings. Use title case. Docs/Tools/titlecase.py --check lists the headings to change.
  6. Commands. Give each command a synopsis, its options and an example (Commands).

Build the Site#

python -m pip install -r Docs/requirements.txt
mkdocs build --strict
mkdocs serve                     # a local preview

The plugin gen-files runs Docs/Tools/gen_api.py on each build. It makes the generated pages: the C++ header reference (Reference/Headers), the ROS 2 messages, the menu settings and the option index. Do not edit a generated page. Change the comment in the source code.

Docs/Tools/hooks.py puts each diagram of Docs/Assets/Diagrams into its page as inline SVG. Thus a diagram uses the colors of the light and the dark theme.

Checks#

Command Check
python Docs/Tools/ste_check.py [FILE...] The language rules: sentence length, paragraph length, modal verbs, Latin abbreviations, idioms, first person, semicolons.
python Docs/Tools/titlecase.py --check The title case of headings, table headers and navigation titles.
python Docs/Tools/check_docs.py --coverage Each game option is on Reference/command-line.md. Each message and service of acres_interfaces is on Reference/ros2-topics.md or Reference/ros2-services.md. Each name of acres_core is on Reference/core-python.md.
python Docs/Tools/check_docs.py --sources Each source path in a code span exists. A path that is not written yet is in italics with "(to be written)" after it, for example Benchmark/acres_bench/t3/hybrid_astar.py (to be written). A planned path must not exist.
python Docs/Tools/check_docs.py --site DIR The links, the anchors, the diagrams and the assets of a built site.

Run all checks before a commit:

mkdocs build --strict --site-dir /tmp/acres-site
python Docs/Tools/check_docs.py --site /tmp/acres-site
python Docs/Tools/ste_check.py
python Docs/Tools/titlecase.py --check

Diagrams#

Each diagram is a hand-written SVG file in Docs/Assets/Diagrams. Refer to it with the image syntax. The text in quotation marks is the caption.

![The parts of ACRES](../Assets/Diagrams/acres-parts.svg "Your code calls the Python packages.")

Use only the classes of Docs/Assets/Diagrams/diagram-style.css. python Docs/Tools/check_docs.py --sync-diagrams copies the shared style block into each SVG file.

Deploy#

Docs/Tools/deploy_pages.sh builds, checks and deploys the site to Cloudflare Pages. It needs Node.js and a Wrangler login, or CLOUDFLARE_API_TOKEN. The variable ACRES_PAGES_PROJECT selects a different project (default acres-docs).