Sphinx extension that beautifully integrates Doxygen-generated documentation into Sphinx-based documentation systems
—
Quality
Pending
Does it follow best practices?
Impact
Pending
No eval scenarios have been run
The breathe-apidoc command provides batch generation of reStructuredText files from Doxygen XML output. It processes an entire Doxygen XML tree and creates individual .rst files with breathe directives for each documented element.
Generate reStructuredText files with breathe directives from Doxygen XML.
breathe-apidoc [options] <rootpath>rootpath: Required path to directory containing Doxygen's index.xml file.
Control output generation, file handling, and content inclusion.
# Required options
-o OUTPUT_DIR, --output-dir OUTPUT_DIR Directory to place all output
# File handling options
-f, --force Overwrite existing files
-n, --dry-run Run without creating files
-T, --no-toc Don't create table of contents
-s SUFFIX, --suffix SUFFIX File suffix (default: rst)
# Content options
-m, --members Include members for applicable types
-p PROJECT, --project PROJECT Project name for generated directives
-g TYPES, --generate TYPES Types to generate (comma-separated)
# Output options
-q, --quiet Suppress informational messages
--version Show version informationTypes that can be generated with the -g/--generate option:
TYPEDICT = {
"class": "Class",
"interface": "Interface",
"struct": "Struct",
"union": "Union",
"file": "File",
"namespace": "Namespace",
"group": "Group"
}Types supporting :members: option: class, group, interface, namespace, struct
Functions that power the breathe-apidoc command:
def main() -> None
"""Main entry point for breathe-apidoc command."""
def recurse_tree(args) -> None
"""Process entire Doxygen XML tree and create corresponding files."""
def create_package_file(package: str, package_type: str, package_id: str, args) -> None
"""Build and write individual package documentation files."""
def create_modules_toc_file(key: str, value: str, args) -> None
"""Create table of contents files for each type."""
def write_file(name: str, text: str, args) -> None
"""Write output file with specified name and content."""
def format_directive(package_type: str, package: str, args) -> str
"""Create breathe directive with appropriate options."""
def format_heading(level: int, text: str) -> str
"""Create reStructuredText heading of specified level."""Generate documentation for all supported types:
breathe-apidoc -o docs/api -f /path/to/doxygen/xmlGenerate only classes and namespaces:
breathe-apidoc -o docs/api -g class,namespace /path/to/doxygen/xmlGenerate with member documentation and project specification:
breathe-apidoc -o docs/api -m -p myproject /path/to/doxygen/xmlSee what would be generated without creating files:
breathe-apidoc -o docs/api -n -m /path/to/doxygen/xmlGenerate .txt files instead of .rst:
breathe-apidoc -o docs/api -s txt /path/to/doxygen/xmlGenerate silently without TOC files:
breathe-apidoc -o docs/api -q -T /path/to/doxygen/xmlThe command creates a structured directory layout:
output_dir/
├── class/
│ ├── MyClass_8cpp.rst # Individual class files
│ └── AnotherClass_8cpp.rst
├── namespace/
│ ├── MyNamespace.rst # Individual namespace files
│ └── AnotherNamespace.rst
├── file/
│ ├── header_8h.rst # Individual file documentation
│ └── source_8cpp.rst
├── classlist.rst # Table of contents for classes
├── namespacelist.rst # Table of contents for namespaces
└── filelist.rst # Table of contents for filesEach generated file contains:
ReStructuredText heading with element type and name.
Appropriate directive (doxygenclass, doxygennamespace, etc.) with:
:project: option if specified:members: option for applicable types if -m flag usedClass MyClass
=============
.. doxygenclass:: MyClass
:project: myproject
:members:Class list
==========
.. toctree::
:glob:
class/*The generated files integrate seamlessly with Sphinx documentation:
sphinx-build as normal.. toctree::
:maxdepth: 2
api/classlist
api/namespacelist
api/filelistThe command validates inputs and provides clear error messages:
Common error scenarios:
Install with Tessl CLI
npx tessl i tessl/pypi-breathe