Markdown can be "too aware" sometimes. When you typed 1.
, the parser automatically treated the current line as a list. If there's a list going on the line above, a new line starting with at least one space will make it part of that list:
1. This is a list.
I'm not part of the list.
1. This is another list.
Now I'm part of the list.
which will render as:
- This is a list.
I'm not part of the list.
This is another list.
Now I'm part of the list.
A workaround to insert code after a list is (based on Stefan's answer to Why do code snippets not work after lists?) to add an HTML comment right after the list:
1. This is a list.
I'm part of the list.
\begin{env} < This code syntax wont work.
2. I'm another list.
<!-- Hidden message here! -->
\begin{env}
Hello
\end{env}
This is a list.
I'm part of the list.
\begin{env} < This code syntax wont work.
I'm another list.
\begin{env}
Hello
\end{env}
In order to insert a code block in a list, we need to add eight spaces instead of the usual four:
1. I'm a list.
\begin{env}
Hello
\end{env}
which will be rendered as:
I'm a list.
\begin{env}
Hello
\end{env}
In meta.SO, there's a thread about it: Code block is not properly formatted when placed immediately after a list item. The syntax is quite annoying, but it seems it's unfixable. :(