Repository navigation
Read Backslash Escapes in a Definition's Label and Angle Destination - #3637
Conversation
_DESTINATION anchors on the label's opening bracket and honors escapes on both sides, so a label ending in an escaped backslash is found and an angle-bracket destination holding an escaped '>' is read whole rather than cut at it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
A label's escape may take the line break the parser lets a label wrap on, so such a definition matches as it did before. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
A recorded local strict-review pass covers head |
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars.
|
There was a problem hiding this comment.
🟢 Approval recommended
The supplied review status indicates that no active issues remain, supporting approval progression.
No open issues 🎉
What changed in this PR
This pull request improves raw Markdown definition parsing so escaped characters in labels and angle-bracket destinations are read correctly, preventing truncated destinations and missing definitions.
Changes:
- Updates
_DESTINATIONto honor escapes in labels and angle destinations, including labels wrapped after a backslash. - Adds regression tests for escaped backslashes, escaped angle brackets, and wrapped labels.
- Preserves the parser’s as-written destination behavior for downstream audits.
A review finding remains in spec/fidelity_text.py: balanced brackets inside valid definition labels are still rejected, which can cause link_definitions to crash.
| File | Summary |
|---|---|
tests/test_fidelity_text.py |
Adds regression coverage for escaped definition labels, escaped angle-bracket destinations, and wrapped labels. |
spec/fidelity_text.py |
Expands definition-destination extraction to honor escaped characters; balanced brackets inside labels still require handling. |
Review effort: Lite
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #3637 +/- ##
========================================
Coverage 81.69% 81.69%
========================================
Files 26 26
Lines 9111 9111
========================================
Hits 7443 7443
Misses 1668 1668
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
…nitions Through markdown-it-py (#3636) Promotes the #3426 markdown-it-py link reading from `develop` to `main`. - [#3635](#3635) Reads `spec/validate.py`'s link targets, sections, and headings, and the README audit's reference definitions, through `spec/fidelity_text.py` and markdown-it-py. A definition resolves first-wins with folded lookup, as GitHub renders it, and code is content rather than links. The validator now runs under `uv run --no-project --script`. - [#3637](#3637) Reads backslash escapes in a definition's label and angle destination, so an escaped `>` no longer cuts a destination short and a label ending in an escaped backslash no longer raises. It answers both findings Copilot raised on this promotion. Closes #3426 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Summary
Fixes the finding Copilot raised on promotion #3636 against #3635's
spec/fidelity_text.py_DESTINATION, and the second one its review body named. Both come from one root cause: the regex re-reading a definition's as-written destination did not honor backslash escapes.>was cut at it, so[b]: <https://example.test/a\>b>read ashttps://example.test/a\.[a\\]: one.mdraisedAttributeErrorinlink_definitions.The regex now anchors on the label's opening
[and honors escapes on both sides, including a label the parser lets wrap after a backslash.test_an_escape_in_a_label_or_an_angle_destination_is_read_throughpins all three shapes. The first two fail on the old regex, and the third on this branch's first commit.Verification
spec/validate.pyprints the same output as before Read validate.py's Markdown and the README Link Definitions Through markdown-it-py #3635.local-strict-reviewpasses ran. The first raised the wrapped-after-backslash label, fixed in 149f883. The second raised nothing.Dropped findings
spec/fidelity_text.py_DESTINATION,pre-existing:[ \t>]*swallows a leading>of a bare destination, an angle destination holding a backslash-newline falls back to\S+, and\S+stops at a non-breaking space the parser keeps. The old regex behaved the same on each, and none is a realistic README shape.🤖 Generated with Claude Code