11

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: http://example.com/test

  • 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 'SO- stop being evil' 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-mpi.de/projects/hwloc/doc/v1.2/group_<em>hwlocality</em>_membinding.php#gade5e2c28ea8475a479bf2b1df36c6ccd – Gilles 'SO- stop being evil' Aug 4 '11 at 9:53
11

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 https://stackoverflow.com/editing-help

7

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.

  • 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 '14 at 14:02

You must log in to answer this question.

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