trentm / python-markdown2

markdown2: A fast and complete implementation of Markdown in Python
Other
2.66k stars 433 forks source link

Lists not properly created in paragraphs #479

Closed notCamelCaseName closed 2 years ago

notCamelCaseName commented 2 years ago

Don't know if it's intended or not but i noticed that lists created with *, + and - do not work propoerly if attached to a paragraph.

For example :

This is a list
* a
* b
* c

gets compiled to <p>This is a list * a * b * c</p>

While

This is a list

* a
* b
* c

gets compiled properly to <p>This is a list</p><ul><li>a</li><li>b</li><li>c</li></ul>

Crozzers commented 2 years ago

This is intentional behaviour and can be changed using the cuddled-lists extra.

I can't find where exactly I read this but I recall the reasoning being for cases like this:

Big paragraph of text relating to this library,
the version I recommend you use is version
7. This is the latest stable version of the
library available on blah blah blah

This looks sort of like a list in the middle of a paragraph until we look at the context of the text around it. This is sort of impossible to parse without relying on mind-reading