# Markdown of code blocks still doesn't work after numbered lists? [duplicate]

Possible Duplicate:
Why do code snippets not work after lists?

When a code block is directly after a list (bullet, or numbered) it doesn't work unless you have 8 spaces:

• bullet

FUNCTION {emphasize} { duplicate$empty$ { pop$"" } { "{\em " swap$ * "}" * } if$} • bullet FUNCTION {emphasize} { duplicate$ empty${ pop$ "" }
{ "{\em " swap$* "}" * } if$
}


The problem is that the {} button is blissfully unaware of this, so if I mark a block of code and press {} it indents the code by 4 spaces (which is not enough if it's after a list item) and if I press it again (as one might hope would work) the indent is removed. For a large block of code it can be quite painful to have to add all these spaces manually. Notice that if you have a nested list item, you'll need 12 spaces!

I hope that either the bug in the markdown can be fixed, or an alternative functionality can be added to make adding all these spaces less painful.

I'll put one such idea as an "answer" so it can be voted on separately..

## marked as duplicate by balphaNov 14 '11 at 7:54

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

• – Martin Scharrer Nov 11 '11 at 8:22
• So this is what almost drove me crazy once; I finally gave up trying to properly format some code block after a list, and asked in chat for help. Thank you for this. – Gonzalo Medina Nov 11 '11 at 16:56
• Yep have had this problem many times, so followign lists, I just add a new line with 'Here is the MWE:' which then works fine. – Peter Grill Nov 11 '11 at 19:17
• THis is indeed a well known "feature" which begs the question: "why doesn't the {} button support it?" – Yossi Farjoun Nov 12 '11 at 4:13

## 2 Answers

We could have a {+} button to add spaces (4 at a time), and a {-} button to remove them.

For code following a list you don't need to indent all lines by additional four spaces, if you insert a HTML comment. Have a look at the source code of this answer.

• bullet
FUNCTION {emphasize}
{ duplicate$empty$
{ pop$"" } { "{\em " swap$ * "}" * }
if\$
}

• I think that this only works if the code isn't part of the list. Yossi's solution would make it easier to have code blocks inside lists. (I haven't tested these, though, so I may be wrong.) – Loop Space Nov 11 '11 at 8:07