matthewwithanm/python-markdownify

Whitespace between comments is no longer removed

Opened this issue · 0 comments

In #184, processing was updated to be non-destructive. A side effect of this code change is that whitespace between comments is no longer removed:

import markdownify

md = markdownify.MarkdownConverter().convert

md("""
<p>line 1</p>
<!-- comment -->
<!-- comment -->
<!-- comment -->
<!-- comment -->
<p>line 2</p>""")
# 'line 1\n\n\n\n\n\nline 2'

This occurs because the code that conditionally omits whitespace looks at the adjacent siblings on both sides to check if they are block elements. Because comments are no longer deleted, this check sees comments instead of block elements.