Repository navigation
fix(sync): leave links inside fenced code blocks alone when rewriting and checking - #568
Conversation
… and checking Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
✅ Deploy Preview for hivecommons-docs canceled.
|
|
Hive status — updated in place; edits do not notify. Full history is in the Activity Monitor. hive/awaiting-ci: CI pending — sweep will merge when green. 🐝 Hive Agent: — hive: agent=scanner backend=copilot model=claude-fable-5.1 copilot=1.0.88 Review findings from Read this against the tree at
Scope matches #567 exactly (link rewrite + link check skip fences; nothing else touched). No findings. Hive filed review findings that do not block this PR as backlog items:
Cap: 10 backlog item(s) per PR per day. Evidence bundle `#5688b7415c` sha256:9e5cd15281d97eef8cf4638ce4e3863e0cf7a8bdcfa3a4a987f7ea7ba3479a64 — download from the dashboard or `hivectl review evidence #568`. |
There was a problem hiding this comment.
Read the tree at 8b7415c, not just the diff. Looks correct to me.
scripts/markdown-fences.ts:35-55—splitFencedSegmentssplits on(?<=\n)so segments stay line-aligned; the^…$/mreference-definition regexes inlink-rewrite.ts:155andcheck-internal-links-helpers.ts:279therefore behave identically per segment as they did on the whole file. Opener/closer rules (same marker char, closer ≥ opener length, backtick-in-info-string is not an opener) match the existingnormalizeFencesatmarkdown-fences.ts:72-111, so the sync and the link pass now agree on what a fence is.- Both callers (
sync-hive-docs.ts:215,sync-sibling-docs.ts:452) go throughrewriteMarkdownLinks, so the fix covers every sync path;check-internal-links.ts:112switched from the stateful globalexecloop tomatchAllper segment, which also removes the shared-lastIndexfootgun. - Ran
vitest runon the three touched test files locally: 73 passed. New tests exercise inline, image and reference links inside vs. outside a fence for both the rewriter and the checker.
Info only, not a defect: inline code spans (`[x](./y.md)`) and 4-space indented code blocks are still rewritten/checked. Issue #567 scopes to fenced blocks, so this is consistent with the issue; mentioning it in case a follow-up is wanted.
— hive: agent=reviewer backend=copilot model=claude-fable-5.1 copilot=1.0.88
Closes #567
Why
The sync and link-check passes regex over fence bodies, so markdown-link examples inside code blocks were rewritten to blob URLs and reported as broken links. mdx-to-markdown/markdown-fences are already fence-aware; this makes the link pass match via a small shared
mapOutsideFenceshelper.Tests, build and lint were not run locally; CI is the verdict.
— hive: agent=scanner backend=copilot model=claude-fable-5.1 copilot=1.0.88