diff --git a/Parsedown.php b/Parsedown.php index b5a0382..0a1bee5 100644 --- a/Parsedown.php +++ b/Parsedown.php @@ -182,7 +182,9 @@ class Parsedown { if (isset($CurrentBlock)) { - $CurrentBlock['interrupted'] = true; + $CurrentBlock['interrupted'] = (isset($CurrentBlock['interrupted']) + ? $CurrentBlock['interrupted'] + 1 : 1 + ); } continue; @@ -388,7 +390,7 @@ class Parsedown { if (isset($Block['interrupted'])) { - $Block['element']['element']['text'] .= "\n"; + $Block['element']['element']['text'] .= str_repeat("\n", $Block['interrupted']); unset($Block['interrupted']); } @@ -500,7 +502,7 @@ class Parsedown if (isset($Block['interrupted'])) { - $Block['element']['element']['text'] .= "\n"; + $Block['element']['element']['text'] .= str_repeat("\n", $Block['interrupted']); unset($Block['interrupted']); } diff --git a/test/data/code_block.html b/test/data/code_block.html index 889b02d..a186e9a 100644 --- a/test/data/code_block.html +++ b/test/data/code_block.html @@ -5,4 +5,9 @@ echo $message;
> not a quote
- not a list item
-[not a reference]: http://foo.com
\ No newline at end of file
+[not a reference]: http://foo.com
+foo
+
+
+bar
\ No newline at end of file
diff --git a/test/data/code_block.md b/test/data/code_block.md
index 2cfc953..badf873 100644
--- a/test/data/code_block.md
+++ b/test/data/code_block.md
@@ -7,4 +7,11 @@
> not a quote
- not a list item
- [not a reference]: http://foo.com
\ No newline at end of file
+ [not a reference]: http://foo.com
+
+---
+
+ foo
+
+
+ bar
\ No newline at end of file
diff --git a/test/data/fenced_code_block.html b/test/data/fenced_code_block.html
index 78480fd..50d39df 100644
--- a/test/data/fenced_code_block.html
+++ b/test/data/fenced_code_block.html
@@ -11,4 +11,8 @@ echo "Hello World";
<a href="http://auraphp.com" >Aura Project</a>
the following isn't quite enough to close
```
-still a fenced code block
\ No newline at end of file
+still a fenced code block
+foo
+
+
+bar
\ No newline at end of file
diff --git a/test/data/fenced_code_block.md b/test/data/fenced_code_block.md
index 35acb75..3e4155a 100644
--- a/test/data/fenced_code_block.md
+++ b/test/data/fenced_code_block.md
@@ -28,4 +28,11 @@ echo "Hello World";
the following isn't quite enough to close
```
still a fenced code block
-````
\ No newline at end of file
+````
+
+```
+foo
+
+
+bar
+```
\ No newline at end of file