Consider the following piece of Markdown code:
This is some regular text.
>>> def factorial(n):
... return 1 if n < 2 else n * factorial(n - 1)
...
* This is a list item.
>>> def factorial(n):
... return 1 if n < 2 else n * factorial(n - 1)
...
Notice that the second code block is preceded by a list item.
Why is the factorial code not properly formatted under these circumstances? To demonstrate the problem, I'll insert the Markdown code show above:
This is some regular text.
>>> def factorial(n):
... return 1 if n < 2 else n * factorial(n - 1)
...
This is a list item
def factorial(n): ... return 1 if n < 2 else n * factorial(n - 1) ...
This applies to numbered as well as unnumbered lists.