Skip to content

fix(audit): match backtick code spans within one paragraph or heading - #116

Merged
drevendev merged 2 commits into
masterfrom
beautifulrepo/audit-code-spans-20261023
Oct 23, 2026
Merged

drevendev merged 2 commits into
masterfrom
beautifulrepo/audit-code-spans-20261023

Conversation

@drevendev

@drevendev drevendev commented Oct 23, 2026 •

Copy link
Copy Markdown
Owner

Reader problem and change

A README that mentions the backtick key twice, in two different paragraphs, could hide every audit finding between them. visible_source masked code spans across the whole document. The stray backticks formed one span, and a README with a TODO and an image without alt text audited clean. GitHub renders a lone backtick as plain text.

  • Code spans are masked block by block:
    • blank lines end a block;
    • ATX headings, setext underlines and thematic breaks stand alone.
  • A span may still wrap across lines inside one paragraph.
  • guides/repository-audit.md states the rule, and the changelog has an entry.

Closes #106

Evidence

New tests/test_audit_code_spans.py:

  • The issue's fixture now reports readme.placeholder on line 7 and image.missing_alt on line 9. The old code reported nothing.
  • # Press the keyfollowed byTODO: map the key reports the TODO. The old code paired the heading's backtick with the next line.
  • `TODO\nmarkers` inside one paragraph stays masked under both versions. This guards against over-correcting.

Verification

  • The five local checks passed on Windows 11 with Python 3.14.7: catalog OK; docs links 194; HTML navigation 205; 278 tests OK, 7 skipped; repo audit 0 findings.
  • Without the fix, two of the three new tests fail.
  • Accessibility and visual checks: not applicable.

Limitations

  • Block boundaries are approximated: blank lines, ATX headings, setext underlines and thematic breaks. List items and block quotes without a blank line in between can still share a span. This is not a CommonMark renderer.

🤖 Generated with Claude Code

visible_source masked code spans across the whole document, so two stray
backticks in different paragraphs, or one in a heading and one below it,
formed a single span and hid every finding between them: a README with a TODO
and an image without alt text audited clean. GitHub renders a lone backtick as
plain text.

Code spans are now masked block by block: blank lines end a block, and ATX
headings, setext underlines and thematic breaks stand alone. A span may still
wrap across lines inside one paragraph.

Closes #106

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@drevendev
drevendev force-pushed the beautifulrepo/audit-code-spans-20261023 branch from 8350c19 to d94ff8e Compare October 23, 2026 07:51

@andy-zen-dev andy-zen-dev left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed exact head d94ff8ed4ed681a5701ce38f33cc04e47a16cd8b against issue #106, the actual four-file diff, tools/repo_audit.py and existing audit tests. The new block-wise masking ends spans at blank lines and heading/thematic boundaries without disturbing source line numbering, while preserving multiline spans within a paragraph. The regression exercises both the reported TODO and missing-alt false negatives, plus the heading boundary and same-paragraph case. The changelog and documented parser limits match the implementation.

The five required jobs in Actions run 39920591483 passed (Python 3.11, 3.14, 3.14 Windows, Ubuntu/Windows action self-tests). I did not run an independent local suite. No merge-blocking issue found within this PR's bounded Markdown subset.

@drevendev
drevendev merged commit 5b68750 into master Oct 23, 2026
5 checks passed
@drevendev
drevendev deleted the beautifulrepo/audit-code-spans-20261023 branch October 23, 2026 08:25
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.

repo_audit: two stray backticks in separate paragraphs hide the findings between them

2 participants