File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed
Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -181,11 +181,15 @@ def handle_endtag(self, tag):
181181
182182 # Add a newline to tail if it is not just a trailing newline
183183 if tail != '\n ' :
184- tail = '\n ' + tail
184+ tail = '\n ' + tail .rstrip ('\n ' )
185+
186+ # Ensure there is an empty new line between blocks
187+ if not text .endswith ('\n \n ' ):
188+ text = text .rstrip ('\n ' ) + '\n \n '
185189
186190 # Process the block nested under the span appropriately
187191 if state in ('span' , 'block' ):
188- current .text = f'{ text } \n { self .md .htmlStash .store (child )} { tail } '
192+ current .text = f'{ text } { self .md .htmlStash .store (child )} { tail } '
189193 last .append (child )
190194 else :
191195 # Non-Markdown HTML will not be recursively parsed for Markdown,
@@ -194,7 +198,7 @@ def handle_endtag(self, tag):
194198 # processing.
195199 child .attrib .pop ('markdown' )
196200 [c .attrib .pop ('markdown' , None ) for c in child .iter ()]
197- current .text = f'{ text } \n { self .md .htmlStash .store (child )} { tail } '
201+ current .text = f'{ text } { self .md .htmlStash .store (child )} { tail } '
198202 # Target the child elements that have been expanded.
199203 current = last .pop (0 ) if last else None
200204
You can’t perform that action at this time.
0 commit comments