diff --git a/markdown/preprocessors.py b/markdown/preprocessors.py index 4a1fac5f6..ed11c3903 100644 --- a/markdown/preprocessors.py +++ b/markdown/preprocessors.py @@ -174,9 +174,10 @@ 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 placeholder = self.markdown.htmlStash.store('\n\n'.join( - items[i:right_listindex + 1])) - del items[i:right_listindex + 1] + items[i:right_listindex + offset])) + del items[i:right_listindex + offset] items.insert(i, placeholder) return items diff --git a/tests/extensions/extra/raw-html.html b/tests/extensions/extra/raw-html.html index f8874c388..7acb2eeb7 100644 --- a/tests/extensions/extra/raw-html.html +++ b/tests/extensions/extra/raw-html.html @@ -27,11 +27,18 @@ Raw html blocks may also be nested. - -
This text is after the markdown in html.
1 2
-Markdown is active here.
+Markdown is still active here.
+Markdown is active again here.
\ No newline at end of file diff --git a/tests/extensions/extra/raw-html.txt b/tests/extensions/extra/raw-html.txt index 0a82ccf70..72f530b99 100644 --- a/tests/extensions/extra/raw-html.txt +++ b/tests/extensions/extra/raw-html.txt @@ -51,3 +51,17 @@ This text is after the markdown in html. 2 + +