Remove newline-only textnodes outside <pre>

This commit is contained in:
Rémi
2019-11-20 10:37:39 +01:00
parent 89d14f4487
commit 146104b41f

View File

@@ -59,6 +59,11 @@ class MarkdownConverter(object):
def process_tag(self, node, children_only=False):
text = ''
# Clean newline-only textnodes outside <pre>
for el in node.children:
if node.name != 'pre' and isinstance(el, NavigableString) and six.text_type(el) == '\n':
el.extract()
# Convert the children first
for el in node.children:
if isinstance(el, NavigableString):