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:
parent
3ccd64a9a1
commit
4a215f33d4
@ -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"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user