From bc3c1544c57b371f85e4dae51da4919df3248229 Mon Sep 17 00:00:00 2001 From: Aidan Woods Date: Sat, 26 Jan 2019 20:38:06 +0000 Subject: [PATCH] Don't special case invisible If something has no html, it doesn't need to have a newline --- src/Parsedown.php | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/Parsedown.php b/src/Parsedown.php index 3890188..679376a 100644 --- a/src/Parsedown.php +++ b/src/Parsedown.php @@ -12,7 +12,6 @@ use Erusev\Parsedown\Components\StateUpdatingBlock; use Erusev\Parsedown\Configurables\BlockTypes; use Erusev\Parsedown\Configurables\InlineTypes; use Erusev\Parsedown\Html\Renderable; -use Erusev\Parsedown\Html\Renderables\Invisible; use Erusev\Parsedown\Html\Renderables\Text; use Erusev\Parsedown\Parsing\Context; use Erusev\Parsedown\Parsing\Excerpt; @@ -244,11 +243,9 @@ final class Parsedown * @return string */ function ($html, Renderable $Renderable) { - return ( - $html - . ($Renderable instanceof Invisible ? '' : "\n") - . $Renderable->getHtml() - ); + $newHtml = $Renderable->getHtml(); + + return $html . ($newHtml === '' ? '' : "\n") . $newHtml; }, '' );