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

Adjustments to rendering spacing

This commit is contained in:
Aidan Woods 2019-01-20 02:16:40 +00:00
parent a971e5aa54
commit 00835c5101
No known key found for this signature in database
GPG Key ID: 9A6A8EFAA512BBB9

View File

@ -193,15 +193,29 @@ final class Element implements Renderable
if ($this->Contents !== null) {
$html .= '>';
if (! empty($this->Contents)) {
$html .= "\n";
$First = \reset($this->Contents);
if (
$First instanceof Element
&& ! \array_key_exists(\strtolower($First->name()), self::TEXT_LEVEL_ELEMENTS)
) {
$html .= "\n";
}
if (! empty($this->Contents)) {
foreach ($this->Contents as $C) {
$html .= $C->getHtml();
if (
$C instanceof Element
&& ! \array_key_exists(\strtolower($C->name()), self::TEXT_LEVEL_ELEMENTS)
) {
$html .= "\n";
}
}
}
$html .= "</" . $elementName . ">\n";
$html .= "</" . $elementName . ">";
} else {
$html .= ' />';
}