Baguette
Baguette

Reputation: 25

Markdown custom numbered list

I do have a quick question about Markdown numbered list.

Basically, I am looking to write something like:

1) Idea 1
2) Idea 2

''' Some txt '''

3) Idea 3
4) Idea 4

''' Or some other text '''

3) Other Idea 3
4) Other Idea 4 

I found that 4 space before the two texts allows the numbers to continue, however, I can't find a way to restart the list to the point 3) a second time.

If anyone has already faced this issue I'd be glad to hear about the solution. I am working on PyCharm and it's a .md that is readable easily on GitHub.

Upvotes: 0

Views: 1834

Answers (1)

Chris
Chris

Reputation: 137034

I found that 4 space before the two texts allows the numbers to continue

Not exactly.

Four spaces before the two text lines makes that text part of the preceding list element:

1. Idea 1
2. Idea 2

    Idea 2, continued.

Since the list is still open, another list item continues numbering automatically.

However, if your text isn't really a continuation of Idea 2 it probably should not be indented.

In Markdown, lists are automatically renumbered. I usually write

1. Foo
1. Bar

so I don't have to worry about fixing numbers if I want to add something to the list. Markdown will render it as

  1. Foo
  2. Bar

However, GitHub Flavored Markdown, CommonMark, and others commonly do respect the first number in a list. Let's see what happens here:

5. Foo
1. Bar

This becomes

  1. Foo
  2. Bar

where the 5. is taken from my explicit numbering and the 6. continues from that point, even though I used 1. in the source.

I don't know if this will work in PyCharm, but for GitHub your example should work almost out of the box:

1. Idea 1
2. Idea 2

''' Some txt '''

3. Idea 3
4. Idea 4

''' Or some other text '''

3. Other Idea 3
4. Other Idea 4 

I just changed the 1) format to 1. The 2. and the two 4.s can be any number, but the 1., and the two 3.s indicate the number each list should start on.

Upvotes: 1

Related Questions