udg documents a C++/C/Python library as one static site: the API reference is extracted from real ASTs (libclang for C and C++, static parsing for Python), merged with your existing Markdown or reStructuredText prose, and checked strictly enough to gate CI.
This page takes you from a checkout to a browsable site. The other guides go deeper:
- Configuration — every
udg.tomlknob. - Writing documentation — the comment conventions the extractor understands.
- Prose and guides — handbook pages, rst support, transclusion.
- Checks — the lints and coverage gates.
- Migrating from Sphinx + Doxygen — the incremental path for an existing project.
udg needs a libclang shared library at runtime; install it from your
package manager (libclang-dev on Debian/Ubuntu, clang on Arch,
llvm via Homebrew on macOS). Then download a prebuilt tarball from
the GitHub releases page,
or build from source with a Rust toolchain (1.96 or newer):
$ cargo install udgor from a checkout:
$ cargo build --releaseIf libclang lives somewhere unusual, point LIBCLANG_PATH at its
directory. Release binaries are built with the dlopen-libclang
feature and search for libclang at startup instead of linking it, so
any distro copy works; a checkout build links it at build time unless
you pass --features dlopen-libclang.
udg is driven by one TOML file, conventionally udg.toml at the
project root. The smallest useful config names the project and the
headers:
[project]
name = "MyLib"
root_namespace = "mylib" # stripped from display names and URLs
[cpp]
std = "c++20"
headers = ["include/mylib/*.h"]
include_dirs = ["include"]
[output]
dir = "build/docs"Every relative path resolves against the config file's directory (see
[project] root if the config lives in a
subdirectory). For CMake projects, replace the header bookkeeping with
compile_commands = "build/compile_commands.json" and udg inherits
the project's real include paths and defines.
$ udg build --open
udg: [cpp] parsing 42 headers (c++20, 0 modules)
udg: [cpp] doc coverage 310/512 (61%)
udg: rendered 214 pages (890 search entries) to build/docs
udg: opening build/docs/index.htmlWhat just happened, step by step:
- Extraction. udg composed one synthetic translation unit
including every configured header and parsed it with libclang.
Classes, functions, enums, macros, type aliases — everything public
— became items in a language-neutral intermediate representation,
with doc comments parsed into structured fields. clang errors
abort the build (a partial AST would produce lying numbers); fix
the include path or see
allow_parse_errors. - Linking. A symbol index over every item resolves type names in
signatures,
`Name`mentions in prose,@seereferences, and cross-language binding links. - Rendering. Static HTML: one page per class/enum, leaf pages for
functions and constants, per-module source views with line anchors,
a unified search index. The output works from
file://— no web server required.
The output directory is replaced atomically on rebuild, and only
directories udg itself created (marked with a .udg-site file) are
ever replaced — pointing [output] dir at a directory with other
content in it is refused, not overwritten.
- The landing page lists each language tree. Modules form the sidebar; every class page shows constructors, methods, members, inherited members from its base chain, and non-member operators that take it.
- Press
sto search. The index covers every item in every language. [src]links jump to the highlighted source view at the exact line.
$ udg checkruns the documentation lints and exits non-zero on any finding — see Checks. Start with nothing configured, look at what it reports, then add coverage floors and ratchets as the numbers improve.
udg build [-c udg.toml] [-o DIR] [--open] # extract + render
udg check [-c udg.toml] # lints + gates (CI)
udg check --undocumented # list undocumented items
udg check --undocumented-params # list undocumented params
udg check --update-ratchet # record current coverage
udg serve [-c udg.toml] [-p 8080] # build + serve locally
udg extract [-c udg.toml] [-o FILE] # dump the JSON IR