# A codeblock after a list doesn't render correctly

Perhaps this is a known issue. You can't put a codeblock directly after a list, even separated with line breaks. It came up in this question, where I finally just added a colon between the list and codeblock so that it would look right.

Here's a list:

1. First line
2. Second line

This should be a code block, check the markdown!

(there needs to be at least one normal character in this line, or the next codeblock won't render either. Line breaks don't do it)

This is also a codeblock


Edit:

I see that this has been discussed on meta.stackexchange.com; here and here are two examples. I don't see anything indicating that this behaviour will change.

But there are some good workarounds in those answers. My preference is to use

<b></b>


or a blank html comment

<!-- -->


as a separator.

• Interesting - have you seen if this has been reported on meta.stackexchange.com ?
– W5VO
Mar 2 '17 at 15:34
• No, I haven't looked, sorry. It'll be about an hour before I can search around :) Mar 2 '17 at 15:36
• Sometimes it's useful to put a horizontal rule (a line with just --- on it in Markdown) right before a code block, as a separator. Mar 2 '17 at 17:19
• @W5VO It turns out that is has been discussed on meta.stackexchange.com. I've included info in my post and also removed the [bug] tag. Thanks! Mar 2 '17 at 17:34
• Thanks, @DaveTweed. I was editing my question as you posted your answer. I like the horizontal rule solution, and there were additional workarounds that I mentioned in my edit. Take care! Mar 2 '17 at 17:36

I think the issue is that Markdown considers any indented line to be part of the previous list item; this is a feature, not a bug. It gets indented to match the list indentation, but it doesn't get rendered in code font. A horizontal rule can fix this, and probably looks better than other options:

1. List item

Second paragraph for list item #1

2. List item

Second paragraph of list item #2

Code block


In Markdown, the horizontal rule is a blank line followed by a line containing just ---.

Nested lists:

• Top item A

1. 2nd-level item
2. 2nd-level item

text for 2nd level requires 5 spaces of indentation

more text for 1st level

• Top item B

In any case, it's definitely quirky!