Add the Antora xref text extension for spec repos - #261
Merged
Merged
Conversation
A cross-page reference written without link text, e.g.
<<chapter.adoc#some-id>> or xref:chapter.adoc#some-id[], resolves in
Antora but renders its raw target as the link text. A specification
single-sourced for both the PDF and the site writes its cross-chapter
links that way, because the PDF build generates the text itself
("Section 2.3"). The extension supplies that text on the site from the
target's reftext, or its section or table title.
The same extension already runs on the central dev site
(riscv-admin/antora-dev.riscv.org#47). It lives here as well so each
spec repo can register it for the Antora builds it runs itself: the
local preview, the pull-request preview, and its GitHub Pages site,
none of which use the central playbook.
Nothing consumes it automatically: it applies only where a repo's
antora-playbook.yml registers it, as the README describes. The `common`
Antora component published from this repo is unaffected, since Antora
publishes antora.yml and modules/ only.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Signed-off-by: Bill Traynor <wmat@riscv.org>
Kersten Richter (kersten1)
approved these changes
Sep 23, 2026
Kersten Richter (kersten1)
left a comment
Collaborator
There was a problem hiding this comment.
LGTM
This was referenced Sep 23, 2026
Merged
mocenigo (mocenigo)
pushed a commit
to riscv/riscv-high-assurance-cryptography
that referenced
this pull request
Sep 23, 2026
Antora renders a cross-chapter link written without link text, e.g.
<<Zkl-notation.adoc#KLEE-Notation>>, as its raw target. The PDF build
generates that text itself ("Section 1", "Table 5", "IRR4").
riscv/docs-resources#261 added the Antora extension that supplies the
text on the site, from the target's reftext or its section or table
title. Register it from the submodule, and bump docs-resources to the
commit that has it: Antora fails with "Cannot find module" if the
registration lands first.
This covers the Antora builds this repo runs itself: the local preview
and the pull-request preview, plus its GitHub Pages site once that is
set up. The central site registers its own copy.
The PDF is unchanged (text identical).
Signed-off-by: Bill Traynor <wmat@riscv.org>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds
antora-extensions/xref_text_extension.js, so specification repositories can use it in the Antora builds they run themselves.Why
A cross-page reference written without link text:
resolves to the right page in Antora, but the link text comes out as the raw target (
chapter.adoc#some-id). Specs single-sourced for both the PDF and the site write their cross-chapter links this way, because the PDF build generates the text itself ("Section 2.3", "Table 5", "IRR4"). The extension supplies that text on the site, using the target's reftext or its section or table title.The same extension already runs on the central dev site (riscv-admin/antora-dev.riscv.org#47). The central playbooks register their own copies, since a site build cannot load code from a content source. It lives here so that the builds a spec repo runs itself get the same treatment:
npm run preview),validate-content-source.yml,Effect on repos consuming this submodule
None, unless a repo opts in. The file is inert until a repo registers it in its own
antora-playbook.yml:commonAntora component is unchanged: Antora publishesantora.ymlandmodules/only, so a new top-level directory is invisible to the site build.global-config.adoc,themes/,fonts/andimages/by path, and no existing file is touched.Dependabot will propose the usual submodule bump in consuming repos; merging it changes nothing by itself.
One ordering rule, in the README: a repo should register the extension only once its submodule points at a commit containing it, otherwise Antora fails with
Cannot find module. Bump the submodule in the same PR as the registration. This is caught by a repo's own PR check, never on a published site.Testing
With this branch checked out as the
docs-resourcessubmodule ofriscv/riscv-high-assurance-cryptography(migrated to the current template), and registered in itsantora-playbook.yml:scripts/gen-pages-playbook.jscarries the registration into the generated GitHub Pages playbook unchanged;🤖 Generated with Claude Code