diff options
-rw-r--r-- | markdown/preprocessors.py | 2 | ||||
-rw-r--r-- | tests/misc/blank_lines_in_codeblocks.html | 32 | ||||
-rw-r--r-- | tests/misc/blank_lines_in_codeblocks.txt | 50 |
3 files changed, 75 insertions, 9 deletions
diff --git a/markdown/preprocessors.py b/markdown/preprocessors.py index e7743fb..e968580 100644 --- a/markdown/preprocessors.py +++ b/markdown/preprocessors.py @@ -127,7 +127,7 @@ class HtmlBlockPreprocessor(Preprocessor): def run(self, lines): text = "\n".join(lines) new_blocks = [] - text = text.split("\n\n") + text = text.rsplit("\n\n") items = [] left_tag = '' right_tag = '' diff --git a/tests/misc/blank_lines_in_codeblocks.html b/tests/misc/blank_lines_in_codeblocks.html index 77da8e4..57a4c36 100644 --- a/tests/misc/blank_lines_in_codeblocks.html +++ b/tests/misc/blank_lines_in_codeblocks.html @@ -1,4 +1,34 @@ -<p>Preserve blank lines in code blocks</p> +<p>Preserve blank lines in code blocks with tabs:</p> +<pre><code>a code block + +two tabbed lines + + +three tabbed lines + + + +four tabbed lines + + + + +five tabbed lines + + + + + +six tabbed lines + + + + + + +End of tabbed block +</code></pre> +<p>And without tabs:</p> <pre><code>a code block two blank lines diff --git a/tests/misc/blank_lines_in_codeblocks.txt b/tests/misc/blank_lines_in_codeblocks.txt index f2e582a..e7ae102 100644 --- a/tests/misc/blank_lines_in_codeblocks.txt +++ b/tests/misc/blank_lines_in_codeblocks.txt @@ -1,37 +1,73 @@ -Preserve blank lines in code blocks +Preserve blank lines in code blocks with tabs: a code block - two blank lines + two tabbed lines - three blank lines + three tabbed lines - four blank lines + four tabbed lines - five blank lines + five tabbed lines - six blank lines + six tabbed lines - End of block + End of tabbed block +And without tabs: + + a code block + + two blank lines + + + three blank lines + + + + four blank lines + + + + + five blank lines + + + + + + six blank lines + + + + + + + End of block + + + + + + End of document
\ No newline at end of file |