Valkyrian Labs

Reference Tables

Document options, config keys, commands, fields, errors and terms with docs-table and entry, with stable anchors, typed values and three layouts.

Reference Tables

:::docs-table and :::entry turn reference material (command-line options, configuration keys, commands, API parameters, error codes, paths, support matrices, glossaries) into tables with a stable anchor per row, typed values, collapsible details and nested rows. The source stays ordinary Markdown: a wrapped pipe table still reads as a table on GitHub and in plain text.

Three Ways to Write Rows

A pipe table with the one-line form

Put ::docs-table on the line above an existing pipe table. Nothing closes it: it applies to the next table, with or without a blank line between them.

1::docs-table[orbit push]{kind="options"}2| Option | Type | Default | Summary |3| --- | --- | --- | --- |4| `--remote` | `string` | `origin` | Remote to push to. |5| `--format` | `table\|json\|yaml` | `table` | Output format of the summary. |6| `--dry-run` | `flag` | | Print what would be sent without sending it. |

The first column is the entry's name. The other headers map to fields through the kind (Meaning, Description and Summary are all the summary), case-insensitively; any other header becomes a field named after it.

Entry blocks

Write :::entry blocks inside :::docs-table when a row needs more than one line. The first paragraph is the summary; everything after it (lists, code, callouts) is the row's detail, shown under the row. Nested entries are child rows.

1:::docs-table[orbit commands]{kind="commands"}2 3:::entry[remote add]{args="<name> <url>"}4Add a remote and fetch its index.5 6:::entry[--mirror]{type="flag" since="2.1"}7Make this replica an exact copy of the remote.8 9Files that exist only here are deleted on the next sync.10:::11 12:::13 14:::

Both, joined by name

Keep the pipe table as the brief list and add an :::entry with the same name for the detail. Its attributes add fields and its body becomes the row's detail. Names compare as plain text, so `69` in a cell and [69] on an entry are the same row, and so are set <remote> in a cell and :::entry[set <remote>].

1:::docs-table[orbit exit codes]{kind="exit-codes"}2 3| Code | Meaning |4| --- | --- |5| `65` | A damaged or incomplete transfer. |6| `69` | The remote is read-only. |7 8:::entry[69]9Applies to `push` and `rm`. Pulling from a read-only remote still works.10:::11 12:::

An entry that matches no row is still added as a new row, with an entry-unmatched hint (info) so a typo in the name is visible. A field stated in both places with different values is entry-field-conflict, and the table cell wins.

Closing markers

A ::: or :::entry[…] written directly after the last table row, or directly after a list item, closes the table or opens the entry as you would expect. Strict CommonMark would read it as another row or as part of the list item; payload-markdown ends the table or list there instead.

Attributes

docs-table attributes
AttributeTypeDefaultSummary
textShown above the table; also the prefix of the row ids.
stringgenericPreset of columns, header aliases and field rendering (see below).
table or tree or listthe kind'sHow rows are laid out.
stringComma-separated field keys to show, in order; name always comes first.
stringthe kind'sSeparator that builds a hierarchy from names (. or /); missing parents are created.
all or none or NallIn the tree layout, rows deeper than N start collapsed.
closed or openclosedWhether detail rows start collapsed or expanded.
flag or textAdds a filter box; a value is its placeholder.
auto or neverautoauto stacks rows into blocks in a narrow container.
flagTighter rows.
flagAlternate row backgrounds.
stringdefaultdefault, panel, muted, glass or plain.
stringColour palette, as on other directives.
idWrapper id and row-id prefix.
stringSource bindings (see Source bindings).
entry attributes
AttributeTypeSummary
textThe entry's name. <…> is kept literally ([set <remote>]).
stringThe row's kind (data-kind); on a standalone entry, the kind whose fields it uses.
flagStarts this row's detail expanded (open="false" collapses it under details="open").
textThe summary when the body does not start with a paragraph.
idOverrides the row id.
stringExplicit source binding.
stringStandalone entries and list blocks.
textA field: type, default, required, since, deprecated, aliases, args, or your own (perm, env, …).

Unknown attributes on entry are fields, never warnings. An attribute one edit away from a reserved one (kidn, fcat) gets an entry-attribute-typo hint.

Layouts

  • table (the default of most kinds): one row per entry, details expand under their row.
  • tree: indented rows with a disclosure button per parent and guides for depth. expand="1" shows the first two levels.
  • list: one block per entry, with the name and badges on a line, typed fields as labelled lines and the body below. Used by problems and terms.

Every layout stacks when its container is narrower than 36rem: each row becomes a block with its values under their column labels, so nothing scrolls sideways. stack="never" keeps the table.

Kinds

A kind is data: default columns, header aliases, how each field renders and the default layout. generic keeps the columns exactly as authored.

Built-in kinds
KindDefault columnsLayoutNotes
name, type, default, summarytableCommand-line options and flags.
name, type, required, summarytablePositional and API parameters.
name, type, default, summarytreeConfiguration keys, nested by ..
name, summarytreeargs shows after the name; names starting with - are options.
name, summarytableReturn values.
name, summarytableError codes.
name, summarytableProcess exit codes.
name, default, summarytableEnvironment variables.
name, owner, mode, summarytreeFiles and directories, nested by /.
name, then the headerstableyes, no and partial become labelled marks.
name, cause, fixlistSymptoms with their cause and fix.
name, summarylistGlossary terms.
as authoredtableThe default.

