Adding a custom reference link syntax #215
Unanswered
TheCloudlessSky
asked this question in
General
Replies: 1 comment
-
|
Hi! it’s not really recommended to make a markdown flavor that does not work in other places. See https://github.com/micromark/micromark#extensions. And the recommendations there. In this case, directives seems good? Media (links and images) are notorious. They are parsed in 2 bits, starts and closes. And only later it is checked if there are matching open/closes. So this will never work like links, if you attempt to parse an open and close together. I recommend turning |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
Our application supports a custom syntax that is similar to a reference link:
The user doesn't have to define a reference to
foo:123, we automatically map it to something like this:There's several key factors of this special syntax:
foo:###is a consistent prefix. The pattern is literallyfoo:\d+. So, it should take priority over any normal reference links.We previously implemented this in
markedbut I'm having trouble implementing it in micromark. The biggest culprit that I struggle with is properly capturing the label so that it handles nested markdown, line breaks, etc. As soon as I fix one problem, it introduces others. I'm having trouble getting into the core mechanics of, for example, label parsing. Of note, I haveremark-breaksandrembark-gfmextensions enabled too.Here's my setup:
This works for a majority of situations. But I'm finding several cases failing to parse as I'd expect:
Is there core documentation (or an obvious fix) for how to properly let micromark re-parse (sub-tokenize) the label's content to support markdown, new lines, etc just like normal links?
Beta Was this translation helpful? Give feedback.
All reactions