What is meta? ×
Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 133 Stack Exchange communities.

In the answer realloc() for NUMA Systems using HWLOC, the parser breaks my URL link.

The URL was with __word__:

http://www.open-mpi.de/projects/hwloc/doc/v1.2/group__hwlocality__membinding.php#gade5e2c28ea8475a479bf2b1df36c6ccd

After parsing, it becomes (<a href is broken; no clickable link):

hwlocality_membinding.php#gade5e2c28ea8475a479bf2b1df36c6ccd">http://www.open-mpi.de/projects/hwloc/doc/v1.2/group_hwlocality_membinding.php#gade5e2c28ea8475a479bf2b1df36c6ccd

Short test:

http://example.com/_test_ -> test">http://example.com/test

Or if I put in a naked URL with _test_ just here: test">http://example.com/test

share|improve this question
4  
So are you intentionally not using the markdown syntax for links? –  Cody Gray Aug 4 '11 at 9:29
    
markdown is harder, than just putting an url in the text –  osgx Aug 4 '11 at 9:31
3  
And C++ is harder than Java. But at least it doesn't break when you use characters like underscores within the link that have a specific meaning in markdown syntax. –  Cody Gray Aug 4 '11 at 9:33
2  
But naked urls have specific parsing in markdown; and italic will not work in urls, so, I think, parser should not to parse italic in naked urls. –  osgx Aug 4 '11 at 9:35
2  
@Cody If it was just the link not being linkified, I'd agree with you and tell osgx to tough it up. But "> appearing out of the blue is a different matter; it makes me worry that there might a way to inject arbitrary HTML into the permitted markup (i.e. a security issue). –  Gilles Aug 4 '11 at 9:48
1  
@Cody The HTML for the link-not-parsed-as-link is hwlocality_membinding.php#gade5e2c28ea8475a479bf2b1df36c6ccd">http://www.open-m‌​pi.de/projects/hwloc/doc/v1.2/group_<em>hwlocality</em>_membinding.php#gade5e2c28‌​ea8475a479bf2b1df36c6ccd –  Gilles Aug 4 '11 at 9:53

2 Answers 2

up vote 10 down vote accepted

Too much of an edge condition.

Remember that Markdown does not support "naked" URLs officially, so you have your pick of non-naked URLs to use here:

<http://example.com/foo__bar__baz#hash>  
<a href="http://example.com/foo__bar__baz#hash">link</a>  
[link](<http://example.com/foo__bar__baz#hash>)  

http://example.com/foo__bar__baz#hash
link
link

see http://stackoverflow.com/editing-help

share|improve this answer
4  
YouTube is starting to put underscores in URLs, so I think we are only going to see an increase in these situations. –  CyberSkull Jan 3 '12 at 20:13

This will work correctly from the next build on: client changeset, server changeset. The underscores will still cause some potentially unwanted styling of the displayed text1, but the link itself works.


1 Not anymore in most cases (including the one here), thanks to point 2. in this change.

share|improve this answer
1  
Aaand this broke Github. Probably Github's fault, but _ is not on the reserved characters list. Can the generated href attribute not be normalized? E.g. decode percent-encoded characters for non-reserved characters such as _? –  Martijn Pieters Apr 14 at 14:02

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .