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

In a Stackoverflow question/answer box, what is the markdown to render this, not as a code fragement, but in normal narrative text.

myArray[2][1]

The above is only shown in a code fragment, as that is the only way I know how to show it to you. If instead I write the same text in normal narrative, this is what I get...

myArray2

Perhaps there is some markdown to achieve this? Thanks if you can advise.


Testing Murgatroid's solution

myArray[2][1]

share|improve this question
3  
I'm curious why you would want to do that. The inline code syntax (backticks) is made for precisely this sort of thing. Can you explain? –  balpha Sep 14 '12 at 8:00
add comment

3 Answers

up vote 3 down vote accepted

You can use a backslash (\) to escape the brackets: "myArray[2][1]" can be written like

myArray\[2\]\[1\]

or, as you pointed out, you only have to escape the open bracket, so the following will generate the same output

myArray\[2]\[1]
share|improve this answer
    
Thanks. With a bit of testing, I found that only the [ needs to be escaped. –  Sean B. Durkin Sep 14 '12 at 3:55
add comment

If you don't have any links using the [] notation, this is rendered literally:

myArray[2][1]

You can still have links using inline syntax:

[Google](http://www.google.com)

Google

or

[Yahoo][yahoo!]

[yahoo!]: http://www.google.com

Yahoo

share|improve this answer
    
Helpful, but it's a pain to change the link syntax. Murgatroid's solution is a better fit for my needs. Thanks anyway. –  Sean B. Durkin Sep 14 '12 at 3:51
add comment

Use backticks (`) for inline code.

Markdown:

Blah blah `myArray[2][1]` blah blah...

Result:

Blah blah myArray[2][1] blah blah...

share|improve this answer
1  
he did ask specifically how to write brackets outside of code blocks –  murgatroid99 Sep 15 '12 at 0:18
    
@murgatroid99: I'm assuming he meant outside paragraph-level code blocks. –  hammar Sep 15 '12 at 1:11
    
could be. I didn't think of that –  murgatroid99 Sep 15 '12 at 1:33
add comment

You must log in to answer this question.

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