diff --git a/markdownify/__init__.py b/markdownify/__init__.py index 25608bf..f97bcbf 100644 --- a/markdownify/__init__.py +++ b/markdownify/__init__.py @@ -59,6 +59,11 @@ class MarkdownConverter(object): def process_tag(self, node, children_only=False): text = '' + # Clean newline-only textnodes outside
+ 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):