Formatting breaks if code follows a list:
- List item
List item
This is in a code block
This does not work as expected
However, it works if between the list and the code
- List item
- List item
There is a line of normal text.
This is in a code block
# This does work as expected
Edit
To make this clear: This is not about nesting code in a list but about code following a (finished) list not working as expected (by me). To put it differently: Why is a list not considered finished despite of following empty lines? What do I have to do?