1
0
mirror of https://github.com/erusev/parsedown.git synced 2025-09-03 03:42:38 +02:00

Merge pull request #610 from aidantwoods/fix/lost-line-breaks

Fix lost line breaks
This commit is contained in:
Aidan Woods
2018-04-09 14:19:38 +01:00
committed by GitHub
5 changed files with 32 additions and 7 deletions

View File

@@ -182,7 +182,9 @@ class Parsedown
{ {
if (isset($CurrentBlock)) if (isset($CurrentBlock))
{ {
$CurrentBlock['interrupted'] = true; $CurrentBlock['interrupted'] = (isset($CurrentBlock['interrupted'])
? $CurrentBlock['interrupted'] + 1 : 1
);
} }
continue; continue;
@@ -388,7 +390,7 @@ class Parsedown
{ {
if (isset($Block['interrupted'])) if (isset($Block['interrupted']))
{ {
$Block['element']['element']['text'] .= "\n"; $Block['element']['element']['text'] .= str_repeat("\n", $Block['interrupted']);
unset($Block['interrupted']); unset($Block['interrupted']);
} }
@@ -500,7 +502,7 @@ class Parsedown
if (isset($Block['interrupted'])) if (isset($Block['interrupted']))
{ {
$Block['element']['element']['text'] .= "\n"; $Block['element']['element']['text'] .= str_repeat("\n", $Block['interrupted']);
unset($Block['interrupted']); unset($Block['interrupted']);
} }

View File

@@ -5,4 +5,9 @@ echo $message;</code></pre>
<hr /> <hr />
<pre><code>&gt; not a quote <pre><code>&gt; not a quote
- not a list item - not a list item
[not a reference]: http://foo.com</code></pre> [not a reference]: http://foo.com</code></pre>
<hr />
<pre><code>foo
bar</code></pre>

View File

@@ -7,4 +7,11 @@
> not a quote > not a quote
- not a list item - not a list item
[not a reference]: http://foo.com [not a reference]: http://foo.com
---
foo
bar

View File

@@ -11,4 +11,8 @@ echo "Hello World";
&lt;a href="http://auraphp.com" &gt;Aura Project&lt;/a&gt;</code></pre> &lt;a href="http://auraphp.com" &gt;Aura Project&lt;/a&gt;</code></pre>
<pre><code>the following isn't quite enough to close <pre><code>the following isn't quite enough to close
``` ```
still a fenced code block</code></pre> still a fenced code block</code></pre>
<pre><code>foo
bar</code></pre>

View File

@@ -28,4 +28,11 @@ echo "Hello World";
the following isn't quite enough to close the following isn't quite enough to close
``` ```
still a fenced code block still a fenced code block
```` ````
```
foo
bar
```