50

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)?

55

multiple paragraphs (broken with newlines)

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

Markdown:

1. Option one

 Second paragraph

2. Option two

 Second paragraph

Preview:

  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:

Markdown:

1. Option one  
 Second paragraph

2. Option two  
 Second paragraph

Preview:

  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.

  • 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 Aug 12 '13 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. – Cody Gray Aug 12 '13 at 15:49
  • So am I, which is why you claiming that this is a solution bothered me; it's not a solution. – Servy Aug 12 '13 at 15:50
  • Thanks! I much prefer the indentation method over inserting <br/>. – Jason C Aug 12 '13 at 15:51
  • 1
    @Servy Err, perhaps I misunderstood, but the question says or. – Cody Gray Aug 12 '13 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 Aug 12 '13 at 15:52
  • 1
    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? – ely Sep 13 '17 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. – ely Sep 13 '17 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. – Cody Gray Sep 13 '17 at 12:18
  • @ely Hmm, I'm not sure what you're talking about. You're going to have to show me an example. – Cody Gray Sep 13 '17 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. – ely Sep 13 '17 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. – ely Sep 13 '17 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. – Cody Gray Sep 13 '17 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 – Cody Gray Sep 13 '17 at 13:45
  • If I use the first example you have in this answer, starting with 1. Option one (no slashes, etc.), it does not work in ReText or GitHub for the part of 2. Option two, because that happens to be the last item of the list. The next line, ` Second paragraph` shows up as a totally new paragraph outside of any list item, indented all the way to the left, even if I copy/paste your exact Markdown code for it. It render correctly here at SO pages, but not in separate Markdown apps or in a GitHub document. – ely Sep 13 '17 at 16:52
9

Like this:

  1. first half

    second half
  2. second item

Markdown:

1. first half<br/><br/>second half
1. second item
  • 7
    Or you could just use the normal paragraph syntax inside the list, rather than ugly line-break elements. – animuson Aug 12 '13 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 Aug 12 '13 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- Aug 12 '13 at 15:50
  • @Servy: Exactly; you have to indent the paragraphs for it to work - that's just how Markdown was designed. – BoltClock's a Unicorn Aug 12 '13 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 Aug 12 '13 at 15:53
7

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

2

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
0

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

</> 
<before and after empty rows
<splash or and any letter/s with symbols but HTML-tags and
<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

You must log in to answer this question.

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