2

This revision involved removing some extraneous # signs and indenting some of the code.

However, I found that the code gets displayed as markdown. I selected it and hit the code block. I even tried to do it twice, with no luck.

It still gets formatted as a title.

8
  • 2
    Yes, code inside a list needs an extra 4 spaces.
    – Oded StaffMod
    Commented May 16, 2014 at 18:01
  • It's not within a list, though, is it? It's two lines down. Commented May 16, 2014 at 18:02
  • As far as the parser is concerned, it is.
    – Oded StaffMod
    Commented May 16, 2014 at 18:02
  • Isn't a double-newline in markdown supposed to signal a 'reset' of sorts in formatting? Commented May 16, 2014 at 18:03
  • @Qix No, it does not. It signals the start of a new paragraph. Numeric bullets can be multi-paragraph.
    – Servy
    Commented May 16, 2014 at 18:03
  • Doesn't quite work like that when lists come into play (as it is OK to have the next item with a double newline before hand).
    – Oded StaffMod
    Commented May 16, 2014 at 18:03
  • Huh alright, @Oded if you make that an answer I'll accept. Commented May 16, 2014 at 18:04
  • 3
    You can use <!> to 'reset' the indentation. Commented May 16, 2014 at 18:13

1 Answer 1

2

Lists do not reset after any amount of whitespacing.

Therefore, code blocks must be indented by 8 spaces instead of 4 when they follow a list element.

A workaround suggested by Dukeling shows you can reset this behavior by using <!>. Example:

  1. This is a list

This is code that immediately follows the list, indented by 4 spaces.
1
  • Writing formatting-related answers make me cringe because examples always look so ugly. Commented May 16, 2014 at 23:02

You must log in to answer this question.

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