Open eyllanesc opened 2 years ago
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:
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:
Hello world [Test][test]. is obtained. The link is not rendered.
In my case, I have an existing documentation that was ported from Jekyll and had a links.md
with all the reference links definitions. Including that page is giving me the same behaviour, of links not rendered.
Trying to understand now whether it's related to this issue, or if I better to create a separate issue :+1:
Ok, I did some digging.
The problem is basically the order in which things are done:
{include}
directive.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:
MystParser.parse
intercept any include
directives before calling render
and just add that content to the inputstring
. You would need to make sure to handle recursion correctly.markdown_it
plugin that provides the include file functionality. I think, this might be doable but at the moment, myst-parser comes with a set of pre-activated plugins and I could not find a way to tell it to activate more...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)
```{include} ./my_file.md
:start-after: dummy-label start
:end-before: dummy-label end
myst-parser 0.18.0
Sphinx 5.1.1
This is a core limitation of commonmark I'm afraid; reference definitions have to be parsed before reference links:: https://github.com/commonmark/commonmark-spec/issues/702 (this behaviour is different to rST
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.
2.
When I include parts of bar.rst in an md.
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