Skip to content

feat: check reference-style links - #11

Merged
silversurfer562 merged 2 commits into
mainfrom
claude/reference-style-links
Aug 11, 2026
Merged

feat: check reference-style links#11
silversurfer562 merged 2 commits into
mainfrom
claude/reference-style-links

Conversation

@silversurfer562

Copy link
Copy Markdown
Member

Closes the known gap left open at 0.3.0: only inline [text](target) links were resolved, so every reference form was a silent pass — a dead target behind a label went unreported.

What now works

All three CommonMark forms resolve against the document's [label]: target definitions:

Form Example
full [the guide][guide]
collapsed [guide][]
shortcut [guide]

Labels match case-insensitively with whitespace collapsed. Definitions may carry a title or <angle-bracket> target, may be indented, and the first definition of a repeated label wins.

An explicit reference with no definition is an error. [text][label] without a matching definition renders as literal text — the link does not exist, which is a refuted claim rather than an unverifiable one. Findings quote the reference form ([text][label]) rather than inline syntax the reader would not find in their document.

Three false-positive classes closed while building it

Each found by probing real markdown shapes, not by the corpus:

  • Undefined shortcut references are ordinary prose. [3] and [TODO] only become links when a definition exists. Flagging them would fire on any bracketed text — including every [Unreleased] heading in a Keep a Changelog file. This is the whole reason shortcut support is safe to have.
  • GFM footnotes share reference syntax exactly. [^1] against [^1]: Sourced parsed as a link whose target was the footnote body, flagging Sourced as a missing file. The ^ namespace is now excluded.
  • Definition indentation is accepted beyond CommonMark's three-space cap. A definition nested under a list item is real and common, and missing one turns its reference into an error-severity false positive — the costlier direction. Fenced blocks are masked before definitions are read; indented code blocks aren't modelled anywhere in the extractor, so this stays consistent with the rest of it.

Definitions inside code fences correctly do not define — a renderer doesn't read them out of a code block, so a reference depending on one is properly reported as undefined.

Verification

Gate Result
Tests 153 passed (was 130)
Coverage 96%, _extract.py 100%
Corpus precision/recall passing, 6 new regression cases
Mutation score 81.3% against the 75% gate (890 mutants, up from 786)
Lint ruff + black clean
Dogfood verify over its own README/CHANGELOG — no new findings

Version left at 0.3.0 with the entry under [Unreleased]; this is additive, so the next release is a 0.4.0 minor.

🤖 Generated with Claude Code

Patrick added 2 commits August 11, 2026 15:34
Only inline [text](target) links were resolved, so every reference form
was a silent pass — a dead target behind a label went unreported. This
was the known gap left open at 0.3.0.

All three CommonMark forms now resolve against the document's
[label]: target definitions: full [text][label], collapsed [text][], and
shortcut [text]. Labels match case-insensitively with whitespace
collapsed; definitions may carry a title or <angle-bracket> target, may
be indented, and the first definition of a repeated label wins.

An explicit reference with no definition is an error: [text][label]
without a matching definition renders as literal text, so the link does
not exist — a refuted claim, not an unverifiable one. Findings quote the
reference form rather than inline syntax the reader would not find.

Three false-positive classes closed while building it, each found by
probing real markdown shapes rather than by the corpus:

- Undefined SHORTCUT references are ordinary prose. "[3]" and "[TODO]"
  only become links when a definition exists; flagging them would fire
  on any bracketed text, including every [Unreleased] changelog heading.
- GFM footnotes share reference syntax exactly. "[^1]" against
  "[^1]: Sourced" parsed as a link whose target was the footnote body,
  flagging "Sourced" as a missing file. The ^ namespace is excluded.
- Definition indentation is accepted beyond CommonMark's three-space
  cap. A definition nested under a list item is real and common, and
  missing one turns its reference into an error-severity false positive
  — the costlier direction. Fenced blocks are masked before definitions
  are read; indented code blocks are not modelled anywhere in the
  extractor, so this stays consistent with the rest of it.

Definitions inside code fences correctly do not define, since a renderer
does not read them out of a code block.

153 tests pass, coverage 96% (_extract.py 100%), mutation score 81.3%
against a 75% gate.
Promotes the reference-style link work to a release. Additive feature ->
minor bump. Two version sites (pyproject, __init__) plus the changelog
promotion; test_packaging pins the two versions equal.
@silversurfer562
silversurfer562 merged commit 4e89cb2 into main Aug 11, 2026
7 checks passed
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