Write documentation
The documentation is plain Markdown under docs/, built into a website with
mdBook. The structure follows
Diátaxis. This page is the style guide.
Preview the site
Install mdBook once, then serve the book from the repository root:
cargo install mdbook --locked --version 0.5.4
mdbook serve --open
The site rebuilds when a file changes. mdbook build writes it to
target/book/.
Before you open a pull request, build the book and check the links. CI runs
the same two commands
(.github/workflows/docs.yml).
mdbook build
python3 docs/tools/check_links.py
Add a page
- Decide which kind of page it is (see the next section). If you cannot decide, the page is probably two pages.
- Create the Markdown file in the matching directory.
- Add it to
docs/SUMMARY.md. A file that is not listed there is not part of the site, and a listed file that does not exist fails the build. - Link to it from the pages a reader would come from, at least the section’s
index.md.
Choose the kind of page
Diátaxis sorts documentation by what the reader needs at that moment. Each kind has its own directory and its own rules.
| Kind | Directory | The reader is | The page |
|---|---|---|---|
| Tutorial | tutorials/, contributing/first-build.md | learning, with time set aside | leads them through one concrete exercise to a result that works |
| How-to guide | how-to/, most of contributing/ | at work, with a goal | lists the steps that reach that goal |
| Reference | reference/, contributing/repository-layout.md, contributing/code-style.md | at work, looking something up | describes the thing completely and neutrally |
| Explanation | explanation/, adr/ | studying, away from the keyboard | discusses why things are the way they are |
Tutorials
- One path, no choices. Pick the option for the reader and say so.
- Every step produces something the reader can see. Say what they should see.
- Explain only what is needed to take the next step, in a clause. Link to an explanation page for the rest.
- A tutorial must work every time. Run it from a clean state before you merge a change to it.
- Write “we” for what the reader and the page do together.
How-to guides
- The title names the goal: “Pair and unpair devices”, not “Pairing”.
- State what the reader needs before they begin, and stop when the goal is reached.
- Steps are numbered and imperative. Options and branches are allowed (“If
ufwis enabled, …”). - Do not teach. One clause of reason is fine. More belongs in an explanation page.
- Say things in plain words (“six-digit code”, “local network discovery”) and link to the glossary at most once for a technical term.
Reference
- Structure follows the thing described: one section per command, per interface, per file.
- State facts. No instructions beyond a short usage example, no opinions, no history.
- Be complete and consistent. A missing option is a bug.
- Reference pages are checked against the code. When code changes behaviour that a reference page describes, the same pull request changes the page.
Explanation
- The title could follow the word “About”: “About privilege tiers”.
- Give context, reasons, alternatives that were rejected, and trade-offs.
- No steps to follow. Link to the how-to guide.
- A decision that is expensive to reverse is recorded as an architecture decision record. Explanation pages summarise and connect the records.
Names
- The project is Tetheron. Write that in prose.
- Programs, packages, paths and identifiers keep
tetheruntil they are renamed together:tetherd,tether-cli,tether_<version>-1_amd64.deb,org.tether.Daemon,org.tether.android,~/.config/tether,TETHER_*,sudo ufw allow Tether. Write them exactly as they are. - Quote user interface text as the app shows it, including labels that still say Tether (Welcome to Tether).
- The launcher entry, window title, tray entry and Android app label are Tetheron from the next release. Where a step names one, write Tetheron and, at most once per page, add “(Tether in 0.4.1 and earlier)”.
- Describe Tetheron by what it does: it connects an Android phone to a Linux desktop. Comparisons with other products belong only in the feature table.
Language
- British spelling: licence (noun), set-up (noun), set up (verb), optimisation, colour.
- Present tense, active voice. Address the reader as “you”. Tutorials may use “we”.
- Use the same word for the same thing on every page. The
glossary is the list of record: “phone”,
“desktop” (the Linux computer), “daemon” (
tetherd), “app” (say which side), “enhanced tier”, “pair”. - Write user interface text exactly as it appears on screen and in bold:
Start service. Write keys as
Ctrl+C. - Say what is true of the release a reader can install. Mark anything that ships later with the release it is planned for.
- In the user guide, name releases (“0.4.1”). Milestone numbers, ADR numbers and source file names belong in the contributor guide. Explanation pages may link to an ADR as further reading.
Write like a person
- Short declarative sentences with a concrete subject. Vary their length.
- Say what a thing is. Do not set it against what it is not (“not X but Y”, “rather than”) for effect.
- No filler vocabulary: additionally, crucial, key, robust, seamless, leverage, enhance, comprehensive, ensure, “note that”, “in order to”, “serves as”, “it is worth noting”.
- No “simply”, “just”, “easy”, “powerful” or “obviously”, and no rhetorical questions.
- No lists of three for rhythm, and no trailing “-ing” clause that comments on the sentence (“, ensuring that…”).
- Use a full stop or a comma where an em dash or a semicolon would go. A colon before a list is fine.
- Bold is for user interface text and for term labels in tables and lists. It is not for emphasis.
- Headings are in sentence case and name their content. A section with one short paragraph is merged into its neighbour.
- One sentence to open a page. No closing summary, and at most three links under “see also”.
- State a caveat once, where it applies. Keep a limitation only if the reader would act differently because of it. What was tested on which device belongs in Supported platforms.
- At most two callouts on a page, and none for an ordinary remark. No table with one row.
- It is fine for a page to be short.
Markdown conventions
-
Wrap lines at about 80 columns.
-
One
#heading per page, as its first line. It is the page title. Sections start at##. -
Link to other pages with relative paths to the
.mdfile:[pair the devices](../how-to/pair-devices.md). mdBook turns them into links between pages and they also work on GitHub. -
Link to files outside
docs/(source code,CHANGELOG.md) with a fullhttps://github.com/tetheron/tetheron/blob/main/…URL. A relative link that leavesdocs/breaks on the website. -
Fence every code block and name its language:
sh,toml,text,kotlin,rust,protobuf. -
Commands a reader types go in
shblocks without a prompt character, so they can be copied. Show expected output in a separatetextblock. -
Write placeholders in angle brackets and say what replaces them:
tether-cli pair <device-id>. -
Callouts use GitHub’s alert syntax, which mdBook renders as a coloured box:
NOTEfor a side remark,TIPfor a shortcut,IMPORTANTfor a requirement,WARNINGfor something that loses data or weakens security.> [!WARNING] > A debug build must be uninstalled before a release build is installed, > which removes the pairing. -
Use a table for a matrix, a list for a sequence, prose for reasoning.
-
Diagrams are text diagrams in a
textblock, so that they can be edited without a tool and reviewed in a diff.
Screenshots
Screenshots live in docs/images/desktop/ (PNG) and docs/images/android/.
Desktop screenshots are taken from the app running against its fake daemon,
never against a real phone, so that no personal messages, contacts or photos
end up in the repository. docs/tools/screenshots.sh takes the whole set. It
builds the app with the mock feature and runs it on its own Xvfb display,
session bus and scratch directories, away from your desktop session and from
tetherd:
docs/tools/screenshots.sh
Run it again when the user interface changes. SHOTS_SCENES selects a subset
of the scenes (main fresh pair webcam call), SHOTS_OUT another output
directory and TETHER_BIN an already built tether. The tools it needs
(Xvfb, metacity, xdotool, ImageMagick and others) are listed at the top of
the script. Its clicks use fixed coordinates, so adjust the “Click targets”
block when a layout changes.
To look at a state by hand, run cargo run -p tether-gtk --features mock -- --mock in desktop/. The environment variables that put the fake daemon
into a particular state are listed in the
tether-gtk README.
- Never commit a screenshot that shows a real person’s name, number, message, photo, notification or device identifier. This includes your own.
- Give every image alternative text that says what it shows:
. - The steps must be followable without the screenshot.
- Android screenshots are placeholders for now
(
docs/images/android/*.svg). Replace one by adding a PNG taken on a phone with demonstration data and changing the link.
Keep documentation true
- A pull request that changes behaviour changes the pages that describe it. The pull request checklist asks for this.
- A feature that ships flips its row in the feature table and its entry in the roadmap.
- User-visible changes get a line in
CHANGELOG.md, which the Changelog page includes. - Do not copy a fact to a second page. Link to the page that owns it.