12

My text contains a few item list and a code block, but I am really crazy when formatting the code, each time I try to format it, it was align to the item list, my work around was put an dot(.) between the list and the code block, any good way?

original text:

first line

seconds line

third line

int main(void) { return 0; }

first, I click the numbered list button to format the first 3 lines, I got the following result:

  1. first line seconds line third line

Then I manually separated the 2nd and 3rd lines to make it like this

  1. first line
  2. seconds line
  3. third line

From here, I tried lots of way to format the code, I always got this

  1. first line
  2. seconds line
  3. third line

    int main(void) { return 0; }

Finally, I put a dot between the list and the code block, too ugly, but works.

  1. first line
  2. seconds line
  3. third line

.

int main(void) 
{
   return 0; 
}
7
  • FYI If you want the line but not the dot you can use <br> but Mat's solution avoids the newline altogether (which is likely what you want Commented Apr 25, 2014 at 10:10
  • This question is not Stack Overflow specific and already have an answer in here
    – Mp0int
    Commented Apr 25, 2014 at 12:13
  • 2
    @FallenAngel: So? This is still an issue Stack Overflow users will come across. Meta.SE is a different site, the central government of all Stack Exchange sites. Asking questions like these here is fine; this is the local government, we can proxy for the central site just fine. Commented Apr 25, 2014 at 13:59
  • @MartijnPieters So, this is a duplicate. The very same question in both Main Meta and SO Meta. It sounds better to me to have this question in Main and close this as duplicate since this is a general issue. Having the same question on separate Meta Sites is not good if it is a general one.
    – Mp0int
    Commented Apr 25, 2014 at 15:01
  • @FallenAngel: No, really, that's fine. The alternative is that we send people over in droves as everything here is closed as OT, again and again and again. and Stack Overflow does have unique tweaks to the software that other sites don't have, so answers here can and do differ. Commented Apr 25, 2014 at 15:04
  • 1
    @FallenAngel: also see Users Can Report Bugs On Whatever Child Meta Site Suits Them and Meta hasn't changed at all Commented Apr 25, 2014 at 15:05
  • @MartijnPieters Ahhh I see. I missed those topics. Close vote retracted (:
    – Mp0int
    Commented Apr 25, 2014 at 15:10

1 Answer 1

20
  1. first line

    // code for the first item, indented with 8 spaces
    
  2. second line

    // code for the second item
    
  3. third line

    // code for the third item
    
//code not in the list
int main(void) 
{
   return 0; 
}

To avoid your empty line with a ., use a <!-- --> comment thingy.

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