Trim surrounding newlines and spaces from content

This commit is contained in:
RealStickman 2023-06-02 13:29:03 +00:00
parent 558523df27
commit 19b8942ab6
2 changed files with 2 additions and 4 deletions

View File

@ -8,7 +8,8 @@ class CustomPrismjs extends Shortcode
public function init()
{
$this->shortcode->getHandlers()->add('rootsh', function(ShortcodeInterface $sc) {
return '<pre class="command-line language-sh" data-prompt="#" data-continuation-str="\" tabindex="0"><code class="language-sh">'.$sc->getContent().'</code></pre>';
$content = rtrim(ltrim($sc->getContent()))
return '<pre class="command-line language-sh" data-prompt="#" data-continuation-str="\" tabindex="0"><code class="language-sh">'.$content.'</code></pre>';
});
}
}

View File

@ -1,3 +0,0 @@
<?php
include('CustomPrismjs.php');
?>