Link registry reference
CLI
link-registry <command> [paths…] [options]. Exit codes: 0 clean, 1 registered literals found (or near misses with --strict), 2 configuration error such as a missing registry file.
| Command | What it does |
|---|---|
|
Fail when a |
|
Rewrite those literals to |
|
List unregistered URLs used |
|
Print the loaded registry. |
|
Write a |
| Option | Meaning |
|---|---|
|
Registry file: |
|
Folder to scan. Repeatable. Default |
|
Only attributes whose name starts with |
|
Change log written by |
|
Scan only staged |
|
Also scan listing, literal, and passthrough blocks (skipped by default because examples often show URLs on purpose). |
|
Near-miss warnings fail the check. |
|
Command named in error messages. Default |
|
Machine-readable output. |
|
List the scanned files and the registry. |
What counts as the same link
A literal matches a registered link when host (ignoring www.), path (ignoring a trailing slash), and query are equal; the scheme does not matter. A literal with a #fragment on a registered page is also an error, and fix writes {name}#fragment. A near miss (same host and a path within two edits or 15%, or the same path on a host within two edits) is a warning.
What the scanner skips
-
Attribute entries (the registry itself) and the configured change log.
-
//comments, comment blocks, listing, literal, and passthrough blocks. -
Escaped URLs (
\https://...). -
The line after a
// link-registry: ignore-next-line(or// link-registry: ignore) comment line.
Configuration in package.json
Every option has a linkRegistry key; CLI flags override it.
"linkRegistry": {
"registry": ["docs/antora.yml"],
"roots": ["docs"],
"prefix": "url-",
"changes": "docs/link-registry-changes.adoc",
"includeBlocks": false,
"strict": false
}
GitHub Actions output
When GITHUB_ACTIONS=true, each hit is printed as an annotationunchecked (::error file=…,line=…,col=…), and near misses as ::warning, so they appear on the changed line in the pull request.
Composite action
uses: antora-supplemental/link-registry@v0. Needs a checkout and Node (present on GitHub-hosted runners). No install step.
| Input | Default | Meaning |
|---|---|---|
|
|
Extra CLI arguments for |
|
|
Folder that holds the docs. |
|
|
Command named in error messages. |
Reusable workflow
uses: antora-supplemental/link-registry/.github/workflows/check.yml@v0 as a job. Shallow, sparse checkout plus the action. Put build jobs behind it with needs:.
| Input | Default | Meaning |
|---|---|---|
|
|
Extra CLI arguments for |
|
|
Folder that holds the docs. |
|
|
Extra sparse-checkout patterns, one per line, for a registry file outside the defaults. |
|
|
Command named in error messages. |
Default sparse patterns: .adoc, antora.yml, antora-playbook.yml, /package.json.
Antora extension
Register it in the playbook, or turn it on through facto-stack’s linkRegistry pack key (facto-stackunchecked).
antora:
extensions:
- require: '@antora-supplemental/link-registry'
registry: ./docs/link-registry.adoc
warn_literals: true
index: true
| Option | Default | Meaning |
|---|---|---|
|
none |
|
|
|
As for the CLI. |
|
|
Log a warning for each literal use of a registered link. |
|
|
Write the outbound link index. |
|
|
Where the index is published. |
Registry attributes in antora.yml or the playbook need no registry option: AsciiDoc already applies them, and the extension reads them from the component versions. Attributes from a component’s antora.yml count only for that component’s pages; registry files and playbook attributes count for every page.
Outbound link index
{
"generator": "@antora-supplemental/link-registry",
"version": "0.1.0",
"registry": { "url-stripe-billing": "https://stripe.com/docs/billing" },
"unusedNames": ["url-old-page"],
"links": [
{
"url": "https://stripe.com/docs/billing",
"name": "url-stripe-billing",
"uses": 4,
"pages": ["fixture::billing.adoc", "fixture::index.adoc"]
}
]
}