diff --git a/Parsedown.php b/Parsedown.php index 3366288..c60d565 100755 --- a/Parsedown.php +++ b/Parsedown.php @@ -216,7 +216,12 @@ class Parsedown { if ($element['type'] === 'code') { - isset($element['interrupted']) and $element['text'] .= "\n"; + if (isset($element['interrupted'])) + { + $element['text'] .= "\n"; + + unset ($element['interrupted']); + } $element['text'] .= "\n".$matches[1]; } diff --git a/tests/data/code_block.html b/tests/data/code_block.html index 37b7660..8ced802 100644 --- a/tests/data/code_block.html +++ b/tests/data/code_block.html @@ -1,9 +1,8 @@ -
Here's a regular code block:
-<?php
-
-echo 'Hello World!';
-
-?>
-Here's one that holds a list:
-- list item
+Here's a code block:
+<?php
+
+$message = 'Hello World!';
+echo $message;
+Here's one that holds a list:
+- list item
- another list item
\ No newline at end of file
diff --git a/tests/data/code_block.md b/tests/data/code_block.md
index bfa4904..324b86a 100644
--- a/tests/data/code_block.md
+++ b/tests/data/code_block.md
@@ -1,13 +1,12 @@
-Here's a regular code block:
-
-
-
-Here's one that holds a list:
-
- - list item
- - another list item
-
+Here's a code block:
+
+