# URL with dashes and underscores altered when inserted into [name](url) notation

So, this is the URL:

http://code.google.com/p/es-lab/wiki/Talks#Changes_to_ECMAScript,_Part_2:_Harmony_Highlights_-_proxies_and


When I insert the URL like so:

[Title](URL)


the last part of the URL changes from

Highlights_-_proxies_and


to

Highlights/i-_proxies_and


What's going on here?

Note: See my comment below for a live demonstration of the issue! Feel free to copy the URL and try it for yourself... (It seems that the URL is only altered if the []() notation appears within a comment, but not when it appears within a question/answer.)

-
Proof –  Šime Vidas Feb 16 '12 at 20:50
Confirmed. Also, it changes ECMAScript,_Part_2 to ECMAScript,iPart_2. –  Dennis Feb 16 '12 at 21:13
Markdown parser bug - one underscore after the comma and one before the dash are turned into <i> tags, which are then sanitized. (educated guess) –  lunboks Feb 16 '12 at 21:15
It'd be saner to use a URL shortener. –  Andres Riofrio Mar 21 '12 at 5:29
+1, this is still happening, although apparently now the angle brackets are no longer getting stripped. –  Ilmari Karonen Feb 5 '14 at 12:00

There were actually two changes:

...#Changes_to_ECMAScript,iPart_2:_Harmony_Highlights/i-_proxies_and
^                          ^^


The Markdown Mini parser applies its italics check before performing link conversion, and the comma is one of the characters that's allowed before an underscore (or asterisk) when looking for the italics pattern. This caused the "Part_2:_Harmony_Highlights/" part of your URL to be surrounded by an <i> tag pair, and the relevant underscores to be removed.

Since in the case of comments URL santitation is done by removing characters not on the whitelist, the angled brackets caused by the previous step were dropped and you were left you with just the is.

The immediate solution to this is to simply escape the problematic first underscore, which will prevent the accidental italicising:

...#Changes_to_ECMAScript,\_Part_2:_Harmony_Highlights_-_proxies_and
^

-
I see. I won't be using commas or dashes in my URL fragments then... (at least in scenarios where I have underscores as word-delimiters) –  Šime Vidas Feb 16 '12 at 21:41
@ŠimeVidas Whoops, I wasn't thinking fully yesterday though, there's a much saner way to work around this, per my edit. –  Tim Stone Feb 17 '12 at 19:49
Example comment: escaped url –  Tim Stone Feb 17 '12 at 19:49
OK, cool :) What's up with the / after Highlights though? –  Šime Vidas Feb 17 '12 at 20:36
Ah, mistakenly copied it from the broken URL, where it was part of the closing </i>. –  Tim Stone Feb 17 '12 at 20:37

As you can see in your comment, this is fixed now. Tim's answer was absolutely correct; I finally fixed this when enabling intra-word emphasis in comments, because that would have made this problem even worse.

-