Format to add standard code blocks within Markdown lists
Asked Answered
P

1

1

I've found that I can't get code blocks within numbered lists.

For example, when I add a code block by indenting by four spaces normally like below:

1. Do the first thing

    $ git stuff
    $ git other stuff 

2. second thing:

    $ git more stuff

it comes out like this, where the $ git lines are normal text and are not formatted as code:

  1. Do the first thing

    $ git stuff $ git other stuff

  2. second thing:

    $ git more stuff

I can use the backticks to do it, i.e.

1. Do the first things

    `$ git stuff`  
    `$ git other stuff` 

2. second thing:

    `$ git more stuff`

but I would like to do the blocks 'normally' (4 space indent) if I can.

Pressurize answered 22/4, 2012 at 19:12 Comment(0)
C
3

Per the documentation you need to do extra indentation; +4 spaces or +1 tab (8/2, respectively, from column 0).

1. Item 1

        $git stuff
        $git other stuff

2. Item 2

        $git more stuff

Those newlines are necessary.

Comely answered 22/4, 2012 at 19:35 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.