1
0
mirror of https://github.com/erusev/parsedown.git synced 2023-08-10 21:13:06 +03:00

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