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

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:

<http://strfriend.com/vis?re=%28Zip%3A%5cs%2a%5cd%5cd%5cd%5cd%5cd%29%5cs%2a%28State%3A%5cs%2a%5cw%5cw%29>

Results in:

strfriend is your friend:

http://strfriend.com/vis?re=%28Zip%3A%5cs%2a%5cd%5cd%5cd%5cd%5cd%29%5cs%2a%28State%3A%5cs%2a%5cw%5cw%29

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

Related:

http://stackoverflow.com/questions/217533/links-to-urls-containing-parentheses

share|improve this question

migrated from stackoverflow.com Feb 18 '11 at 21:20

This question came from our site for professional and enthusiast programmers.

    
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

2 Answers 2

Escape the parens. Parens are pretty toxic in URLs.

http://www.codinghorror.com/blog/archives/001181.html

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

http://strfriend.com/vis?re=(Zip%3A\s*\d\d\d\d\d)\s*(State%3A\s*\w\w)

...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.

share|improve this answer
    
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

Updated in light of comment:

[strfriend][1] is *your* friend

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

Results in:

strfriend is your friend

share|improve this answer
    
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 Burgess 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

You must log in to answer this question.

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