Default columns apply to tables made only of entries; a pipe table's own headers always win.

Typed Fields

Field Renders as
type Chips, one per alternative split on |; a chip that names another row links to it
default, shipped, aliases, args Code
required A Yes/No mark in a column, a badge beside the name otherwise
since, deprecated Badges beside the name (a deprecated name is struck through)
anything else Markdown; a labelled line in the detail when it is not a column

A type cannot contain a literal |: in a cell, GFM consumes \|, so every | separates alternatives.

Every row gets an id from its caption and its path, never from its position: orbit push → --format is #orbit-push-format. Reordering rows never breaks a link. #id on the table changes the prefix, and #id on an entry replaces the row's id; both are slugged (lowercase letters, digits and -, starting with a letter) so an id can never clash with a page global. An override that had to change is reported as invalid-id.

Opening a URL with a row's fragment expands its ancestors, opens its detail (and the tab or <details> around it), scrolls to it and focuses it. The row name is a permalink, and a copy-link button appears beside it.

renderMarkdownDocument returns every row in entries (id, name, path, depth, kind, fields, summary, table), the contract tools such as pmdocs build on. See API Reference.

Collapsed Rows Need the Client Component

With expand below all, or with detail rows (collapsed by default), some rows are server-rendered hidden. Like tabs, toggling them needs the stylesheet and MarkdownRendererClient, which MarkdownRenderer mounts for you. Without scripting, and when printing, the stylesheet shows every row and drops the buttons, so the content is always readable.

If you render with renderMarkdown() or renderMarkdownDocument() and do not load the stylesheet or mount the client component, use details="open" and the default expand: the output is then fully static, with nothing hidden.

Standalone Entries

An :::entry outside a table is a reference block of its own: name, badges, typed fields and body. It covers the one-endpoint or one-function case.

1:::entry[GET /v1/replicas/{id}]{kind="endpoint" perm="replicas.read" since="2.0"}2Returns one replica with its remotes and quota.3 4Responds with `404` when the replica does not exist.5:::

Child entries need a table: an entry with nested entries outside :::docs-table is reported (entry-outside-table-with-children).

Kinds and Presets in Config

Sites add kinds, or change built-in ones field by field, with docs.kinds, and define short directive names with directives.presets:

1payloadMarkdown({2  docs: {3    kinds: {4      permissions: {5        columns: ['name', 'scope', 'summary'],6        description: 'Permissions and what they allow.',7        entry: 'permission',8        fields: { scope: { aliases: ['applies to'], label: 'Scope', render: 'code' } },9      },10    },11  },12  directives: {13    presets: {14      flags: { use: 'docs-table', attributes: { kind: 'options' } },15    },16  },17})

:::flags[…] then reads as :::docs-table[…]{kind="options"} in the renderer, the editor and the linter. Row kinds can follow names with entryKinds: [{ kind: 'option', prefix: '-' }]. See Plugin Configuration.

Theming

The wrapper carries data-directive="docs-table", data-kind, data-layout and the class vl-md-docs-table; rows carry data-entry, data-depth, data-kind and data-parent. Theme groups are docsTable and entry, configured like every other group (see Directive Themes). The stylesheet reads these optional tokens:

Token Purpose
--pmd-docs-rule Frame and row rules
--pmd-docs-head-bg Header row background
--pmd-docs-hover, --pmd-docs-stripe Row hover and stripe backgrounds
--pmd-docs-guide, --pmd-docs-indent Tree guides and indentation step
--pmd-docs-max-height Makes the table a scroll context; the header then sticks
--pmd-docs-scroll-margin Space kept above a row scrolled to from a link

The accent follows --pmd-accent, like links.

Source Bindings

from, keep, omit and complete on docs-table, a column headed fact, and fact on an entry are optional source bindings: they name the facts in your code (a CLI registry, a config struct) a row documents. The renderer only validates their syntax (invalid-binding), hides the fact column and passes the ids on in entries; the page content stays exactly what you wrote. The native pmdocs facts commands check bound rows against a fresh extraction from the source.

1::docs-table[orbit push]{kind="options" from="cli:push"}2| Option | Type | Default | Summary |3| --- | --- | --- | --- |4| `--parallel` | `integer` | `4` | Concurrent uploads. |

Write the table where it belongs in the page and bind only what the source knows: unbound rows and blank cells are fine. In a table with from, every row binds to from plus its key unless it has a fact of its own, so a row the source does not have is reported by pmdocs facts check. Mark a row you add on purpose with a fact of - (a fact cell, or fact="-" on an entry): it is never bound. Rows without a fact that share a key are duplicate-key; give one an explicit fact.

Diagnostics

docs-table-no-table, docs-table-multiple-tables, duplicate-entry, entry-field-conflict, unknown-kind, unknown-column, invalid-binding, entry-outside-table-with-children, docs-table-too-deep (more than 16 levels), duplicate-key and invalid-id are warnings; entry-unmatched and entry-attribute-typo are info hints. The editor linter reports the same codes on the same lines.