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

The hyperlink markdown seems to break when you have "[] " immediately before link text. I noticed having spaces between the bracket groups doesn't effect the outcome. Maybe it should?

Source: byte[] [link][1]

Example: byte[] [link]1

share|improve this question

2 Answers 2

up vote 4 down vote accepted

You can fix this by properly putting your byte[] in code formatting. This will prevent the square brackets from being interpretted as a link. As to what is causing this problem, it's a lot of different parts of markdown colliding in a very unfortunate fashion as it tries to simply render in order. It happens in any scenario if you try to pre-empt a link with anything inside of a singular pair of square brackets, not just emptiness. The exact behavior you see is because the link text of your intended link is not a valid anchor.


First, specifying just the link footer anchor in brackets counts as a link. So if I have a link anchor of [2], then just writing [2] will count as a link, like below.

2

Second, adding a space between the link text and the link footer anchor is a legal action for markdown. So, [Elegance] [2] will render as just the same as if there was no space in the middle.

Elegance

What's breaking in the end is that there's the secret point that link anchors don't need to be numbers. Markdown is treating your string byte[] [link][1] by linking the first set of brackets as link text, and the text "link" as the anchor. Then, 1 ends up being treated as its own separate link.

It still renders visibly because there is no "link" anchor at the bottom, so it is treated like a broken link syntax. Now, if you had an anchor of "link" at the bottom, though, you'll get the following output for your string:

byte[1]

You can't see anything, though, because there's nothing in the link text. But between the [1] and the byte is a link. Were I to add another anchor for 1, then it would render the 1 as a link as well as the emptiness. Since I don't, though, let's just see what [Elegance] [1][2] looks like.

[Elegance] [1]2

share|improve this answer
    
Thanks for the clarification, Grace. –  Jeremy Heiler Feb 24 '11 at 14:23
1  
This is absolutely correct; it relates to the fact that markdown allows a space between the two parts of the link definition. Hence, e.g., adding a second space before [link] would have worked as well. /cc @Jeremy –  balpha Feb 24 '11 at 15:26

You need to escape one of the brackets.

byte[] test

byte\[] [test](http://google.com)

share|improve this answer

You must log in to answer this question.

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