Integration

Doxygen / C++ Docs

A C or C++ library's reference from Doxygen's XML.

A doxygen() tab draws a library's reference from Doxygen's XML: its classes, structs, functions, enums, typedefs, macros and their comments, beside your guides.

Before you start

  • Doxygen, set to write XML
  • The XML folder it writes, usually xml/ inside its output folder

Setup

1

Have Doxygen write XML

In your Doxyfile:

GENERATE_XML = YES
XML_OUTPUT   = xml

Then run it:

doxygen Doxyfile
2

Add a Doxygen tab

import { defineConfig, doxygen, markdown } from "sourcey";

export default defineConfig({
  name: "My C++ Library",
  navigation: {
    tabs: [
      {
        tab: "Documentation",
        slug: "",
        source: markdown({
          groups: [{ group: "Getting Started", pages: ["introduction"] }],
        }),
      },
      {
        tab: "C++ API",
        slug: "cpp",
        source: doxygen({ xml: "./doxygen-output/xml" }),
      },
    ],
  },
});
3

Build it

npx sourcey build

sourcey init adds the tab for you when it finds a Doxyfile.

Options

OptionDefaultMeaning
xmlThe Doxygen XML folder
language"cpp""cpp" for C and C++, or "java"
groupsfalsetrue makes each Doxygen group (@defgroup) a section with an overview of its own; otherwise each namespace is a section
index"auto"The reference's opening page: "rich", a card for each group with its description; "structured", its types listed by group or namespace; "flat", every type by kind; "none" or false, no opening page; "auto" chooses from what the XML holds
sourceUrlWhere "Defined in" links lead: a base URL, a template with {path}, {fullPath} and {line}, a function, or a map of path prefixes to either. See Sources

Each group, namespace and type gets a page. Functions, variables and macros at global scope that no group claims share a Globals page beside the overview.

Sourcey reads the XML with moxygen, which comes with it, and draws its pages with the same layout, search and exports as every other page.