This site
Reading these docs
This site
site/about.md

Reading these docs

This site is a Mote app (docs/site/app.mote). Its pages are the Markdown files in docs/, and the READMEs of extensions/ (at #/extensions, #/extensions/usage, …), read by a build step and shown as they are: nothing is written twice. The sections at the side are the headings of docs/README.md that its tables of pages stand under, in that order. This page says how to get around it, and how a program can read the same docs without a browser.

Addresses#

Every page and every heading has an address of its own.

whataddressthe same, as Markdown
a page#/languagelanguage.md
a heading#/language/a-call-that-can-faillanguage.md#a-call-that-can-fail
a page in a folder#/kit/markdownkit/markdown.md
the map#/index.md

A heading's address is its words in lower case, with spaces as - and punctuation dropped. The # beside a heading is a link to it.

Search#

Press ⌘K (or /) anywhere. Search looks through every section of every page, and ranks them as you type: a section whose heading holds all the words comes first, then one that holds them all, then one that holds some; words in a heading count for more than words under it. The arrow keys move, Enter opens. It runs in the page, on the search battery; nothing is sent anywhere.

Examples that run#

A code block that is a whole program has a Run button. The program was compiled when the docs were built, so it starts at once, in a frame beside its source:

Examplea whole program
state n = 0
derive double = n * 2
row gap=12 padding=24 align-items=center
button "−" press={n -= 1} disabled=(n <= 0)
text `${n}` font-size=24 id="n"
button "+" press={n += 1} id="more"
if n > 0
text `doubled: ${double}` color=dim id="doubled"

Where the site is served with its back end (mote dev, or bun dist/server/main.js) and MOTE_DOCS_RUN=1 is set, Edit turns the source into an editor: change it, run it again, and what the compiler says is shown on the lines it points at. A site served as plain files has no compiler, so there the examples run as written.

The frame is sandboxed: a program in it cannot reach this page, and has no storage of its own, so what an example keeps with persist lasts until the frame is closed. An example that uses db, sql or fs could not work that way, so its frame is given the site's storage (the line over the frame says so). The arrow beside it opens the example in a tab of its own, where it is an ordinary page.

For agents#

The docs are meant to be read by programs as much as by people.

  • llms.txt is the index: one line for each page, with its address as Markdown and what it is about.
  • llms-full.txt is every page in reading order, in one file.
  • Every page is plain Markdown beside the site, at the address in the table above. Copy page as Markdown on a page puts the same text on the clipboard.
  • pages.json is the same as data: each page's path, title, section, headings and text.
  • A mote block whose first line is // docs: whole is a whole program and compiles as it stands. Any other block is a fragment.
  • The site itself says what can be pressed on it (agent.json, and the data-mote name on every control), as any Mote app does.

Keeping the docs true#

docs/site/build.sh --check reads every page and fails if a link or an anchor leads nowhere, if a whole-program example no longer compiles, if a page cannot be reached from the map, if two headings of a page make the same address, or if a code block does not name its language. Each finding is one line: the file, the line, and what is wrong.

Edit this page:docs/site/pages/about.md
esc
1072 sections of 111 pages, ranked as you type.A heading's words count for more than what stands under it.
↑↓move
↵open
ranked by BM25, in the page