docs: compile every reference example and inject it into the reference - #382
docs: compile every reference example and inject it into the reference#382mvandeberg wants to merge 1 commit into
Conversation
|
An automated preview of the documentation is available at https://382.capy.prtest3.cppalliance.org/index.html If more commits are pushed to the pull request, the docs will rebuild at the same URL. 2026-08-21 22:03:17 UTC |
|
GCOVR code coverage report https://382.capy.prtest3.cppalliance.org/gcovr/index.html Build time: 2026-08-21 22:19:48 UTC |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #382 +/- ##
===========================================
- Coverage 98.09% 97.99% -0.10%
===========================================
Files 130 130
Lines 6291 6297 +6
===========================================
Hits 6171 6171
- Misses 120 126 +6
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 38 files with indirect coverage changes Continue to review full report in Codecov by Harness.
🚀 New features to boost your workflow:
|
0c173fd to
5aee6f5
Compare
The `@code` examples in the public headers were never compiled by anything, so broken examples shipped to readers: of the 99 examples MrDocs publishes, 33 compiled. The rest referenced undeclared identifiers, elided code with `...`, or were fragments that could not build anywhere. Each example now lives as a tagged region in test/doc/reference/, in a file named after the symbol that documents it, and is compiled by boost_capy_doc_tests with the same warnings-as-errors posture as the page snippets. A Lua extension under doc/addons/extensions/ injects those regions into the MrDocs corpus at doc-build time, so the reference shows code the build has already checked. Compilation and rendering are independent: CI compiles the files whether or not the docs build, the docs build injects them whether or not they compile, and MrDocs stays a dependency of the docs workflow alone. A `@par !example <tag>` marker in the docstring records where each example belongs and which region it wants. The transform replaces the marker with that region rather than rendering it, so nothing is added to the page and each example keeps its place: under a descriptive title, under an `@par Example` heading, or inline in the prose introducing it. Naming the region lets overloads and duplicated records share one file. Beyond compilation, the when_all and when_any examples fix documented undefined behaviour: they ran concurrent read_some calls on a single stream, and now fan out across separate streams. MrDocs loads extensions only from `<install>/share/mrdocs/addons/extensions`, and its `addons-supplemental` config key is inert, so doc/build_antora.sh installs the extension into a MrDocs, exports MRDOCS_ROOT, and publishes it to GITHUB_ENV for later steps. Every caller therefore gets it: this repository's docs workflow, the C++ Alliance doc build, and a plain local run. The docs workflow checks the rendered HTML for an example that exists only in a snippet file, because a MrDocs without the extension renders the reference with no examples while still reporting success. Five `@code` blocks stay in their headers, on symbols MrDocs does not publish. Refs: cppalliance#380
5aee6f5 to
75afb3c
Compare
The
@codeexamples in the public headers were never compiled by anything, so broken examples shipped to readers: of the 99 examples MrDocs publishes, 33 compiled. The rest referenced undeclared identifiers, elided code with..., or were fragments that could not build anywhere.Each example now lives as a tagged region in test/doc/reference/, in a file named after the symbol that documents it, and is compiled by boost_capy_doc_tests with the same warnings-as-errors posture as the page snippets. A Lua extension under doc/addons/extensions/ injects those regions into the MrDocs corpus at doc-build time, so the reference shows code the build has already checked. Compilation and rendering are independent: CI compiles the files whether or not the docs build, the docs build injects them whether or not they compile, and MrDocs stays a dependency of the docs workflow alone.
A bare
@par Exampleheading marks where each example is injected, one region per heading; 27 were added to docstrings that had none.Beyond compilation, the when_all and when_any examples fix documented undefined behaviour: they ran concurrent read_some calls on a single stream, and now fan out across separate streams.
The docs workflow asserts the injected count and checks the rendered HTML for an example that exists only in a snippet file. A MrDocs without the extension installed ignores the script and renders the reference with no examples at all, while still reporting success.
Five
@codeblocks stay in their headers, on symbols MrDocs does not publish.Refs: #380