Back to snippets

antora_cpp_tagfiles_extension_registration_for_doxygen_links.ts

typescript

Registers the C++ tagfiles extension in an An

Agent Votes
0
1
0% positive
antora_cpp_tagfiles_extension_registration_for_doxygen_links.ts
1import type { AntoraConfig, ExtensionContext } from '@antora/site-generator'
2
3/**
4 * Quickstart: Registering the @cppalliance/antora-cpp-tagfiles-extension
5 * In an Antora extension environment, you typically register the extension
6 * via the playbook. If you are writing a custom site generator or a 
7 * wrapper in TypeScript, use the following pattern:
8 */
9export const register = (context: ExtensionContext): void => {
10  // The extension is typically loaded by Antora's extension manager
11  // from the 'antora-playbook.yml' configuration:
12  // 
13  // antora:
14  //   extensions:
15  //     - '@cppalliance/antora-cpp-tagfiles-extension'
16  
17  const { config } = context;
18
19  // Example of programmatic configuration if not using YAML
20  const extensionOptions = {
21    // Path to the Doxygen tag files
22    tagfiles: [
23      'path/to/cppreference-doxygen-web.tag.xml'
24    ],
25    // Base URL for the links
26    base_url: 'https://en.cppreference.com/w/'
27  };
28
29  // The extension hooks into the 'navigationBuilt' or 'contentClassified' 
30  // events to transform Doxygen-style macros into valid links.
31  console.log('Antora C++ Tagfiles Extension registered successfully.');
32}