This extension generates reference documentation for C++ symbols in your codebase and creates an Antora module with its pages.
This extension populates the Antora pages with a reference module that contains the reference documentation for the C++ symbols in your codebase.
Before building the Antora playbook, make sure you have the following installed:
-
A C++ compiler (preferably Clang)
-
7z(Windows) ortar(Linux) -
git
Append the following in your playbook.yaml:
antora:
extensions:
- require: '@cppalliance/antora-cpp-reference-extension' # (1)
dependencies: # (2)
- name: 'boost'
repo: 'https://github.com/boostorg/boost.git'
tag: 'develop'
variable: 'BOOST_SRC_ROOT'
system-env: 'BOOST_SRC_ROOT' # (3)-
<1>
npmpackage name:@cppalliance/antora-cpp-reference-extension(required) -
<2> List of dependencies to be downloaded and extracted. The directory where these dependencies are extracted will be available to all components as an environment variable.
-
<3> The name of the environment variable describing where the path can be found. If this path exists and is a valid directory, it will be used as the source root for the dependency, skipping the download and extraction steps. If this is different from
variable, the extension will set the value ofvariableto the path where the dependency is already located.
Besides the dependencies configuration, you can also set the following options:
| Option | Description | Default |
|---|---|---|
|
A semver range that specifies the version of MrDocs to use. |
|
|
If |
|
|
If |
|
|
Antora module that will receive the generated pages ( |
|
|
When |
|
Components that will include reference documentation should set the path of the MrDocs configuration file.
Append following in your antora.yaml:
ext:
cpp-reference:
config: doc/mrdocs.yml # (1)
module: api-ref # (2)-
<1> The path to the MrDocs configuration file relative to the worktree.
-
<2> (Optional) Override the Antora module used for the generated pages. If omitted the component inherits the module set at the playbook level (or
referencewhen neither level specifies a value).
For more information about MrDocs, see https://www.mrdocs.com/docs
To include links to the reference module, the prefix xref:reference: should be used.
You would usually include a link to the main reference page in the component’s nav.adoc:
* xref:reference:index.adoc[Reference]When the tagfiles extension (https://github.com/cppalliance/antora-cpp-tagfiles-extension) is also listed in your playbook, the reference tagfile is registered automatically and picked up within the same Antora run—even if you change the module name.
antora:
extensions:
- require: '@cppalliance/antora-cpp-reference-extension'
- require: '@cppalliance/antora-cpp-tagfiles-extension'With this configuration, you don’t need to copy tagfiles into your repository or commit them to source control to satisfy cpp: macros.
Set autoBaseUrl: true to let the extension compute --base-url= dynamically instead of hard-coding it inside each mrdocs.yml. The feature is opt-in and only supports github.com remotes for now. Enable it globally or per collector:
antora:
extensions:
- require: '@cppalliance/antora-cpp-reference-extension'
autoBaseUrl: trueext:
cpp-reference:
config: doc/mrdocs.yml
autoBaseUrl: trueWhen active, the extension gathers hints in priority order:
-
GitHub Actions pull-request metadata (head repository, commit, and branch) via
GITHUB_*variables and the event payload referenced byGITHUB_EVENT_PATH. -
Standard GitHub Actions push metadata such as
GITHUB_REPOSITORY,GITHUB_SHA, andGITHUB_REF_NAME. -
Optional local overrides (
CPPREF_GITHUB_REPOSITORY,CPPREF_GITHUB_SHA,CPPREF_GITHUB_REF,CPPREF_GITHUB_SERVER_URL) so you can reproduce the CI environment on a workstation. -
The local git worktree (current commit/branch plus the
originremote URL).
Every candidate is validated with git ls-remote before we emit --base-url=…. If git or the network is unavailable, or if no verified GitHub reference is found, the extension leaves the original base-url untouched. Non-GitHub hosts automatically fall back to the existing behavior.