Is the problem me, or Stack Overflow?

If I post a comment or question with this named link, some text, and then an inline link the preview will show correctly but the actual result is strange. All of the text from the start of the first link up to and including the text of the second link is linked to the first destination.

For example:

[strfriend](http://strfriend.com/) is *your* friend:


Results in:

strfriend is your friend:


Notice how the entire first line is linked, and how the second link actually points to the destination of the first.



  • Can you show your exact markup, and perhaps provide a screenshot? Your description is hard to follow. – jrockway Jan 12 '09 at 18:40
  • I have the syntax in a code block in the question, and the result can be seen right below it (the 'bug' is visible in Firefox 3, IE 6, the iPhone's Safari, and probably other browsers...). Do I really need a screenshot? – Steve Losh Jan 12 '09 at 18:47
  • The wierd thing is that the edit preview gets it right! – Paul Tomblin Jan 12 '09 at 18:49
  • I had this problem a few days ago, and the person who fixed it changed the links at the bottom of the page (the text "[1] href"). In my case, the problem occurred when I inserted a new link before an existing one. – kdgregory Jan 12 '09 at 18:57

Updated in light of comment:

[strfriend][1] is *your* friend

  [1]: http://strfriend.com/

Results in:

strfriend is your friend

  • I want the word strfriend to be a link and not the rest of the sentence. I could user the reference-style links, but shouldn't the code I posted be valid syntax? The preview pane even gets it right! – Steve Losh Jan 12 '09 at 18:59
  • Updated in light of your comment... The syntax you have above isn't valid Markdown, at least not on here on SO. – James B Jan 12 '09 at 20:31
  • MarkDown is just ambiguous this way because valid links could actually contain parentheses. Your solution is good. – Konrad Rudolph Jan 12 '09 at 20:36
  • @James It's not valid Markdown? That format for links is shown as an example right on the edit page in the "Formatting Help" box... – Steve Losh Jan 13 '09 at 16:45

Escape the parens. Parens are pretty toxic in URLs.


It's even worse: those strfriend URLs in the form of


...are really painful. You'll have to encode almost everything in it. See my edit. Works now, but not worth it IMO.

str friend? more like str ENEMY.

  • That does work, thanks. It still seems odd that it would render correctly in the preview but not in the final version. Well, maybe not odd if they use different Markdown rendering engines. – Steve Losh Jan 15 '09 at 17:48
  • Parentheses in URLs might be toxic, but they're also perfectly valid, and thus the syntax ought to work. – Rob Feb 24 '09 at 9:11
  • 1
    A URL this crazy should be tinyurl'ed IMO – Jeff Atwood Feb 24 '09 at 20:16

You must log in to answer this question.

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