aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--markdown/__init__.py1
-rw-r--r--tests/misc/blank_lines_in_codeblocks.html31
-rw-r--r--tests/misc/blank_lines_in_codeblocks.txt37
3 files changed, 68 insertions, 1 deletions
diff --git a/markdown/__init__.py b/markdown/__init__.py
index fbd2879..be45a8b 100644
--- a/markdown/__init__.py
+++ b/markdown/__init__.py
@@ -284,7 +284,6 @@ class Markdown:
source = source.replace(util.STX, "").replace(util.ETX, "")
source = source.replace("\r\n", "\n").replace("\r", "\n") + "\n\n"
source = source.expandtabs(self.tab_length)
- source = re.sub(r'\n +\n', '\n\n', source)
# Split into lines and run the line preprocessors.
self.lines = source.split("\n")
diff --git a/tests/misc/blank_lines_in_codeblocks.html b/tests/misc/blank_lines_in_codeblocks.html
new file mode 100644
index 0000000..77da8e4
--- /dev/null
+++ b/tests/misc/blank_lines_in_codeblocks.html
@@ -0,0 +1,31 @@
+<p>Preserve blank lines in code blocks</p>
+<pre><code>a code block
+
+two blank lines
+
+
+three blank lines
+
+
+
+four blank lines
+
+
+
+
+five blank lines
+
+
+
+
+
+six blank lines
+
+
+
+
+
+
+End of block
+</code></pre>
+<p>End of document</p> \ No newline at end of file
diff --git a/tests/misc/blank_lines_in_codeblocks.txt b/tests/misc/blank_lines_in_codeblocks.txt
new file mode 100644
index 0000000..f2e582a
--- /dev/null
+++ b/tests/misc/blank_lines_in_codeblocks.txt
@@ -0,0 +1,37 @@
+Preserve blank lines in code blocks
+
+ 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