Including reference-style links #609
-
Hello 👋 I'm having some problems including portions with reference-style links from a
The README looks like this: <!-- features-begin -->
- Testing with [pytest]
- Static type-checking with [mypy]
<!-- features-end -->
<!-- references-begin -->
[pytest]: https://docs.pytest.org/
[mypy]: http://mypy-lang.org/
<!-- references-end --> Includes look like this: .. include:: ../README.md
:parser: myst_parser.sphinx_
:start-after: <!-- features-begin -->
:end-before: <!-- features-end -->
pytest_ uses assertions to verify expectations in tests.
bla bla typechecking__
__ mypy_
.. include:: ../README.md
:parser: myst_parser.sphinx_
:start-after: <!-- references-begin -->
:end-before: <!-- references-end --> Errors due to missing link definitions look like this:
Is this expected behavior, and is there something I can do to get this to work? By the way, I discovered the hard way that docutils' |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Heya, You can try this out here: https://markdown-it.github.io/ |
Beta Was this translation helpful? Give feedback.
Heya,
the way Markdown parsers work, you cannot parse separately the link references and the link definitions:
they make a first parse of the syntax "blocks", and gather the link definitions,
then make a second parse of the inline syntax within the blocks.
The inline syntax
[abc]
is only considered to be a link reference, if there is a matching link definition available, otherwise it is just parsed as text.You can try this out here: https://markdown-it.github.io/