Trim in renderer

This commit is contained in:
Aidan Woods 2019-02-16 21:10:45 +00:00
parent 3ccd64a9a1
commit 4a215f33d4
No known key found for this signature in database
GPG Key ID: 9A6A8EFAA512BBB9

View File

@ -47,9 +47,6 @@ final class Parsedown
$html = self::render($Renderables); $html = self::render($Renderables);
# trim line breaks
$html = \trim($html, "\n");
return $html; return $html;
} }
@ -245,18 +242,21 @@ final class Parsedown
*/ */
public static function render(array $Renderables) public static function render(array $Renderables)
{ {
return \array_reduce( return \trim(
$Renderables, \array_reduce(
/** $Renderables,
* @param string $html /**
* @return string * @param string $html
*/ * @return string
function ($html, Renderable $Renderable) { */
$newHtml = $Renderable->getHtml(); function ($html, Renderable $Renderable) {
$newHtml = $Renderable->getHtml();
return $html . ($newHtml === '' ? '' : "\n") . $newHtml; return $html . ($newHtml === '' ? '' : "\n") . $newHtml;
}, },
'' ''
),
"\n"
); );
} }
} }