Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 157 Stack Exchange communities.

What is meta?
Here's how it works:
  1. Any Stack Exchange user can ask a question
  2. The community provides support, votes on ideas, and reports bugs
  3. Your voice helps shape the way Stack Exchange operates

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

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

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

You must log in to answer this question.

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