1

I have a Markdown enumeration:

  1. sdsdf
  2. sdfsdf

some code 3. sdfsdf

The 3. is shown as one because of the code block.

How can I insert a code block in one of the enumeration steps and let the enumeration counter continue correctly after the counter?

  • possible duplicate of [Markdown: continue numbered list](http://stackoverflow.com/questions/18088955/markdown-continue-numbered-list) – wmk May 14 '15 at 18:28

1 Answers1

5

Indent the code block by four additional spaces to show that it's part of the preceding list item:

1. sdsdf
1. sdfsdf

        function foo() {
            // do something
        }

1. sdfsdf

The extra four spaces are required to include the code block in the list item:

To put a code block within a list item, the code block needs to be indented twice - 8 spaces or two tabs:

* A list item with a code block:

        <code goes here>
Community
  • 1
  • 1
ChrisGPT was on strike
  • 127,765
  • 105
  • 273
  • 257