7

In the comments on StackOverflow, http://en.wikipedia.org/wiki/Inotify was misparsed to include the trailing angle bracket. Also there was a semi-colon after it for some reason. See my comment below for an example.

In RFC 3986 Appendix C. Delimiting a URI in Context, three ways are suggested to indicate that a bit of text is a URL.

  1. Angle brackets like <http://en.wikipedia.org/wiki/Inotify>
  2. Quotes like "http://en.wikipedia.org/wiki/Inotify"
  3. Whitespace like http://en.wikipedia.org/wiki/Inotify

Angle brackets are "especially recommended" in the RFC.

Markdown syntax also automatically links angle brackets and SO's editing help mentions it. The comment formatting help doesn't say comments auto-link differently. Comments do auto-link, why do it different?

Thanks for looking. I know free-form URL parsing is a pain, I maintain a library myself.

UPDATE: As you can see in this example -- http://en.wikipedia.org/wiki/Inotify -- the posting grammar knows how to deal with URLs in angle brackets. Why not in comments? They both do auto-linking. Unless there's some other benefit to the user they should do them the same to avoid confusion. This allows users to learn just ONE set of quirks, not two.

3

2 Answers 2

4

The Stack Exchange editor does not use RFC 3986. Instead, the indication that a piece of text is a URL is given by the underlining and color change/mouse pointer change on mouseover.

Linking is done using mini-markdown in comments. Comments only support a subset of markdown, and they do not recommend the use of angle brackets. See the detailed comment help here.

Don't use the angle brackets. Just use the [link](http://example.com) syntax instead, or allow the URL to be parsed, underlined, and colored differnently.

4
  • Here is an example of not parsing differently, if you really want your angle brackets: <en.wikipedia.org/wiki/Inotify> produced by [<en.wikipedia.org/wiki/Inotify>](http://en.wikipedia.org/wiki/Inotify). Commented Nov 14, 2011 at 20:02
  • 1
    Here's an example of a better link to that page: Wikipedia article on inotify, produced by [Wikipedia article on inotify](http://en.wikipedia.org/wiki/Inotify). Commented Nov 14, 2011 at 20:03
  • And here's an example of just linking to the page: en.wikipedia.org/wiki/Inotify. Can you tell that's a link? Commented Nov 14, 2011 at 20:03
  • By your first statement, I believe my question wasn't clear. It's not that SO should insert angle brackets when displaying URLs, but that SO should turn URLs with brackets around them into links. This is about autolinking, not display. Otherwise, see my comment to @kiamlaluno's answer, summed up as A) there's no docs saying comments autolink different from posts, yet they do autolink and more importantly B) different autolink behaviors are confusing, why do it?
    – Schwern
    Commented Nov 14, 2011 at 21:51
1

Comments use a reduced Markdown set, which is reported in the comment help.

screenshot

The Learn more link takes you to a page with an extended explanation (it's the section containing "Comment formatting," and "Replying in comments"), but also that section doesn't say that URLs enclosed between < and > are handled in comments.

I would say this is by design.

3
  • I would say it isn't by design, where's that semicolon coming from? I didn't type it. It doesn't show up with other auto-linked URLs. The comment help doesn't say that autolinked URLs are handled differently, yet it does do some autolinking. And why is it good design to use a different URL autolinking algorithm in the post than the comments?
    – Schwern
    Commented Nov 14, 2011 at 21:47
  • It is by design because you are not using something that is supported in comments; if you used <a> tags for links, you would not get the expected result.
    – avpaderno
    Commented Nov 14, 2011 at 22:19
  • That's a poor rationale for it not working correctly. The comment documentation is obviously incomplete, it does not talk about autolinking at all. More importantly, "it's documented that way" does not explain why it should be that way. Is it in some way more helpful to the user? I suspect it is merely that there are two different implementations of the formatter (one for posts and one for comments) and this slipped by the tests.
    – Schwern
    Commented Nov 14, 2011 at 23:29

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