@cppalliance/antora-cpp-tagfiles-extension

中文文档
0.1.1发布于 2026/05/13BSL-1.0CommonJS近 30 天下载 2728

C++ Tagfiles Extension for Antora

原始使用文档
文档目录15 节
  1. Configuration
  2. npm
  3. Playbook
  4. Components
  5. {#_}
  6. Using the reference extension
  7. Features
  8. Unknown symbols
  9. Fundamental types
  10. Symbols from Tagfiles
  11. Components
  12. Namespaces
  13. Template parameters
  14. Nested symbols
  15. Replacing target names
cpp:std::vector[]

This will render as a link to the std::vector class in the tagfile.

https://en.cppreference.com/w/cpp/container/vector[std::vector,window="_blank"]

Which renders as https://en.cppreference.com/w/cpp/container/vector[std::vector,window="_blank"].

The extension supports fundamental types, custom tagfiles, using namespaces directives, template parameters, nested symbols, and replacing target names.

Configuration

npm

Install this extension

npm i -D @cppalliance/antora-cpp-tagfiles-extension

Playbook

Append the following in your antora-playbook.yaml:

antora:
  extensions:
    - require: '@cppalliance/antora-cpp-tagfiles-extension' # 
      cpp-tagfiles:
          files: # 
            - file: ./doc/tagfiles/boost-url-doxygen.tag.xml
              base_url: 'xref:reference:'
            - file: ./doc/tagfiles/boost-system-doxygen.tag.xml
              base_url: https://www.boost.org/doc/libs/master/libs/system/doc/html/
            - file: ./doc/tagfiles/boost-core-doxygen.tag.xml
              base_url: https://www.boost.org/doc/libs/master/libs/core/doc/html/
            - file: ./doc/tagfiles/boost-filesystem-doxygen.tag.xml
              base_url: https://www.boost.org/doc/libs/master/libs/filesystem/doc/
          using-namespaces: 
            - boost::urls
            - boost::urls::grammar
            - boost::system
            - boost::core
  • <1> npm package name: @cppalliance/antora-cpp-tagfiles-extension (required)

  • <2> List of tagfiles to be used by the extension

  • <3> List of namespaces to be used by the extension

Components

Components can also set their own tagfiles. Append following in your antora.yaml:

ext:
  cpp-tagfiles: # 
      files: # 
        - file: ./doc/tagfiles/boost-url-doxygen.tag.xml
          base_url: 'xref:reference:'
        - file: ./doc/tagfiles/boost-system-doxygen.tag.xml
          base_url: https://www.boost.org/doc/libs/master/libs/system/doc/html/
        - file: ./doc/tagfiles/boost-core-doxygen.tag.xml
          base_url: https://www.boost.org/doc/libs/master/libs/core/doc/html/
        - file: ./doc/tagfiles/boost-filesystem-doxygen.tag.xml
          base_url: https://www.boost.org/doc/libs/master/libs/filesystem/doc/
      using-namespaces: 
        - boost::urls
        - boost::urls::grammar
        - boost::system
        - boost::core
  • <1> The playbook needs to have the extension enabled

  • <2> List of tagfiles to be used by the component

  • <3> List of namespaces to be used by the component

These tagfiles only affect the component where they are defined.

{#_}

The extension include the cppreference tagfile by default. Any unknown symbol in custom tagfiles will be searched in the cppreference tagfile.

Using the reference extension

When @cppalliance/antora-cpp-reference-extension (https://github.com/cppalliance/antora-cpp-reference-extension) is present in the same playbook the reference tagfile is registered automatically, so cpp: macros can link to the pages generated during the same build. If you override the module name via module, that module's xref: prefix is carried along automatically and no extra configuration is necessary:

antora:
  extensions:
    - require: '@cppalliance/antora-cpp-reference-extension'
    - require: '@cppalliance/antora-cpp-tagfiles-extension'

You can still list extra tagfiles in the playbook or component descriptors if you need to point at other libraries, but the generated reference module is picked up automatically.

Features

Unknown symbols

If the extension can't find a symbol in the tagfile, it will render the symbol as plain text.

cpp:unknown[]

This will render as plain text:

`unknown`

Which renders as unknown.

Missing symbols

By default the extension renders missing symbols silently as simple monospace output. Set missing-symbol-log-level to any Antora log level (for example info, warn, or error) to emit a log entry while keeping the inline text the same.

antora:
  extensions:
    - require: '@cppalliance/antora-cpp-tagfiles-extension'
      cpp-tagfiles:
        missing-symbol-log-level: warn
        files:
          - file: ./doc/tagfiles/boost-url-doxygen.tag.xml
            base_url: 'xref:reference:'

Valid values are the standard Antora log levels: trace, debug, info, warn, error, and fatal. Use silent (or leave the option unset) to suppress logging entirely.

::: note Antora's runtime.log.level (default warn) filters log output independently of this option. For a level below warn (such as info or debug) to actually appear, Antora's log level must also be at or below it. For example, setting runtime.log.level: warn and missing-symbol-log-level: info will still suppress the missing symbol logs because the info level is below the runtime log level of warn. In this case, set runtime.log.level: info in the playbook or pass --log-level info on the command line. If you want missing-symbol notifications to show up with no extra Antora configuration, use warn because it's the default Antora log level. :::

Fundamental types

Fundamental types include links to cppreference:

cpp:int[]

This will render as a link to the int fundamental type in cppreference.

`https://en.cppreference.com/w/cpp/language/types#Standard_integer_types[int,window="_blank"]`

Which renders as https://en.cppreference.com/w/cpp/language/types#Standard_integer_types[int,window="_blank"].

Symbols from Tagfiles

Symbols from tagfiles are rendered as links:

cpp:std::string[]

This will render as a link to the std::string class in the cppreference tagfile.

`https://en.cppreference.com/w/cpp/string/basic_string[std::string,window="_blank"]`

Which renders as https://en.cppreference.com/w/cpp/string/basic_string[std::string,window="_blank"].

Template classes without parameters are also supported:

cpp:std::vector[]

This will render as a link to the std::vector class in the cppreference tagfile.

`https://en.cppreference.com/w/cpp/container/vector[std::vector,window="_blank"]`

Which renders as https://en.cppreference.com/w/cpp/container/vector[std::vector,window="_blank"].

Symbols from custom tagfiles are rendered without the window="_blank" attribute if the base_url relative.

cpp:is_charset[]

This will render as a link to the boost::urls::grammar::is_charset class in the boost-url-doxygen.tag.xml tagfile.

`xref:reference:boost/urls/grammar/is_charset.adoc[boost::urls::grammar::is_charset]`

Components

When components define their own tagfiles, these tagfiles only affect the component where they are defined and they have precedence over tagfiles defined in the playbook.

cpp:boost::urls::string_token::assign_to[]

This will render as a link to the boost::urls::string_token::assign_to class in the boost-url-doxygen.tag.xml tagfile.

`xref:reference:boost/urls/string_token/assign_to.adoc[boost::urls::string_token::assign_to]`

However, if the some other component uses cpp: for the same symbol without the appropriate tagfile, the symbol will be rendered as plain text.

`boost::urls::string_token::assign_to`

Namespaces

Default namespaces can also be defined in the playbook or in the component. When there's no match for the full symbol, the extension will try to find the symbol in the namespaces. Assuming boost::urls::grammar is defined in the playbook or the component:

cpp:boost::urls::grammar::is_charset[]
cpp:is_charset[]

This will render as a link to the boost::urls::grammar::is_charset class in the boost-url-doxygen.tag.xml tagfile. However, the link text will be whatever was provided to the extension.

`xref:reference:boost/urls/grammar/is_charset.adoc[boost::urls::grammar::is_charset]`
`xref:reference:boost/urls/grammar/is_charset.adoc[is_charset]`

As with tagfiles, the namespaces defined in a component only affect that component. The namespace std:: can also be defined:

cpp:std::string[]
cpp:string[]

This will render as a link to the std::string class in the cppreference tagfile.

`https://en.cppreference.com/w/cpp/string/basic_string[std::string,window="_blank"]`
`https://en.cppreference.com/w/cpp/string/basic_string[string,window="_blank"]`

Template parameters

Template parameters are supported. The extension will also include links from the tagfile for the template parameters.

cpp:std::vector<int>[]

This will render as a link to the std::vector<int> class in the cppreference tagfile.

`https://en.cppreference.com/w/cpp/container/vector[std::vector,window="_blank"]<https://en.cppreference.com/w/cpp/language/types#Standard_integer_types[int,window=_blank]>`

Which renders as https://en.cppreference.com/w/cpp/container/vector[std::vector,window="_blank"]<https://en.cppreference.com/w/cpp/language/types#Standard_integer_types[int,window=_blank]>.

Symbols from custom tagfiles can also be used with template parameters:

cpp:std::vector<url_view>[]

This will render as a link to the std::vector<url_view> class in the cppreference tagfile.

`https://en.cppreference.com/w/cpp/container/vector[std::vector,window=\"_blank\"]&#x3C;url_view&#x3E;`

Which renders as https://en.cppreference.com/w/cpp/container/vector[std::vector,window="blank"]<url_view>.

If the namespace boost::urls is being used in the context, it will also be used to resolve url_view:

cpp:std::vector<url_view>[]

This will render as a link to the std::vector<url_view> class in the cppreference tagfile.

`https://en.cppreference.com/w/cpp/container/vector[std::vector,window=\"_blank\"]&#x3C;xref:reference:boost/urls/url_view.adoc[url_view]&#x3E;`

Nested symbols

The extension supports nested symbols:

cpp:boost::urls::url_view_base::segments[]

This will render as a link to the boost::urls::url_view_base::segments class in the boost-url-doxygen.tag.xml tagfile.

`xref:reference:boost/urls/url_view_base/segments.adoc[boost::urls::url_view_base::segments]`

Which is the page for the boost::urls::url_view_base::segments symbol defined in the tagfile rather than only boost::urls::url_view_base.

Sometimes there's no page for the nested symbol in the tagfile, so the link will redirect to the page for the parent symbol.

cpp:std::vector::iterator[]

This will render as a link to the std::vector class in the cppreference tagfile:

`https://en.cppreference.com/w/cpp/container/vector[std::vector::iterator,window=\"_blank\"]`

Which renders as https://en.cppreference.com/w/cpp/container/vector[std::vector::iterator,window="blank"].

Note that there's no page for std::vector::iterator in cppreference, so the link will redirect to the page for the parent std::vector symbol.

Templates and nested symbols can also be combined:

cpp:std::vector<url_view_base::segments>::iterator[]

This will render as a link to the std::vector<url_view_base::segments>::iterator class in the cppreference tagfile.

`https://en.cppreference.com/w/cpp/container/vector[std::vector,window="_blank"]&#x3C;xref:reference:boost/urls/url_view_base/segments.adoc[url_view_base::segments]&#x3E;::https://en.cppreference.com/w/cpp/container/vector[std::vector::iterator,window="_blank"]
`

Replacing target names

The extension can replace the target names of the links.

cpp:std::vector[sequential container]

This will render as a link to the std::vector class in the cppreference tagfile with the text "sequential container".

`https://en.cppreference.com/w/cpp/container/vector[sequential container,window="_blank"]`

Which renders as https://en.cppreference.com/w/cpp/container/vector[sequential container,window="_blank"].

When providing custom text for a template class, the extension will only link the main symbol:

cpp:std::vector<int>[sequential container]

This will render as a link to the std::vector class in the cppreference tagfile with the text "sequential container".

`https://en.cppreference.com/w/cpp/container/vector[sequential container,window="_blank"]`

Which also renders as https://en.cppreference.com/w/cpp/container/vector[sequential container,window="_blank"].

cpp:url_view_base::segments[URL segments]

This will render as a link to the boost::urls::url_view_base::segments class in the boost-url-doxygen.tag.xml tagfile with the text "URL segments".

`xref:reference:boost/urls/url_view_base/segments.adoc[URL segments]`

版本与发布记录

@cppalliance/antora-cpp-tagfiles-extension 共发布 4 个版本,首次发布于 2024/09/26;过去 12 个月发布了 2 个版本。

版本发布日期距今
0.1.1latest2026/05/135 个月前
0.1.02025/11/1211 个月前
0.0.52025/10/021.1 年前
0.0.42024/09/262 年前

关于 @cppalliance/antora-cpp-tagfiles-extension 的常见问题

@cppalliance/antora-cpp-tagfiles-extension 是什么?

C++ Tagfiles Extension for Antora

如何安装 @cppalliance/antora-cpp-tagfiles-extension?

在项目目录运行 npm install @cppalliance/antora-cpp-tagfiles-extension,或使用 pnpm add / yarn add / bun add。

@cppalliance/antora-cpp-tagfiles-extension 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/cppalliance__antora-cpp-tagfiles-extension 是否存在。

@cppalliance/antora-cpp-tagfiles-extension 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@cppalliance/antora-cpp-tagfiles-extension 可以商用吗?

@cppalliance/antora-cpp-tagfiles-extension 使用 BSL-1.0 许可。声明的许可为 BSL-1.0,请阅读许可原文确认使用条件。以上为概括,不构成法律意见,请以许可原文为准。

@cppalliance/antora-cpp-tagfiles-extension 的下载量有多少?

根据 npm 官方下载统计,@cppalliance/antora-cpp-tagfiles-extension 在 2026/10/11 – 2026/11/09 这 30 天内被下载 2,728 次,日均约 91 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@cppalliance/antora-cpp-tagfiles-extension 还在维护吗?

最新版本 0.1.1 发布于 2026/05/13(5 个月前);至今共发布 4 个版本,其中过去 12 个月发布了 2 个;首次发布于 2024/09/26。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。