Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Markdown: continue numbered list

Tags:

markdown

In the following markdown code I want item 3 to start with list number 3. But because of the code block in between markdown starts this list item as a new list. Is there any way to prevent that behaviour?

Desired output:

1. item 1 2. item 2  ``` Code block ```  3. item 3 

Produced output:

  1. item 1
  2. item 2

Code block

  1. item 3
like image 499
orschiro Avatar asked Aug 06 '13 19:08

orschiro


People also ask

How do I add numbers in markdown?

Headings. To create a heading, add number signs ( # ) in front of a word or phrase. The number of number signs you use should correspond to the heading level. For example, to create a heading level three ( <h3> ), use three number signs (e.g., ### My Header ).

How do you indent on markdown?

As a workaround I would suggest inserting a vertical bar (|) followed by hard spaces (Alt-Code on Windows: Alt+0160). This preserves the indent after the bar resulting in a visually acceptable solution for raw and rendered Markdown. This is a normal line of text. | This is an indented line of text.

How do I show code in markdown?

There are two ways to format code in Markdown. You can either use inline code, by putting backticks (`) around parts of a line, or you can use a code block, which some renderers will apply syntax highlighting to.


2 Answers

Use four spaces to indent content between bullet points

1. item 1 2. item 2      ```     Code block     ``` 3. item 3 

Produces:

  1. item 1
  2. item 2

    Code block

  3. item 3
like image 148
Macmade Avatar answered Sep 26 '22 21:09

Macmade


As an extension to existing answers. For those trying to continue a numbered list after something other than a code block. For example a second paragraph. Just indent the second paragraph by at least 1 space.

Markdown:

1. one 2. two   three 3. four 

Output:

  1. one

  2. two

    three

  3. four

like image 45
DavidT Avatar answered Sep 24 '22 21:09

DavidT