fix(convert): stop check misreporting a self-referencing same-page anchor - #122
Merged
Conversation
…chor as a broken cross-file link A same-page anchor (#heading) in a file with no page_id yet resolved to a real heading fine, but rewriteHref's fully-qualifying step could only report it through the generic "link not resolved: TARGET" warning, naming the current file as if it were some other unresolved reference. Give the self-reference case its own "same-page anchor not resolved" message, gated on the anchor having actually matched a heading so a self-link with a bad fragment still falls through to the existing (redundant but accurate) warning pair rather than claiming a resolution that didn't happen. Fixes #118.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #118
Summary
#heading) in a file with nopage_idyet resolved fine to a real heading, but could only be reported through the genericlink not resolved: TARGETwarning -- naming the current file as if it were some other broken reference, when the anchor itself is fine and just needs this file's own first publish (check warns on a same-page anchor in an unpublished file #118).same-page anchor not resolved: #headingmessage, gated on the anchor having actually matched a heading (anchorResolved) so a self-link with a bad fragment falls through to the existinganchor not found+link not resolvedpair rather than falsely claiming a resolution that didn't happen.check's--helptext, which previously documented the confusing behavior as expected rather than fixing it.Test plan
internal/convert/testdata/regression/same-page-anchor-unpublished/covering both the resolved-anchor case and the bad-fragment self-reference casecmd/checktests:TestRunSamePageAnchorUnpublishedWarnsDistinctly,TestRunSelfReferenceWithBadFragmentDoesNotClaimAnchorResolvedmake checkpasses