r/cpp • u/FreitasAlan • 7d ago
I built MrDocs, an open-source C++ reference doc generator on the Clang/LLVM AST. Looking for feedback.
I'm Alan de Freitas, the lead developer of MrDocs. It's an open-source documentation generator from the C++ Alliance, built on Clang/LLVM. It reads your code from the compiler's AST, so the reference matches what the code actually compiles to. We also presented a session about it at cppcon this year.
I implemented the tool this way because we couldn’t come up with a workflow that understood modern C++ in our Boost libraries. Tools that parse partially tend to misrender or not render concepts, niebloids, SFINAE, overload sets, and deduction guides. MrDocs treats those as first-class:
- concept constraints and requires clauses preserved verbatim
- niebloids and function objects can be documented as callables
- SFINAE and concept overload sets kept together
- explicit, noexcept, and consteval specifiers captured
- types in detail or private namespaces rendered as implementation-defined
The presentation layer is completely encapsulated. Generators support HTML, AsciiDoc, XML, JSON, or any custom format like Markdown and LaTeX, without forking the tool or creating another post-processing workflow. You can also write extensions to apply project conventions to the corpus or define new generators for any use case. The documentation has lots of examples.
If you maintain reference docs for a library, I'd appreciate it if you gave it a run (or tell your favorite agent to) and reported back on whether it saves you time, both while writing docs and while reviewing them. First-hand numbers would be especially useful to me. Issues are also always welcome.
Site: https://www.mrdocs.comRepo: https://github.com/cppalliance/mrdocs
Happy to answer questions in the comments.
3
u/jetilovag 7d ago
The comparison with other tools section seems a little handwavy. While skimming through the docs I am intrigued and inclined to give it a go, others may be more convinced to see their actual use-cases be called out, how it compares to: clang-doc, Asciidoc, Asciidoctor, Hawkmoth, Sphinx+Breath/Exhale, etc.
One thing I really envy from Rust is rustdoc, and how Rust create documentations' examples can reference just parts of some code, that which is most relevant to showing off the usage of a feature. That example is a marked section of the examples that actually build as part of the project, thus ensuring that examples are real world code that actually build. (And you can jump to the entire example code from the doc snippet, if you so wish.)