Valkyrian Labs

Usage Synopses

Write a command-line synopsis once with ::usage or a usage fence; it wraps at group boundaries and links each option to its reference row.

Usage Synopses

::usage renders a command-line synopsis. It wraps between items with a hanging indent instead of relying on hand-aligned continuation lines, keeps optional groups together, and links every option to the row of the reference table that documents it.

One Line

1::usage[orbit remote add <name> <url> [--mode mirror|two-way|read-only] [--interval <duration>] [--yes]]
orbit remote add <name> <url> [--mode mirror|two-way|read-only] [--interval <duration>] [--yes]

The label is read as written: <name> is a placeholder, not HTML, and nested […] groups balance inside the label. A backslash makes a character literal (\[).

Several Lines: the Usage Fence

A fence with the language usage is the same block, for synopses that are easier to write over several lines. Newlines inside one synopsis are spaces; a blank line starts another synopsis:

1```usage2orbit push <remote>3  [--force]4  [--tags]5 6orbit pull [<remote>] [--rebase | --merge]7```
orbit push <remote> [--force] [--tags]orbit pull [<remote>] [--rebase | --merge]

Both forms render identically, so pick whichever reads better in the source.

How a Synopsis Is Read

Token Example Read as
Command path orbit remote add The leading bare words
Positional <name> A placeholder anywhere but after an option
Option --mode, -y --flag=value splits at the =
Option value <duration>, mirror|two-way The word, placeholder or a|b|c chain right after an option
Optional group [--yes] Nestable: [-n [--width <w>]]
Alternatives [--rebase | --merge] A standalone | between items
Repetition <file>... Attached or on its own

Other bare words after the command path are literal arguments; - and -- are arguments too. Whitespace runs collapse to one space.

A word right after an option is read as its value. When a flag takes no value and a positional follows it, put the flag in its own group: [--force] <remote>.

Each option links to the row that documents it in the nearest reference table. A row matches when its name, one of the comma- or space-separated tokens of its name (--yes, -y), or its aliases field equals the flag. When several tables document the flag, the one closest to the synopsis in the source wins; a synopsis inside an entry's body is inside that table, and a tie goes to the table that follows.

1::usage[orbit push <remote> [--force] [--tags]]2 3::docs-table[orbit push]{kind="options"}4| Option | Type | Summary |5| --- | --- | --- |6| `--force` | `flag` | Push even when the remote has commits this replica lacks. |7| `--tags, -t` | `flag` | Push tags as well as branches. |

The link's title is the row's summary. An option that no table documents stays plain text and reports nothing. Standalone :::entry blocks are not tables, so they are never link targets.

Synopses are written, never generated: a commands table does not produce one.

Output

1<div data-directive="usage" class="vl-md-usage">2  <code>3    <span class="vl-md-usage-command">orbit push</span>4    <span class="vl-md-usage-arg">&lt;remote&gt;</span>5    <span class="vl-md-usage-group">[<span class="vl-md-usage-option"><a class="vl-md-usage-link" href="#orbit-push-force" title="…">--force</a></span>]</span>6  </code>7</div>

There is one <code> per synopsis, and its text is exactly the synopsis, so the block reads correctly and copies cleanly without the stylesheet. Spans carry vl-md-usage-command, -arg, -option, -value, -group, -sep (a standalone |) and -repeat. The render result's text includes the synopses.

Diagnostics

Code When
usage-empty ::usage[], ::usage or a usage fence with no synopsis
usage-unbalanced A [, ] or < that does not balance; the synopsis renders as plain code

::usage takes no attributes. In the one-line form a [ that never closes ends the label early, so the line is reported as a malformed directive and stays text.