diff --git a/markdown/extensions/md_in_html.py b/markdown/extensions/md_in_html.py index d3e18509..480700eb 100644 --- a/markdown/extensions/md_in_html.py +++ b/markdown/extensions/md_in_html.py @@ -174,8 +174,8 @@ def handle_endtag(self, tag): while current is not None: for child in list(current): current.remove(child) - text = current.text if current.text is not None else '' - tail = child.tail if child.tail is not None else '' + text = current.text if current.text is not None else '' + tail = child.tail if child.tail is not None else '' child.tail = None state = child.attrib.get('markdown', 'off') @@ -183,7 +183,7 @@ def handle_endtag(self, tag): if tail == '\n': tail = '' - # Process the block nested under the spac appropriately + # Process the block nested under the span appropriately if state in ('span', 'block'): current.text = text + '\n' + self.md.htmlStash.store(child) + '\n' + tail last.append(child) @@ -339,7 +339,7 @@ def parse_element_content(self, element: etree.Element) -> None: if child is None: element.text = block[start:end] else: - child.tail = (child.tail if child.tail is not None else '')+ block[start:end] + child.tail = (child.tail if child.tail is not None else '') + block[start:end] start = end # Insert anything left after last element