What is meta? ×
Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 127 Stack Exchange communities.

I want to format a list with a few paragraphs between items. Unfortunately, the numbering gets restarted. I want:

 1. item1

Paragraph1...

<!-- language: lang-java -->

    Object o = new Object();

 2. item2 

Here's how it comes out:

  1. item1

Paragraph1...

Object o = new Object();
  1. item2

Not only numbering is lost, but also indentation. I know that HTML <ol></ol> to which this is formatted is not supposed for big list items, but I can't see any other way to do it, except with putting the HTML tags myself. The numbering is OK, but this destroys formatting completely:

  1. item1
  2. Paragraph1... Object o = new Object();
  3. item2

Please help.

share|improve this question
add comment

1 Answer

up vote 6 down vote accepted

You need to insert a space before Paragraph1...

  1. item1

    Paragraph1...

    Object o = new Object();
    
  2. item2


The code I'm using is a follows;

 1. item1

 Paragraph1...

    <!-- language: lang-java -->

        Object o = new Object();

 2. item2 

There's also not normally a need to set the language you're using (does SO even use this?):

 1. item1

 Paragraph1...

        Object o = new Object();

 2. item2 

Gives:

  1. item1

    Paragraph1...

    Object o = new Object();
    
  2. item2

share|improve this answer
1  
... and indent code 8 spaces instead of 4. OK, got it. Not that it's very intuitive... Thanks! –  MaDa Nov 30 '11 at 9:40
    
@MaDa: The space before the paragraph tells the parser you want it to be part of the list... otherwise you've got no way to detect whether you wanted it to be part of the list, or a paragraph between 2 lists. I'm not sure why you have to indent another 4 spaces rather than 1 for the code-in-a-list, but it's removes any confusion again. –  Matt Nov 30 '11 at 9:46
add comment

You must log in to answer this question.

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