87

How do I either:

  • Create a numbered list item that has multiple paragraphs (broken with newlines), or

  • As a workaround, prevent the editor from automatically formatting lists marked with "N." (since it restarts at 1 no matter what number I enter)?

0

6 Answers 6

100

multiple paragraphs (broken with newlines)

Warning: this answer documents how StackExchange parsed before it adopted CommonMark, which does not interpret/parse these examples in the same way.

Insert a blank line after the list item's first paragraph and before the start of your second paragraph. Make sure to indent the second line containing text with at least one space to ensure that it is indented as part of the list.

Code (StackExchange's pre-2021 Markdown dialect):

1. Option one

 Second paragraph
 
2. Option two

 Second paragraph

Result:

  1. Option one

    Second paragraph

  2. Option two

    Second paragraph

Of course, the extra space is optional. If you don't want that, you can just use two spaces at the end of a line in order to force a line break:

Code (StackExchange's pre-2021 Markdown dialect):

1. Option one  
 Second paragraph

2. Option two  
 Second paragraph

Result:

  1. Option one
    Second paragraph

  2. Option two
    Second paragraph

Naturally, the extra line between list items is also optional, but that works the same way as a simple list—just don't separate the items with an empty line in your Markdown.


prevent the editor from automatically formatting lists marked with "N."

Easy: escape the list item with a backslash.

Markdown:

7\. Item one

196\. Item two

Preview:

7. Item one

196. Item two

Of course, you lose the indentation this way. The only workaround that I know of is to add non-breaking spaces manually ( )—about 5 will suffice.

20
  • 1
    The last option isn't starting a numbered list at a number other than one, it's simply not using the numbered list function at all.
    – Servy
    Commented Aug 12, 2013 at 15:49
  • @Servy You're right, technically. I'm almost certain that it is impossible to start a numbered list at a number other than one with markdown. Commented Aug 12, 2013 at 15:49
  • So am I, which is why you claiming that this is a solution bothered me; it's not a solution.
    – Servy
    Commented Aug 12, 2013 at 15:50
  • Thanks! I much prefer the indentation method over inserting <br/>.
    – Jason C
    Commented Aug 12, 2013 at 15:51
  • 1
    @Servy Err, perhaps I misunderstood, but the question says or. Commented Aug 12, 2013 at 15:51
  • @Servy: In Cody Gray's defense, I did ask how to prevent the editor from formatting lists marked with "N." (as an alternative if multiple paragraphs per item was not possible). :)
    – Jason C
    Commented Aug 12, 2013 at 15:52
  • 3
    This does not appear to work if you need the final item of the numbered list to have multi-paragraphs. The line breaks and spacing are interpreted always as new paragraphs totally outside of the numbered list. Is there a separate solution for how to split up the last item of the list into multiple paragraphs?
    – user183600
    Commented Sep 13, 2017 at 12:09
  • For the final item, I found that I needed 4 spaces at the start of each sub-paragraph line, and then they were included as part of the final item.
    – user183600
    Commented Sep 13, 2017 at 12:17
  • @ely No, they aren't. Indent each paragraph you want to be nested under the list item with a space. When you're finished nesting, omit the leading space. Commented Sep 13, 2017 at 12:18
  • @ely Hmm, I'm not sure what you're talking about. You're going to have to show me an example. Commented Sep 13, 2017 at 12:21
  • The examples you show for 'section 2' do not work using the markdown source code from this answer. Since 'section 2' is the final item of the list, skipping a line and adding a single space does not cause it to be rendered as a separate paragraph inside of the list item. Instead, it is rendered as a separate paragraph after the list.
    – user183600
    Commented Sep 13, 2017 at 13:41
  • It may be a unique way that StackOverflow is processing the Markdown. Because from the ReText program in Ubuntu and from GitHub, copy / pasting your markdown syntax does not yield the same rendered result as in this answer, at least for sub-paragraphs for the final item of a list.
    – user183600
    Commented Sep 13, 2017 at 13:42
  • I'm still having trouble following what you're saying, but I think the problem is that section 2 is not actually creating a list. The escape character (backslash) stops the numbers from being interpreted as part of a list, which is what allows you to use arbitrary numbers. Now, the implementation has changed since this answer was posted, where we now start numbering from the first number your list begins with, but that still won't help you to do disjoint list items. (I'm not sure why you'd want to?) There's no real solution to this. Commented Sep 13, 2017 at 13:45
  • But maybe I still don't understand, because this affects all the items in the list, not just the last one. @ely Commented Sep 13, 2017 at 13:45
  • 4
    Markdown on SE sites just went through a major change, @H.H.. Most of what is in this answer is probably inaccurate now. Commented Jul 9, 2020 at 12:20
10

Like this:

  1. first half

    second half
  2. second item

Markdown:

1. first half<br/><br/>second half
1. second item
6
  • 8
    Or you could just use the normal paragraph syntax inside the list, rather than ugly line-break elements.
    – animuson StaffMod
    Commented Aug 12, 2013 at 15:48
  • 1
    @animuson If you do that without indenting the additional paragraphs it messes up the number formatting, which is the source of the OP's problem.
    – Servy
    Commented Aug 12, 2013 at 15:50
  • So indent the additional paragraphs? <br>s look bad on both sides. (Note the difference in spacing between the two answers)
    – Ry-
    Commented Aug 12, 2013 at 15:50
  • @Servy: Exactly; you have to indent the paragraphs for it to work - that's just how Markdown was designed. Commented Aug 12, 2013 at 15:53
  • I don't particularly have anything against putting <br/> in the post. Hopefully you're reading the output instead of staring at the markdown. :) But yes I do prefer the indentation mentioned below, mostly because it's less typing.
    – Jason C
    Commented Aug 12, 2013 at 15:53
  • 1
    This worked for me. The top answer did absolutely nothing on physics stack exchange
    – Mr. Nichan
    Commented Jul 9, 2020 at 11:56
8

You can also just put a line break + space in the second paragraph:

Markdown:

1. first

 second

2. asdf

Output:

  1. first

    second

  2. asdf

7

There is a simple, if unintuitive way to do this. End a line with a backslash or two spaces and the next line will appear on a new line. Unfortunately, StackExchange's Markdown implementation only supports the two space version, but you can see both in action at GitHub here.

Line breaks using backslashes

* List item
    * Indented list item 1\
      item 1 line two\
      item 1 line three
    * Indented list item 2

In case StackExchange supports backslash line breaks sometime in the future, here's what that looks like.

  • List item
    • Indented list item 1\ item 1 line two\ item 1 line three
    • Indented list item 2

Line breaks using two spaces

* List item
    * Indented list item 1  
      item 1 line two  
      item 1 line three
    * Indented list item 2
  • List item
    • Indented list item 1
      item 1 line two
      item 1 line three
    • Indented list item 2
1
  • 1
    I don't know what everyone else is talking about, but the backslashes are the best solution for my use case. Thanks for this!
    – Dan
    Commented Sep 4, 2019 at 6:11
7

The link mentioned by Cody Gray in comments was quite helpful. Other markdown's like R markdown and Github also follow it so I am just reposting the link. So that no one misses it.

We're switching to CommonMark

From that post:

Lists: When creating nested lists, you’ll need to indent your nested list items or paragraphs with the right amount of spaces. While one space was enough before, you’ll need to add a few more now, depending on your type of list.

To make a paragraph part of a list item it used to be enough to add one space in front of the paragraph

* this is a list item

 that goes on here 

with CommonMark, the paragraph has to line up with the text of the parent, so we need a few more spaces here:

* this is a list item

  that goes on here 
1
  • 2
    Yes, with numbered lists it means you need three spaces to indent subsequent paragraphs in a list item (to be as many as characters in 1. - one-dot-space). Code snippets can also be included in a list item if indented sufficiently.
    – Jake
    Commented Nov 22, 2020 at 2:47
1

As a workaround, prevent the editor from automatically formatting lists marked with "N." (since it restarts at 1 no matter what number I enter)?

For this you have to break a list kinda like this.

  1. first
  2. second
  1. fourth
1. first
0. second
<!-- Put at least two rows before specific number:
   - the first line is filled by html comment which can be empty
   - the last is just empty row.
     A little problem: small padding, 
     maybe something else what I don't know -->
<!-->

4. fourth

In quote

  1. first
  2. second
  1. fourth
> 1. first
> 0. second
> <!-->
>
> 4. fourth

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