Skip to content

CxxDox

mkdocs-cxxdox is an MkDocs plugin that generates C++ API documentation directly from source using libclang. It parses headers, extracts Doxygen-style comments, and renders a browsable reference — namespaces, classes, functions, variables, typedefs, enums, concepts, macros — into your MkDocs site.

Status: alpha. Pre-built wheels are distributed via GitHub Releases.

Installation

mkdocs-cxxdox ships as a platform-specific wheel that bundles the matching libclang binary — no system LLVM/Clang install is required.

pip install https://github.com/kfrlib/cxxdox/releases/download/v0.1.6/mkdocs_cxxdox-0.1.6-py3-none-win_amd64.whl

For the best experience, pair it with the Material theme:

pip install mkdocs_cxxdox-0.1.6-py3-none-win_amd64.whl "mkdocs-material>=9.1.15"

Requirements: Python ≥ 3.9, mkdocs ≥ 1.5.

Quick start

Add the plugin to your mkdocs.yml:

plugins:
  - search
  - cxxdox:
      title: My Library Reference
      input:
        - include:
            - include/mylib.hpp
          compile_options:
            - -std=c++20
            - -Iinclude

Then build the site:

mkdocs serve   # or: mkdocs build

The generated reference appears under the configured path_prefix (default cxxdox/).

Demo

This site is itself the demo. See the Demo Library Reference for the generated documentation of the demo C++ library (demo/library.hpp, demo/library.cpp).

Symbol reference syntax

CxxDox extends Markdown with [[...]] references that resolve to symbols in the generated reference. The general form is:

[[<symbol>[:<flag>[:<flag>...]]]]

Where <flag> is one of: type, file, brief. Wrap a symbol in backticks (` `) when its spelling contains characters that would otherwise be parsed as Markdown — e.g. parentheses, commas, or template parameters.

Examples

The [[...]] syntax below is a CxxDox extension and only renders as links in the generated MkDocs site — not on GitHub. The middle column shows the raw syntax to write in your Markdown, the right column shows what it resolves to in the built docs.

Description Syntax Result
Simple reference [[ns::Color]] ns::Color
Add the symbol's type [[ns::Color:type]] enum ns::Color
Type and source file [[ns::Color:type:file]] enum ns::Color (library.hpp:76)
Type, brief, and file [[ns::Color:type:file:brief]] enum ns::Color (library.hpp:76) Enumeration of colors.
Function reference [[ns::to_name(Color):type:file:brief]] function ns::to_name(Color) (library.hpp:93) Converts a Color enum to its string representation.
USR-based reference [[`c:@N@ns@Pair`:type:brief]] typedef ns::Pair Template alias for a pair of types
Reference by name [[Example]] ns::Example::Example()
Reference by signature (backticked) [[`fn1(std::byte, Color)`]] ns::fn1(std::byte, Color)
Reference by name only [[fn1]] ns::fn1(std::byte, Color)
Template class [[filter<T>]] ns::filter<T>
Template method [[filter<T>::apply]] ns::filter<T>::apply(T *, size_t)
Template method with signature [[`filter<T>::apply(T *, size_t)`]] ns::filter<T>::apply(T *, size_t)
Free function [[global_function]] global_function()
Specific overload (brief) [[`abs(double)`:brief]] ns::abs(double) Computes the absolute value of a floating-point number.
Specific overload (brief) [[`abs(int)`:brief]] ns::abs(int) Computes the absolute value of an integer.

License

Apache-2.0 WITH LLVM-exception. See LICENSE.TXT. The vendored cindex.py and bundled libclang binary are part of the LLVM Project, distributed under the same license.