If an <ol> or <ul> element follows another element on the same line, and there is a space before it:
from markdownify import markdownify as md
html = """
<p>Follow these steps:</p> <ol>
<li><p>Do this.</p></li>
<li><p>Do that.</p></li>
</ol>"""
print(md(html))
then that space incorrectly indents the first list item:
Follow these steps:
1. Do this.
2. Do that.
As a workaround, we preprocess our Beautiful Soup object as follows:
for n in node_markdown.find_all(["ol", "ul"]):
n.insert_before("\n")
If an
<ol>
or<ul>
element follows another element on the same line, and there is a space before it:then that space incorrectly indents the first list item:
As a workaround, we preprocess our Beautiful Soup object as follows: