-
-
Notifications
You must be signed in to change notification settings - Fork 317
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
Parse link references without knowledge of definitions #702
Comments
This is exactly the point I made here: https://johnmacfarlane.net/beyond-markdown.html#reference-links |
Oh, and as I say in the article: changing things so that links can be recognized without parsing the whole document means no more "shortcut" links, e.g. |
Thanks for the link @jgm that's really interesting, and glad to know that I was completely alone in feeling this 😅
So, I guess my question would be; do we have to forever be constrained by legacy, or is there any world where this could have some form of spec compliance 😬
Did you ever look into getting any "consensus" over your proposals? |
Heya, I would like to understand the rationale behind https://spec.commonmark.org/0.30/#example-568
This enforces on both users and parsers that
[foo][bar][baz]
cannot be "understood" in isolation, but only after all definitions within the document have been identified.Particularly for parsers (such as markdown-it and remark), this necessitates a bunch of extra complexity to run a "pre-parse", before one can actually parse the document in full.
In turn, it precludes any kind of streamed or incremental parsing, or to write a good regex based syntax highlighter (such as TextMate grammars)
I feel the output of this example should be:
or even just
i.e.
[foo][bar]
and[baz]
are captured as link references in the AST.[foo][bar]
link reference, with no matched definition, it would be output in its raw (encoded) format, or even just omitted.Is there any rationale to Example 568 that I am missing?
In fact, the syntax highlighting, here on GitHub, demonstrates exactly the problem, in that it cannot "work out" what is a link reference, and incorrectly highlights
[foo]
:The text was updated successfully, but these errors were encountered: