Extensions
An extension plugs your own templates, scripts, or C++ code into the Mr.Docs pipeline. Extensions are independent from the generators. An extension can define a new generator, but it can also rewrite the corpus before any generator sees it, run Mr.Docs as a stage of another build, or embed the extractor in a program of your own. This section covers each kind:
-
Handlebars extensions override the templates and helpers the
htmlandadocgenerators render with, one file at a time. -
Data-driven generators register a new output format from a directory of Handlebars templates and a manifest, with no code.
-
Corpus transforms are Lua or JavaScript scripts that rewrite metadata across many symbols between extraction and rendering, so every generator sees the change.
-
Script generators are Lua or JavaScript scripts that own the whole emit and write whatever files they want.
-
Antora extensions run Mr.Docs as a stage of an Antora build and let hand-written pages link to the generated reference.
-
Mr.Docs as a library links
mrdocs-coreinto a C++ program that drives extraction itself and consumes the corpus for its own purposes. A custom generator is only one of them. -
The Library Reference documents that C++ API.
The first four live in an addon directory and are picked up by the mrdocs binary. The last two are separate programs that embed or invoke Mr.Docs.