Revision: 1 Last modified: 2026-12-04T18:36:44Z
Well-formedness checker for the exported .html siblings produced by scripts/testing/export_docs_formats.sh.
File SIZE does not prove an export is usable (§11.4.6). A generated sibling can be 1.1 MB and still be malformed
markup — and a malformed export is not an export (§11.4.60), because the artefact would say something the source
Markdown does not. The exporter's own check is a presence check ("non-empty, ends with </html>"), never a
well-formedness check; this is the independent validator that closes that gap.
python3(standard library only).- The file(s) you pass must exist and be readable; unreadable input is a usage error (exit 2), never a pass.
python3 scripts/testing/validate_export_html.py docs/Issues.html
python3 scripts/testing/validate_export_html.py --quiet docs/*.html # totals only
python3 scripts/testing/validate_export_html.py --self-test # golden-good / golden-bad / negative control| code | meaning |
|---|---|
| 0 | every input is well-formed |
| 1 | at least one input is malformed (the offending construct is named) |
| 2 | usage error or unreadable input |
| 3 | the --self-test failed |
- An empty file is malformed, not "vacuously fine".
--self-testcarries a golden-good, a golden-bad and a negative control, because a checker that cannot be seen to fail is indistinguishable from one that always passes (§11.4.201(1)).- Bang-escaped or placeholder text that a Markdown source legitimately contains (e.g.
<pid>) must be treated as text — that is the sibling script's job, not this one's; seeescape_unknown_html_tags.py.
- Parses the argument list; validates that each input exists and is readable.
- Parses each document and reports unpaired tags, unclosed elements and stray special characters.
- Aggregates a per-file verdict and a total.
--self-testruns the fixture set and asserts both polarities plus the negative control.
scripts/testing/escape_unknown_html_tags.py— escapes non-HTML placeholder tags BEFORE this check can see them.scripts/testing/export_docs_formats.sh— the exporter whose output this validates.scripts/gates/cm_docs_composite_sync.sh— the gate that demands the siblings exist and be current.
2026-12-04 — python3 scripts/testing/validate_export_html.py --self-test → exit 0 on this repository.