Skip to content

Writing documentation

ankka-surface's documentation is one tree of plain Markdown under docs/, and every way of reading it is a rendering of that tree: the site at https://surface.ankka.cloud/, llms.txt, llms-full.txt, a Markdown copy of each page, docs-index.json, and the agent skill in the marketplace plugin. The tool that renders and checks it is ankka's, taken as a dependency, and the rules are ankka's too; the page Writing documentation in ankka's documentation states every rule with its reason. This page says what is particular to this repository.

The build

uv run --project tools/docs docs check    # every rule; exits 1 on a problem
uv run --project tools/docs docs sync     # refresh the included samples and the skill
uv run --project tools/docs docs build    # check, build the site, write the machine renderings
uv run --project tools/docs docs serve    # the site with live reload, while writing

just docs, just docs-sync and just docs-serve are the same commands. The site lands in target/docs-site. The tool comes from ankka's repository at the tag named in tools/docs/pyproject.toml, and what it needs to know about this repository is extra.docs in mkdocs.yml: the frontmatter vocabulary and where the skill is rendered.

The site is published to GitHub Pages from main by .github/workflows/docs.yml, which also runs the build as a check on every pull request that touches the documentation or the code its samples come from.

Where a page goes

Kind Directory The reader wants to
tutorial get-started/ be walked from nothing to something working
concept concepts/ understand how something works and why
guide build/ get one task done
reference reference/ look one fact up
contributing contributing/ change ankka-surface itself

A new page is added to the nav in mkdocs.yml and, unless it is a contributing page, to the skill's pages: list, or the check fails.

Frontmatter

Every page starts with title, description and kind. One optional key is this repository's: halves, any of surface and device, for the half of the library a page is about. related lists the pages a reader most often needs next.

The words

A page uses the words of the glossary in the one sense it gives them: a move, never an update; a shape, never a screen; a request on the rail, never a history. The glossary page follows GLOSSARY.md at the root of the repository, which the living features under features/ are checked against, so a term changes there first.

Nothing on a page names a product. The shapes, anchor kinds and keys a page shows are the example vocabulary's, never a consumer's.

The example

Every page that needs an example uses one vocabulary: the shapes home, shelf and item, the anchor kinds theme and market, the modifier key time, the pending kind forecast, the focus keys card and outcome, and the owner ada. It is the vocabulary of the library's own suites, in Fixtures.scala, so a reply shown on a page is the service's own output for the request beside it.

Samples

A Scala sample is a region of a test source, marked with // docs:start <name> and // docs:end <name>, and included with <!-- include: <path>#<name> --> on the line before the block. A TypeScript sample is a region of device/test/example.test.ts, which runs each one against the package's fakes, so a sample that stops working fails npm test. docs sync refreshes the copies and docs check fails when one has drifted. A block written by hand says so in the sentence before it.

The skill

One skill, ankka-surface, is curated in tools/docs/skill/ankka-surface/SKILL.md and rendered into marketplace/plugins/ankka-surface/skills/, which is committed and checked. Its body holds the rules an agent must hold to build on a surface; the pages themselves are generated into it from docs/.