0

Look at my answer here: Printing multiple files from Nautilus

You'll see I have an ordered list 1-8. After the 6th item, I have a pre/code section and after that points 7 and 8. However, 7 and 8 is listed as 1 and 2. If you edit the answer, you'll see that it says 7 and 8.

Bug.

2 Answers 2

8

Fixed it for you. And no, this is not a bug, but how Markdown works.

The key thing is to indent one level further and use a 4-space indent, so make it 8 spaces to indent. See also the Markdown syntax:

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>

More tips:

  • No need to use incrementing numbers. Use 1. for every list item.
  • Also no need for <code> or <pre> blocks - we don't have that in Markdown as far as I know.

So, an example:


1. item text.

   some text below the item but under the same item.

1. next item increments numbers automatically.

1. Here's some code:

        Code block line 1
        Code block line 2

1. And here's item 4.

Renders to


  1. item text.

    some text below the item but under the same item.

  2. next item increments numbers automatically.

  3. Here's some code:

    Code block line 1
    Code block line 2
    
  4. And here's item 4.

1
  • 2
    The key here, if you don't want to break your list, indent everything that needs to be under that list.
    – Marco Ceppi Mod
    Commented Jul 14, 2013 at 17:29
-3

You can use the <pre> tag.

It IS allowed and works great as well, because as long as you indent your text it won't break the sequence in your ordered lists.

You can check all the allowed tags in the following link:

3
  • 1
    Well, I see your point, but it did break the sequence for the OP because these weren't indented.
    – gertvdijk
    Commented Jul 15, 2013 at 5:24
  • Tank you, I edited my answer accordingly. :) Commented Jul 15, 2013 at 7:02
  • Using correct markdown syntax is best. If what is being added is external (code/text/example/table/ascii) and not part of the question/answer itself, then consider using <pre> tag. Commented May 17, 2018 at 21:24

You must log in to answer this question.

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