From 3f5b0ee7819a5c29f991c637de8c49e8edfa559c Mon Sep 17 00:00:00 2001 From: Aidan Woods Date: Mon, 9 Apr 2018 14:13:10 +0100 Subject: [PATCH] Count number of interrupts --- Parsedown.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) 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']); }