Repository navigation
Description
An anchor can be present in the AsciiDoc source, resolve every link:# that points at it, and still be absent from the rendered HTML. Nothing in the build detects that.
How it surfaced
In #660, removing the Text DataType block also removed the blank line that separated it from the next anchor:
...as the link:#payloads_p_datatype_array[Array Types] section describes.
[[payloads_p_datatype_additional]]
* *Additional Types*With no blank line, Asciidoctor treats [[payloads_p_datatype_additional]] as part of the preceding paragraph rather than as an anchor. The rendered HTML then contains no element with that id. Confirmed by building it: develop has <div id="payloads_p_datatype_additional" ...> and the branch had nothing with that id.
It was caught in review by a reviewer who built the HTML and compared. No automated check saw it.
Why the existing checks miss it
The anchor validation used throughout the v4 work extracts every [[anchor]] from the source and every link:#target, then reports targets with no matching anchor. That check passes here, because the anchor is in the source — it simply does not render. The two failure modes are different:
- a
link:#with no anchor anywhere — caught today; - an anchor that exists in source but produces no element in the output — not caught.
./gradlew build does not catch it either. The Asciidoctor build emits no warning for this, since an anchor absorbed into a paragraph is valid AsciiDoc, just not an anchor.
Why it matters
These ids are the fragment identifiers of the published specification. Losing one silently breaks any external deep link to that section, and the only signal is someone following a stale link. The v4 work has moved and renamed anchors repeatedly — the payloads_c_* to payloads_p_* rename in #654 touched 122 of them — so the exposure is not hypothetical.
Suggested fix
Add a check over the rendered HTML rather than the source: extract every [[anchor]] from the chapters, build the HTML, and assert each one appears as an element id. It is a handful of lines and runs with the existing build.
A cheaper partial guard, which does not need the HTML, is to assert that every [[anchor]] line is preceded by a blank line or the start of file. A sweep of the chapters today finds exactly one violation, inside a //// comment block in Sparkplug_8_HA.adoc, which is inert and pre-existing — so the rule holds everywhere it matters and would have caught this.
The rendered-HTML check is the stronger one, since it catches whatever else makes an id vanish, not only this cause.
Activity