Links with underbars surrounded by hyphens render incorrectly

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:

Here’s a simplified example:

And rendered:

(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](

foo bar baz


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.


Known issue with commonmark, we can continue discussion here: