Skip to content

feat: link references to symbols documented elsewhere (input tagfiles) - #1267

Open
gennaroprota wants to merge 1 commit into
cppalliance:developfrom
gennaroprota:feat/read_tagfiles
Open

feat: link references to symbols documented elsewhere (input tagfiles)#1267
gennaroprota wants to merge 1 commit into
cppalliance:developfrom
gennaroprota:feat/read_tagfiles

Conversation

@gennaroprota

@gennaroprota gennaroprota commented Aug 28, 2026

Copy link
Copy Markdown
Collaborator

MrDocs can now read external tagfiles and, thus, have a doc comment that references a symbol not extracted by MrDocs itself. A new option, input-tagfiles, specifies the external tagfile and maps each one to the base URL its documentation set is published under. A reference that resolves to nothing in the corpus takes its URL from there instead of rendering as plain code. The name is resolved from the scope it is written in outward, as any other reference is, and is never shortened to reach an entry. Every generator takes the URL from one place.

Tagfiles are read with a small ad-hoc parser, rather than by LibXml2: the format is a small, machine-generated subset of XML, and linking LibXml2 into mrdocs-core would make it a dependency of every build and of every consumer of the installed package.

A path that cannot be read, or a file that is not a tagfile, fails the build.

The option MrDocs already had for writing a tagfile (named tagfile) becomes output-tagfile, so that the pair of options says which direction each of them goes; tagfile remains as a deprecated alias. Note that all deprecated options warn now, including report, which didn't before.

Changes

  • Source: the tagfile index and its reader; the input-tagfiles option and loading it into the corpus; Corpus::externalUrl beside Corpus::lookup; href on ReferenceInline and the branch that renders it; the tagfile -> output-tagfile rename with a deprecated alias; generic, deferred reporting of deprecated options.
  • Tests: unit suites for the index and for the reader (clang.mrdocs.TagfileIndex, clang.mrdocs.TagfileReader).
  • Golden tests: a config/input-tagfiles fixture (xml, adoc, html) covering a fully qualified name, a name relative to its enclosing scope, a namespace page, a member with an anchor, a member on its own page, and names that resolve to nothing; the config/tagfile fixture is renamed to config/output-tagfile and regenerated for its new file names.
  • Build: the new options land in ConfigOptions.json, so the generated
    config schema and the published option reference change; the new href field regenerates the reflected DOM schema (mrdocs.rng, generators/mrdocs.schema.json, dom-schema.adoc).
  • Tooling: the in-repo callers that passed --tagfile now pass pass --output-tagfile.
  • Breaking changes: tagfile still works but warns. The long-deprecated report option starts warning too. Under warn-as-error, either fails the build.

Testing

The unit suites test the index and the reader, including the inputs it must reject; the golden fixture tests resolution end to end in XML, AsciiDoc and HTML.

Beyond that, the reader was validated against the real Cppreference tagfile, and the possibility to repeat --input-tagfiles=<path>=<base-url>, needed by the Antora extension, was checked by hand.

Documentation

The "External docs" section of configuration/output.adoc documents the new option with an example. commands/inlines.adoc cross-references it from @ref, and the option reference is generated from ConfigOptions.json. No new page is added.

MrDocs can now read external tagfiles and, thus, have a doc comment that
references a symbol not extracted by MrDocs itself. A new option,
`input-tagfiles`, specifies the external tagfile and maps each one to
the base URL its documentation set is published under. A reference that
resolves to nothing in the corpus takes its URL from there instead of
rendering as plain code. The name is resolved from the scope it is
written in outward, as any other reference is, and is never shortened to
reach an entry. Every generator takes the URL from one place.

Tagfiles are read with a small ad-hoc parser, rather than by LibXml2:
the format is a small, machine-generated subset of XML, and linking
LibXml2 into mrdocs-core would make it a dependency of every build and
of every consumer of the installed package.

A path that cannot be read, or a file that is not a tagfile, fails the
build.

The option MrDocs already had for writing a tagfile (named `tagfile`)
becomes `output-tagfile`, so that the pair of options says which
direction each of them goes; `tagfile` remains as a deprecated alias.
Note that all deprecated options warn now, including `report`, which
didn't before.
@github-actions

Copy link
Copy Markdown

✨ Highlights

  • 🧪 Existing golden tests changed (behavior likely shifted)

🧾 Changes by Scope

Scope Lines Δ% Lines Δ Lines + Lines - Files Δ Files + Files ~ Files ↔ Files -
🛠️ Source 60% 1388 1378 10 13 4 9 - -
🥇 Golden Tests 19% 438 427 11 20 7 1 11 1
🧪 Unit Tests 17% 401 401 - 2 2 - - -
📄 Docs 2% 54 44 10 9 1 8 - -
📦 Other 1% 16 8 8 1 - 1 - -
🔧 Toolchain <1% 4 2 2 2 - 2 - -
Total 100% 2301 2260 41 47 14 21 11 1

Legend: Files + (added), Files ~ (modified), Files ↔ (renamed), Files - (removed)

🔝 Top Files

  • src/mrdocs/Support/TagfileReader.cpp (Source): 925 lines Δ (+925 / -0)
  • tests/unit/Support/TagfileReader.cpp (Unit Tests): 283 lines Δ (+283 / -0)
  • tests/golden/fixtures/config/input-tagfiles/input-tagfiles.xml (Golden Tests): 189 lines Δ (+189 / -0)

Generated by 🚫 dangerJS against e6b820b

@codecov

codecov Bot commented Aug 28, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.12%. Comparing base (e31308f) to head (e6b820b).

Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #1267   +/-   ##
========================================
  Coverage    83.12%   83.12%           
========================================
  Files           35       35           
  Lines         3662     3662           
  Branches       844      844           
========================================
  Hits          3044     3044           
  Misses         410      410           
  Partials       208      208           
Flag Coverage Δ
bootstrap 83.12% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@cppalliance-bot

Copy link
Copy Markdown

An automated preview of the documentation is available at https://1267.mrdocs.prtest2.cppalliance.org/index.html

If more commits are pushed to the pull request, the docs will rebuild at the same URL.

2026-08-28 17:48:24 UTC

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants