MyST-Parser icon indicating copy to clipboard operation
MyST-Parser copied to clipboard

Cannot link to RST sections since 0.17.0

Open JulianGro opened this issue 6 months ago • 4 comments

What version of myst-parser are you using?

2.0.0

What version dependencies are you using?

Sphinx 6.2.1

What operating system are you using?

Linux

Describe the Bug

On myst-parser versions before 0.17.0, you can link to RST sections via something like:

[Load and Run a Script](get-started-with-scripting.html#load-and-run-a-script)

This was broken in 0.17.0 https://github.com/executablebooks/MyST-Parser/issues/519#issuecomment-1044450711 As far as I can tell, there is still no way to link to RST sections again. It looks like the following should work:

[Load and Run a Script](get-started-with-scripting.rst#load-and-run-a-script)

But that throws a warning and breaks the link:

WARNING: local id not found in doc 'script/get-started-with-scripting': 'load-and-run-a-script' [myst.xref_missing]

Expected Behavior

[Load and Run a Script](get-started-with-scripting.rst#load-and-run-a-script)

should just link to the "load-and-run-a-script" section.

To Reproduce

Here are two example files that should reproduce the issue in a minimal project: RST_MD_example.zip

JulianGro avatar Feb 17 '24 19:02 JulianGro

Thanks for opening your first issue here! Engagement like this is essential for open source projects! :hugs:
If you haven't done so already, check out EBP's Code of Conduct. Also, please try to follow the issue template as it helps other community members to contribute more effectively.
If your issue is a feature request, others may react to it, to raise its prominence (see Feature Voting).
Welcome to the EBP community! :tada:

welcome[bot] avatar Feb 17 '24 19:02 welcome[bot]

Can you provide a full minimal example? Your example includes a lot of unnecessary stuff and link generation works for me when I remove the references to non-existing files.

sumezulike avatar Mar 31 '24 11:03 sumezulike

It indeed seems like the following syntax works now:

+ [Load and Run a Script](get-started-with-scripting.rst#load-and-run-a-script)

However, it does still throw a warning:

myst-test/source/write-scripts.md:3: WARNING: local id not found in doc 'get-started-with-scripting': 'load-and-run-a-script' [myst.xref_missing]

Here is a full minimal example: myst-test.zip write-scripts.md tries to link to a section in the RST, which throws a warning. The README has instruction on how to build the documentation.

Not sure if I saw the warning and assumed that it wouldn't work, if a theme we use breaks it, or if it was broken in the past while still throwing the same warning.

JulianGro avatar Mar 31 '24 17:03 JulianGro

I could verify that (seemingly?) unnecessary warnings are being printed, I'll try to write a fix for that. The links all seem to work, though.

sumezulike avatar Apr 03 '24 20:04 sumezulike