Writing documentation
This site is built from Markdown files in the repository’s site/ directory with
Astro Starlight. The build writes plain static files and a search
index; there is no server behind the site and no search service.
Every page is public
Section titled “Every page is public”Everything under site/src/content/docs/ is published as it is, to anyone. The repository’s
docs/ directory holds internal design documents and is never published. Do not paste from it, or
from anywhere else, anything that records a decision, a person’s words, a ticket number, or the
infrastructure the trial runs on. Write what a reader needs to use the commons, in your own words.
Where a page goes
Section titled “Where a page goes”One Markdown file is one page. Its path under site/src/content/docs/ is its address on the site:
guides/verify-a-package.md is served at /guides/verify-a-package/. Put the page in the directory
of the group it belongs to; each directory is one group of the sidebar:
| Directory | Sidebar group | What goes there |
|---|---|---|
start/ |
Start here | The first steps, in order, from install to a first result |
guides/ |
Guides | How to do one task |
concepts/ |
Concepts | What a part of the commons is and why it works that way |
reference/ |
Reference | Exact details: commands, routes, codes, formats |
contributing/ |
Contributing | How to work on the commons and on this site |
A new file appears in its group’s sidebar on the next build. Nothing else needs to change: do not
edit astro.config.mjs to add a page. A subdirectory becomes a nested group of the same name. The
file index.mdx at the top is the site’s front page.
Use .md. Use .mdx only when a page needs one of Starlight’s components.
Frontmatter
Section titled “Frontmatter”Every page starts with frontmatter between two --- lines:
---title: Use a package, and verify itdescription: Find a package, install it and check its bytes against the commons' public log.sidebar: order: 10---title: the page’s heading and its name in the sidebar. Do not repeat it as a#heading in the body.description: one sentence saying what the page is for. It is the page’s description for search engines and link previews.sidebar.order: the page’s place in its group, lowest first. Pages with the same number are ordered by file name, and a page without one comes last. Number in tens (10, 20, 30), so that a page can be put between two others without renumbering them.
Headings in the body start at ##. Each ## and ### heading is listed in the page’s table of
contents.
Preview
Section titled “Preview”From the repository’s root:
pnpm installpnpm docs:devpnpm docs:dev serves the site at http://localhost:4321 and reloads a page when its file
changes. Search works only on a built site: run pnpm docs:build, then
pnpm --filter @commons/site preview.
Link to another page by its address, from the site’s root, with a trailing slash:
[verify a package](/guides/verify-a-package/). A link to a heading adds its anchor:
/contributing/writing-docs/#links.
The build checks every internal link. A link to a page or a heading that does not exist fails
pnpm docs:build, and the repository’s pnpm build with it, so a broken link cannot be merged.
Fix the link, or the heading it points to; do not turn the check off.
House style
Section titled “House style”- Plain, short sentences. Say what a thing does, then how to use it.
- No marketing. No “simply”, “easily”, “powerful” or “seamless”.
- Describe only what is built. If a page must mention work that is not built yet, label it planned, and say nothing of when.
- Check every command against the command-line tool before you write it down: run it, or read its
commons <command> --help. Copy commands and output; do not retype them from memory. - Write commands in a fenced code block with its language (
sh), one command per line, with a placeholder in angle brackets, such as<package>, for what the reader fills in. - Name things as the commons names them: account, namespace, agent, package, attestation, log.