-
Notifications
You must be signed in to change notification settings - Fork 196
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Include directive: Allow separate includes for reference links and reference definition #517
Comments
Thanks for opening your first issue here! Engagement like this is essential for open source projects! 🤗 |
I have the exact same problem. Any idea, how to solve this? |
I think I don't have the exact issue, but this this part about reference links not being rendered:
In my case, I have an existing documentation that was ported from Jekyll and had a Trying to understand now whether it's related to this issue, or if I better to create a separate issue 👍 |
Ok, I did some digging. The problem is basically the order in which things are done:
This means that if the included file defines some references, they are not available, when the references in the original file are resolved. There would be a few ways to potentially solve this:
For me, having a collection of references in an included file is really something that makes my life easier... @chrisjsewell and maybe @choldgraf : is there any chance of this getting included? I would be happy and capable of contributing code and time. But I would need some feedback from you:
|
I might have found a "workaround" for the first problem . Using the MySt directive with syntax from rst works in my case: (note the extra colon before "start-after" and missing dashes)
myst-parser 0.18.0 |
This is a core limitation of commonmark I'm afraid; reference definitions have to be parsed before reference links:: commonmark/commonmark-spec#702 So it's non-trivial to change this behaviour for includes |
Describe the bug
foo.md
bar.rst
1.
When I include parts of foo.md in another md.
When rendering you get where the reference is lost:
2.
When I include parts of bar.rst in an md.
So it renders as a link but points to:
host/#test
instead of tohttp://example.com/
3.
If I include foo.md in an .rst:
Hello world [Test][test].
is obtained. The link is not rendered.4.
When I include parts of bar.rst in another .rst
It renders correctly.
Reproduce the bug
Source code: https://github.com/eyllanesc/myst_bug
Output: https://myst-bug.readthedocs.io/en/latest/index.html
List your environment
The text was updated successfully, but these errors were encountered: