0

I happened to be doing this here and I was going mad reading the backtick post here on meta.

This works fine

backtick this `this`
  1. but this does not

    backtick this this

nor for bulleted lists

  • nor this

    backtick this this

I'm not sure if this is a bug and surely it's been mentioned somewhere. Is there any way around it?

4

Ah-hah. You need to increase the indent of the code block for each level of the list it's "under". Indent 4 more spaces for each additional level:

example code
  1. example 1

    example 1 code
    
  2. example 2

    • example 2a

      example 2a code
      

ta-daaahh. for reference, here's what's typed to show the above:

    example code

1. example 1

        example 1 code

2. example 2

  - example 2a

            example 2a code
  • Not sure why SO sorts the first answer last...? Anyway, thanks, that did it. – Dan Rosenstark Mar 6 '10 at 14:06
  • 1
    the sorting defaults to sorted-by-votes, with ties randomly sorted. if you want a newest-first or oldest-first sort, use the tabs between the question and answer sections of this page. – quack quixote Mar 6 '10 at 14:09
2

There are two ways to do this. The one you want to use is to indent the code block 4 more spaces

  1. indent the code example

    backtick this `this`
    

Also works for bulleted lists

  • like this

    backtick this `this`
    

The other way to do it is to escape the ` character. This is the option you want to use if you're not trying to format the line as code.

Escape the backtick like this \`
  1. Using escaping like `this`

    or on the next line like `this`

Also works for bulleted lists

  • like `this`

    or on the next line like `this`

1

This works:

  1. List item1

    Some code
    
  2. List item2

    Some more code
    

Double indent.

You must log in to answer this question.

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