Closed nemecek-filip closed 6 months ago
Python Markdown normally requires blocks to have new lines before them. While occasionally, some blocks may work without this, it is generally recommended to use them before new blocks so they are not included in the block prior.
Do you think I could just add the new line with regex to the Markdown content before turning it into HTML with this package? Wouldn't this perhaps invite more problems?
Our behavior matches the behavior of the reference implementation. Therefore, it is markdown2 which has the behavior wrong. And for good reason. Consider this paragraph:
A sentence which makes mention of the year
2024. A year which has just gotten underway.
Clearly that should all be a single paragraph. It would be inappropriate to trigger a list just because the line wrapping happens to create what might look like a list item. The point is that Markdown can't tell the difference, so you should be required to insert a blank line if both lines are not part of the same paragraph.
If you want to go through your documents and automate the insertion of blank lines, you can. But how can you be certain you aren't splitting up a paragraph? I suppose because it would have been rendered that way to begin with it would at least be consistent.
In any event, I am closing this as wontfix.
Hello,
in my Django project I am using the other markdown package - I chose it back in 2021 without much thought. Currently I am working on migration to this one, but I have quite a lot of users' Markdown and these packages behave slightly differently when it comes to lists.
For example this:
or:
Does not render as a paragraph followed by list element. I also tried the "sane lists" extension. Unfortunately the
markdown2
renders this correctly so I am looking for ways how to fix this in more elegant ways than giving my users opt-in upgrade path with instructions to re-check their rendered content.Is there perhaps some extension or settings I could use to get the package to parse these lists if they immediately follow paragraph without new line? Or maybe reasonably easy custom extension that I would write would help me?
Thanks, appreciate any input!