diff --git a/markdown/preprocessors.py b/markdown/preprocessors.py index 7fd38d331..7ea4fcf9f 100644 --- a/markdown/preprocessors.py +++ b/markdown/preprocessors.py @@ -178,10 +178,11 @@ def _nested_markdown_in_html(self, items): else: # raw html if len(items) - right_listindex <= 1: # last element right_listindex -= 1 - offset = 1 if i == right_listindex else 0 + if right_listindex <= i: + right_listindex = i + 1 placeholder = self.markdown.htmlStash.store('\n\n'.join( - items[i:right_listindex + offset])) - del items[i:right_listindex + offset] + items[i:right_listindex])) + del items[i:right_listindex] items.insert(i, placeholder) return items diff --git a/tests/extensions/extra/raw-html.html b/tests/extensions/extra/raw-html.html index 7acb2eeb7..9c0222f56 100644 --- a/tests/extensions/extra/raw-html.html +++ b/tests/extensions/extra/raw-html.html @@ -41,4 +41,9 @@
Markdown is still active here.
-Markdown is active again here.
\ No newline at end of file +Markdown is active again here.
+foo bar
+bar +
+