mcwumbly
(Dave McClure)
September 24, 2018, 7:52am
1
I’m not sure if this is a commonmark issue, a markdown-it issue, or a Discourse issue, but when sharing the link in this post , I noticed this edge case with the automatic link detection where the sequence -_foo_-
breaks it.
This was the original link:
https://blog.acolyer.org/2018/06/28/how-_not_-to-structure-your-database-backed-web-applications-a-study-of-performance-bugs-in-the-wild/
Here’s a simplified example:
https://example.org/foo-_bar_-baz
And rendered:
https://example.org/foo- bar -baz
(And as an image for good measure):
As a workaround, to make a link like this go to the right destination, you can always just use a real markdown link like so:
[foo _bar_ baz](https://example.org/foo-_bar_-baz)
foo bar baz
2 Likes
This was already opened in the context of a Twitter user with similar character patterns in username, rendering linking to that twitter profile very difficult.
2 Likes
david
(David Taylor)
Closed
September 24, 2018, 3:09pm
3
Known issue with commonmark, we can continue discussion here:
That’s a known issue:
https://github.com/markdown-it/markdown-it/issues/38
It’s possible to fix, but not easy. Workaround available.
Correct solution is to make linkifier part of tokenizer process. That’s expensive (for example, email lookahead check for every character). Tradeoff is to listen : then do look behind for http(s), and lookahead for the rest. That’s not universal, but will cover all real cases:
http/https links will be parsed with other tokens, with higher priority than emphasi…