Repository navigation
🐛 FIX: emit unresolved cross-references as external links - #1246
Open
draarivpatel-ui wants to merge 1 commit into
Open
draarivpatel-ui wants to merge 1 commit into
draarivpatel-ui wants to merge 1 commit into
Conversation
A 'myst' reference that no domain, inventory or local anchor could resolve was emitted as a reference with a refid, which HTML writers render as a local fragment link (href="#target"). The documented fallback is an external link that keeps the authored destination, so [broken](missing.md) produced href="#missing.md" instead of href="missing.md". Use refuri for the fallback reference and add a regression test. Fixes executablebooks#1245
This branch has not been deployed
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 #1245
Problem
A
mystreference that no domain, inventory or local anchor can resolve is emitted as areferencenode carryingrefid:refidis a document-local id reference, so HTML writers render it as a fragment link into the current page. In a project with filesa.mdandb.md, writing[broken](b1.md)ina.mdproduces:href="#b1.md"is a fragment link that can never resolve, while the documentation and the comment above the line both say the destination is left as an external link.Fix
Use
refurifor the fallback reference, so the authored destination is kept as the link target:The
myst.xref_missingwarning is unchanged, so authors still learn at build time that the target does not exist.Tests
test_unresolved_target_degrades_to_external_linkcovering the exact reported scenario ([broken](missing.md)), asserting the warning fires and the reference isrefuribased, notrefid.test_parse[missing],test_references); both now show the documented external-link fallback.