code blocks get unwanted empty lines

This commit is contained in:
Emanuil Rusev 2013-11-05 10:21:48 +02:00
parent ecf86b073e
commit 7249d02cff
3 changed files with 25 additions and 22 deletions

View File

@ -216,7 +216,12 @@ class Parsedown
{ {
if ($element['type'] === 'code') 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]; $element['text'] .= "\n".$matches[1];
} }

View File

@ -1,9 +1,8 @@
<p>Here's a regular code block:</p> <p>Here's a code block:</p>
<pre><code>&lt;?php <pre><code>&lt;?php
echo 'Hello World!'; $message = 'Hello World!';
echo $message;</code></pre>
?&gt;</code></pre> <p>Here's one that holds a list:</p>
<p>Here's one that holds a list:</p> <pre><code>- list item
<pre><code>- list item
- another list item</code></pre> - another list item</code></pre>

View File

@ -1,13 +1,12 @@
Here's a regular code block: Here's a code block:
<?php <?php
echo 'Hello World!'; $message = 'Hello World!';
echo $message;
?>
Here's one that holds a list:
Here's one that holds a list:
- list item
- list item - another list item
- another list item