Skip to content

fix(tools): check raw HTML image and link references in validate_docs - #439

Open
HugoFernandezz wants to merge 1 commit into
flipperdevices:public-releasefrom
HugoFernandezz:fix/validate-raw-html-refs
Open

fix(tools): check raw HTML image and link references in validate_docs#439
HugoFernandezz wants to merge 1 commit into
flipperdevices:public-releasefrom
HugoFernandezz:fix/validate-raw-html-refs

Conversation

@HugoFernandezz

Copy link
Copy Markdown

What's wrong

tools/validate_docs.py only extracts references from Markdown links/images and Archbee's ::Image[] / :inlineImage[] directives. References written as raw HTML are invisible to it — and the pages built out of Archbee HTML tables use that form exclusively:

  • docs/general/Controls.md — 10 <img src="/files/icons/controls/*.svg">
  • docs/cpu-software/FlipCTL.md — 5 <img src="/files/pics/flipctl-*.png">
  • docs/resources/docs/Markup-reference.md — 1 <a href="Markup-reference.md">

If any of those targets were renamed or removed, CI would stay green and the page would ship with a broken image.

How to reproduce

Create a page with three broken references, one per syntax:

<p><img src="/files/icons/controls/DOES-NOT-EXIST.svg" alt=""></p>
<p><a href="/general/Does-Not-Exist.md">missing page</a></p>
![md image](/files/pics/DOES-NOT-EXIST.png)

python3 tools/validate_docs.py --docs-root <that dir> reports only the Markdown one:

ERROR   docs/Probe.md:7  [path] target '/files/pics/DOES-NOT-EXIST.png' does not resolve to an existing file
1 error(s) across 1 files scanned.

The fix

Extract <img src="..."> and <a href="..."> alongside the existing patterns, both quote styles. <img> goes through the same image resolution as the Archbee directives (file-relative, then the docs-root fallback); <a href> is treated as a normal link, so its #fragment is anchor-checked too. Fenced blocks are still skipped, so the placeholder markup documented in Markup-reference.md isn't flagged.

After the fix, the same input reports all three:

ERROR   docs/Probe.md:3  [path] target '/files/icons/controls/DOES-NOT-EXIST.svg' ...
ERROR   docs/Probe.md:5  [path] target '/general/Does-Not-Exist.md' ...
ERROR   docs/Probe.md:7  [path] target '/files/pics/DOES-NOT-EXIST.png' ...
3 error(s) across 1 files scanned.

Checks

  • 9 new tests. 8 of them fail on public-release without this change; all 48 pass with it.
  • python3 tools/validate_docs.py on the real corpus: 0 error(s) across 78 files scanned — the 16 newly covered references all resolve, no new false positives.
  • cd tools && mypy *.py: Success: no issues found in 4 source files.

The path check only looked at Markdown links/images and Archbee's
::Image[] / :inlineImage[] directives, so references written as raw
HTML were never checked. Pages built out of Archbee HTML tables use
that form exclusively: docs/general/Controls.md (10 icons) and
docs/cpu-software/FlipCTL.md (5 screenshots) hold 15 image references
between them, plus one <a href> on Markup-reference.md, none of which
CI would have caught if the target were renamed or removed.

Extract <img src=...> and <a href=...> alongside the existing
patterns, both quote styles. Fenced examples stay excluded as before,
so the documented placeholder markup in Markup-reference.md is not
flagged.

Signed-off-by: HugoFernandezz <104948166+HugoFernandezz@users.noreply.github.com>
@HugoFernandezz
HugoFernandezz force-pushed the fix/validate-raw-html-refs branch from 5cf62fc to d6ced32 Compare August 25, 2026 15:35
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.

1 participant