Pin the cross-document explicit-target reference from #1151 - #1198
Open
dchaudhari7177 wants to merge 1 commit into
Open
Pin the cross-document explicit-target reference from #1151#1198dchaudhari7177 wants to merge 1 commit into
dchaudhari7177 wants to merge 1 commit into
Conversation
…#1151 `[](a.md#custom-anchor)` emitted local id not found in doc 'a': 'custom-anchor' [myst.xref_missing] on 5.1.0, while rendering the correct working href -- and the pathless `[](#custom-anchor)` form of the same reference resolved silently. This is already fixed on master: executablebooks#1158 (explicit-id priority) landed after v5.1.0. Bisected by running the issue's reproduction against both: v5.1.0 WARNING: local id not found in doc 'a': 'custom-anchor' master (no warning) So this adds only the regression test. The existing `doc_with_target_id` case looks like it covers this, but it has the target and the link in one file and does not enable `myst_heading_anchors` -- and it is the combination of a second document plus heading-anchor resolution that produced the false positive. The target is placed directly above a heading for the same reason. Verified the test bites: on v5.1.0 it fails with exactly the warning from the issue. Closes executablebooks#1151
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.
Closes #1151 — already fixed on
master, so this is the regression test only.The bisect
I ran the issue's reproduction verbatim against both:
#1158 (stable heading anchors … explicit-id priority) landed after
v5.1.0, which is the release the reporter was on. So the fix is in, and the issue can be closed once this or something like it guards it.Why a new test rather than relying on
doc_with_target_iddoc_with_target_id("(ref)=\n# Title\n[](index.md#ref)") looks like it covers this, but it differs from the reported case in the two ways that mattered:index.md; the issue is about a link inb.mdto a target ina.md.myst_heading_anchors. The false positive came from heading-anchor resolution taking precedence over the explicit target, so a case without heading anchors cannot see it.The new test uses two documents with
myst_heading_anchors: 3, and puts the explicit target directly above a heading — the placement that made heading-anchor resolution take over. It asserts on both spellings together ([](a.md#custom-anchor)and[](#custom-anchor)), since the bug was precisely that the two disagreed.sphinx_doctree.srcdiris used to write the second file before the call, which is the only wrinkle — the fixture's__call__writes one file, but the source directory is available for the rest.Verified the test bites
Checked out
v5.1.0, copied this test in, and ran it:Exactly the warning from the issue. On
masterit passes.No source change, so no changelog entry.