4

Similar to this question. While cleaning up some URL shortened links, I noticed that links are not automatically hyperlinked when enclosed in parens. For example,

(http://meta.stackoverflow.com)

and

http://meta.stackoverflow.com <- properly hyperlinked.

I imagine this has to do with the regex.

In chat, it works properly.

10
  • 3
    The problem solves itself if you don't post bare URLs. Make the link text explanatory. Showing us where the link goes is what tooltips are for.
    – Cody Gray
    Commented Jul 26, 2011 at 16:07
  • @Cody: What do tooltips have to with this? Commented Jul 26, 2011 at 16:09
  • Uh, the point is to use descriptive text in your hyperlinks, not bare URLs. Tooltips tell you the actual linked URL. I don't understand what's unclear.
    – Cody Gray
    Commented Jul 26, 2011 at 16:11
  • @Cody: What does that have to do with the fact that the automatic hyperlinking works for URLs in parens only in Chat and not on the SE network in general? That's not a solution but a workaround! Commented Jul 26, 2011 at 16:12
  • 1
    The problem solves itself if you stop posting bare URLs... It's not a "workaround" when you shouldn't be doing it in the first place. Markdown has great support for this.
    – Cody Gray
    Commented Jul 26, 2011 at 16:12
  • @Cody: That's pretty harsh and I disagree. Commented Jul 26, 2011 at 16:20
  • 1
    I would actually be in favor of disabling automatic hyperlinks on bare URLs entirely and requiring link text. Would this be a reasonable feature request? Commented Jul 26, 2011 at 18:54
  • @Chris: I'd vote for it. There are very few cases where bare URLs make sense, and in those few cases, you could use the "workaround" of creating a hyperlink with the URL as the link text.
    – Cody Gray
    Commented Jul 26, 2011 at 23:35
  • 1
    @Cody: Done. Commented Jul 26, 2011 at 23:57
  • The same applies to bare links to other Stack Exchange sites, which normally get to be replaced with a clickable link and their title. For those, I actually think posting bare URLs is preferred, @Cody? (To make the title change when the original is changed, even though that only works when the linking post is edited and saved too.) As an aside, adding <...> fixes that too; like: (<http://...>).
    – Arjan
    Commented Oct 2, 2011 at 16:01

2 Answers 2

12

Chat and comments use mini-Markdown for formatting, so it's expected that their behaviour may sometimes be slightly different than the actual Markdown parser used in posts.

Since the auto-linking of completely bare URLs is a custom extension of the Markdown parser used here, it's hard to tell if this behaviour is intentional or not. Looking at the code though, this step happens after other link forms have been converted, so I don't see any immediate reason that the match pattern couldn't be updated with the one used in chat. so provided the proper precautions are taken there's no harm in making the swap – which balpha has now done, making this once deployed.

You can also use the Markdown-compliant syntax, by surrounding the URL with angled brackets. For example,

(<http://meta.stackoverflow.com>)

Produces:

(http://meta.stackoverflow.com)

2
  • Note, @Bravada, in the above syntax you can leave out the parentheses entirely.
    – M. Tibbits
    Commented Jul 26, 2011 at 16:28
  • This also works for auto-titles for bare Stack Exchange URLs. Like (<http://meta.stackexchange.com/questions/19478/the-many-memes-of-meta>) would become (The Many Memes of Meta).
    – Arjan
    Commented Oct 2, 2011 at 16:07
3

The irony is that when this question was linked in chat, they were both hyperlinked correctly in the chat preview.

You must log in to answer this question.

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