MyST-Parser
MyST-Parser copied to clipboard
Wrap reference with span.problematic, when the reference is broken
Describe the problem
MyST does not add the problematic class on references that were not resolved successfully.
Link to your repository or website
No response
Steps to reproduce
With MyST, the following does not result in any visible difference in the generated output:
[text](broken-reference)
This will output presents:
<span class="xref myst">text</span>
With a broken reference in reStructuredText:
`text`_
You get the output:
<a href="#id27"><span class="problematic" id="id28">`text`_</span></a>
Despite the broken reference, MyST does not add a span.problematic around the main content.
The version of Python you're using
No response
Your operating system
No response
Versions of your packages
No response
Additional context
No response
Note that a warning is printed:
/tmp/sphinx-demo/docs/markdown.md:3: WARNING: 'myst' reference target not found: broken-reference
This likely originates from:
https://github.com/executablebooks/MyST-Parser/blob/90c98aac61e5a4aa2228486eb697bf27cee08cc4/myst_parser/myst_refs.py#L76
This is the equivalent in sphinx: https://github.com/sphinx-doc/sphinx/blob/6402acde81e39cf010925c925733546dd6a2f822/sphinx/transforms/post_transforms/init.py#L105
Makes sense to add problematic, although not sure if I see one being added here 🤔
So I guess the "bug" is also in sphinx