mcwumbly
(Dave McClure)
24 Septiembre, 2018 07:52
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 Me gusta
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 Me gusta
david
(David Taylor)
Cerrado
24 Septiembre, 2018 15:09
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…