Underscore in URL link causes markdown problem

markdown-it-review

(Wes Osborn) #1

When a user added the following link / text

<a href="https://www.google.com/maps/d/edit?mid=zWvvJHxEdPoI.k0-_AW-7A9NY">https://www.google.com/maps/d/edit?mid=zWvvJHxEdPoI.k0-_AW-7A9NY</a>

This generated the following “broken” link (screenshot below):



It causes the same broken link over in try.discourse.org.

This appears to be related to this issue that was previously reported: Underscores in linked text can cause markdown bug


(Jeff Atwood) #2

Has to do with the presence of both dash and underscore in the same URL. As a workaround you may want to try

  1. Any other linking method (other than raw html)
  2. Don’t make the link text the same as the URL

#3

Reviving 187 later because this bug is still in effect and has bitten me today.


(Sam Saffron) #4

Tempted to wait on the new markdown parser for this, the regex there is hell, odds of breaking it even more if we touch it are very high.

You can give it a shot if you wish

https://github.com/discourse/discourse/blob/master/app/assets/javascripts/discourse/dialects/autolink_dialect.js


#5

Fair enough.


(Sam Saffron) #6

a href: https://www.google.com/maps/d/edit?mid=zWvvJHxEdPoI.k0-_AW-7A9NY

autolink: Sign in - Google Accounts

All is well in our new :fire_engine:


(Sam Saffron) #7