Skip to content
Jupiter documentation
Menu

Writing documentation

How to write the one source folder that becomes the docs site, the Markdown files in the repository and a PDF.

Documentation is written once, in docs-src/, as Markdown with a small header on each file. The jupiter-docs command (package @belikh/jupiter-docs) turns that folder into three outputs. Never edit an output by hand: the next build overwrites it.

Folder layout#

A page belongs to the section named by its folder. The folders start, guides, reference, concepts and develop have a fixed title and order (see Sections). A page that is not in a folder names its section in its header, and docs.config.json lists such sections under sections. Pages in a section are sorted by order, then by title.

Every page starts with a YAML block. title and summary are required. section is required only on a page that is not in a folder, except index.md.

icon is a name from the icon tier of the graphics set. audience is one of users, developers, agents or maintainers. status is draft, stable or deprecated. The page title is the top heading, so the body starts at ## and never skips a level.

Directives#

Block directives start with colons. Use four colons for the outer block when you nest one inside another.

One-line directives start with two colons.

::graphic tier/name places a graphic from @belikh/jupiter-graphics. Text after the name is the alt text; leave it out for a decorative graphic. The site draws it inline in the theme colour, the repository Markdown uses a light and dark <picture>, and the PDF uses a coloured copy. ::diagram name Alt text places a drawing that your project made itself, see Add a diagram. ::glossary lists every term from the glossary in docs.config.json.

Link to another page with its id, and to a heading with its anchor. Plain relative links to .md files also work.

A page id names a page of the same project first. Start with a project id to link to another project: [[design/consuming]]. A Token is a named design constant.

Links to files outside the source folder, such as ../AGENTS.md, are checked against the repository and become repository links on the site. Raw HTML is not allowed.

Code#

Give every code block a language, and a title when the block is a file or a command with context. Use text for plain output.

Check and build#

check names the file and line of each problem:

  • a missing title or summary, or an unknown section, graphic, icon or glossary term
  • a diagram that is missing, has no alt text, or breaks the drawing rules
  • a broken page link or anchor
  • a heading that skips a level, an unclosed directive, a code block without a language
  • wording that fails the voice rules (see Voice)

Pages from other projects#

A project's pages stay in its repository. jupiter-docs import fetches every project named by sources and discover in docs.config.json at its latest release and writes the pages to docs-src/_imported/<project id>/. The folder is not committed and the pages are not written to docs/. Add a project has the steps and the keys.

The design system#

The site and the PDF take their colours, fonts, graphics and LaTeX classes from the latest belikh/design release. npm run update:design downloads it into vendor/design, which is not committed, and the workflows do the same before every build. When the design system changes, the next build looks different with no change in this repository.

What a good page has#

  • A title that names the task or the thing, and a one-sentence summary that says what the reader gets.
  • The command or the result in the first screen. Steps are a numbered list, one action each, with the command to copy.
  • Every option, flag and file in a table with its default. A reader should not need the source code.
  • One working example that can be pasted and run, with the output it prints.
  • The errors a reader will meet, quoted exactly, each with its cause and its fix.
  • Links to the next page a reader needs, in a :::see-also block.

Voice#

A reader who has never seen the project should find the answer on the first screen and understand every sentence on the first read.

  • Answer first. The first sentence says what the thing is or what the reader gets.
  • One idea per sentence, most under 25 words. Say "you", use the present tense, write steps as commands.
  • State facts a reader can check: numbers, names, defaults, paths, exact error text.
  • Use the short word: use, help, show, before, because, can.
  • The page does not describe itself, and it stops when the content ends.

jupiter-docs check tests the prose of every page. Code blocks, inline code and block quotes are left out, so quoted text stays as given.

Fix the sentence when a word is flagged: state the fact the word stood for. jupiter-docs voice README.rst runs the same check on any Markdown or .rst file. The full guide, with rewrites, is VOICE.md. The visual rules are in DESIGN.md of the jupiter-design-system skill; the site and the PDF already follow them.

Add a graphic#

Graphics come only from @belikh/jupiter-graphics. If the set lacks one, add it to packages/graphics in the design repository (belikh/design) first. Once that is released, the next docs build can use its tier/name. jupiter-docs check fails on a name that is not in the set.

Add a diagram#

A diagram is line art that your project draws itself, for a figure the graphics set does not have: a wiring plan, a timing chart, a state machine. Write it as an SVG file and place it with ::diagram name Alt text. The name is the path of the file below a diagram folder, without .svg. The folder is diagrams below the source folder, and diagrams in docs.config.json lists other folders:

::diagram wiring/board-to-monitor reads docs-src/diagrams/wiring/board-to-monitor.svg. The alt text is required, because a diagram is never decoration.

The diagram follows the design system's rules for line art, and jupiter-docs check tests them:

An element outside the list, a style attribute, an event handler or a link is never published. In a project that docs.jupiter.au imports, other rule breaks are warnings, but one of these leaves the project off the site until it is fixed.

Text is filled and has no outline, whatever the <svg> sets. A marker does not inherit the colour of the line that uses it, so set stroke on the marker's own path.

On the site the SVG is inlined, so it follows the light and dark theme. For the Markdown output jupiter-docs build writes docs/diagrams/<name>-light.svg and -dark.svg and draws them with a <picture>, so commit them with the pages. The PDF build converts the light file with rsvg-convert and fails when that tool is missing, so a PDF never loses a diagram. A project's diagram folders are imported with its pages, so its diagrams appear on docs.jupiter.au.

Edit this page on the source repository