Inline Roles
Key caps, version badges, links to reference entries and source-bound values inside sentences and table cells, with :kbd, :since, :deprecated, :ref and :fact.
Inline Roles
Inline roles are the third directive form, :name[label]{attributes}, for things that live inside a sentence or a table cell: keys to press, the version a feature arrived in, a link to an option documented elsewhere on the page, a value that must match the code.
1Press :kbd[Ctrl+C] to stop the sync. `--keep` is available :since[1.24];2see :ref[orbit prune --mode] for the other settings.
Press Ctrl+C to stop the sync. The flag is available Since 1.24.
Syntax
:and a role name, then the label in[…], then optionally attributes in{…}directly after the].- Only the five role names below are recognised. Any other
:word[is ordinary text and is never reported. - The label may hold inline Markdown (code spans, emphasis, a placeholder such as
<vault>) and nested brackets that balance. - Attributes use the same grammar as block directives (
key="value", bare keys) and must close on the same line. - The text before the
:must not be a letter, digit,_or another:, soa:kbd[x],10:30[1]andC::ns[x]stay text.
The Roles
| Role | Example | Renders |
|---|---|---|
:kbd |
:kbd[Ctrl+Shift+P] |
Key caps: one <kbd> per key inside <kbd class="vl-md-kbd">, with + between them |
:since |
:since[1.24] |
A badge reading "Since 1.24" (data-since="1.24") |
:deprecated |
:deprecated[1.30], :deprecated[] |
A badge reading "Deprecated in 1.30", or "Deprecated" |
:ref |
:ref[orbit prune --mode] |
A link to that entry, with its summary as the title |
:fact |
:fact[`36972`]{id="config:device.port"} |
The label exactly as written, bound to a fact |
:kbd
Keys are separated by +; whitespace around a key is ignored. A + where a key is expected (at the start of the label or right after a separator) is the plus key itself:
1:kbd[Ctrl+C] Ctrl, C2:kbd[Ctrl + Alt] Ctrl, Alt3:kbd[Ctrl++] Ctrl, +4:kbd[+] +
An empty :kbd[] is reported (empty-inline-label) and stays as text.
:since and :deprecated
The label is the version, as plain text. :since[] is reported; :deprecated[] is allowed and reads "Deprecated".
Inside a reference entry (a docs-table row's cells, its detail, or an :::entry body) the role also fills that entry's since or deprecated field in the render result's entries, unless the entry already states the field. :deprecated[] gives "true", like a bare deprecated attribute.
1::docs-table[orbit prune]{kind="options"}2| Option | Summary |3| --- | --- |4| `--keep` | Versions to keep per file. :since[1.5] |
The row's entry then has fields.since and values.since set to 1.5, so an index or a search over entries can read it.
:ref
:ref links to a reference entry or a heading of the same page. The target is the label, or to="…" when the label should read differently:
1Set the mode with :ref[orbit prune --mode], or skip the prompt2with :ref[the confirmation flag]{to="--yes"}. See :ref[#retention].
A label that is plain text and names the target itself is shown as code (<code>orbit prune --mode</code>); a label with its own Markdown, or one used with to, renders as written. The link's title is the entry's summary as plain text.
:fact
:fact binds one value in a sentence or a cell to a fact from the code, so pmdocs facts check keeps it true:
1The device listens on port :fact[`36972`]{id="config:device.port"}.2 3| Setting | Default |4| --- | --- |5| Part size | :fact[64 MiB]{id="config:transfer.part_size" field="default"} |
idis required and is a full fact id (<source>:<id>);fieldis optional and defaults tovalue. Anything else isinvalid-binding.- The label is the value. It renders exactly as written: no element, no class, and no trace of the id in the HTML.
- Inside a
docs-tablecell the cell compares as the label, so:fact[`36972`]{…}and`36972`are the same value. - An empty label,
:fact[]{id="…"}, is a blank to be filled:blank-fact(info).pmdocs facts fillwrites the value.
The values are pinned in the Markdown. The renderer never reads facts and never fetches anything at render time; it only checks the binding syntax. pmdocs facts check extracts the facts from the current source in CI and reports a :fact whose label no longer matches.
Matching References
:ref resolves in this order:
- A target that starts with
#names an id: an entry id or a heading id of the page, exactly. - Any other target is compared with every entry of the page (synthetic tree parents excepted). Positionals (
<vault>) are removed and whitespace collapsed; comparison is case-sensitive. An entry matches when the target is its explicitfactid, its key, or the last words of the table caption followed by the entry's path, covering at least the entry's own name. With a table captionedorbit prune,--mode,prune --modeandorbit prune --modeall name the--moderow;modedoes not. - The entry whose caption and path the target covers most completely wins. When several match equally well the first on the page is used and
ambiguous-ref(info) is reported: write more of the path or the caption to choose. - Nothing on the page: the host is asked through
resolve.ref(target)(see the API reference), for links to other pages. - Still nothing:
unresolved-ref(warning), and the label renders as plain text.
A reference may come before the table it names. Inside a link, :ref renders its label without an anchor of its own.
Escapes and What Does Not Match
Write \: to keep a role as text: \:kbd[x] renders :kbd[x]. A role is never recognised in:
- code spans and code blocks (fenced or indented),
- raw HTML, autolinks and bare URLs, link destinations and titles, image alt text,
- directive marker lines (
:::name[…],::name[…]) and their labels, - a
:written as a character reference (:) or followed by\[.
A label whose brackets never close is malformed-inline-directive and stays as text, as does a label that closes inside other inline Markdown (:kbd[*x]*]) or a {…} block that does not close on its line. :ref[x](/url) is a Markdown link, not a role.
Plain Text
Wherever plain text is derived from Markdown, a role contributes its label: heading text and heading ids (## Copy with :kbd[Ctrl+C] gets the id copy-with-ctrl-c), the table of contents, entry names and comparable cell values, and the render result's text. The fields of an entry as authored keep the role as written.
Diagnostics
| Code | Severity | When |
|---|---|---|
malformed-inline-directive |
warning | The label or the {…} block does not close |
unknown-inline-attribute |
warning | An attribute the role does not declare |
empty-inline-label |
warning | :kbd[], :since[] or :ref[] |
invalid-binding |
warning | A :fact without a full id, or with an invalid field |
blank-fact |
info | :fact[]{id="…"}: a value still to be filled |
unresolved-ref |
warning | A :ref that matches nothing on the page or in the host |
ambiguous-ref |
info | A :ref that matches several entries equally well |
ref-resolve-failed |
warning | The host's resolve.ref threw or rejected; the label renders as plain text |
The editor linter reports the same codes, except ref-resolve-failed, which happens at render time only. It matches references against the page's entries too; pass externalRefs: true to lintMarkdownDirectives when the host resolves references to other pages. The skills' checker reports what one line shows (labels, attributes, :fact syntax).