addHelperFunction('ellipsis', function ($string, $maxLength, $ellipsis = '...') {
return StringHelper::ellipsis($string, $maxLength, $ellipsis);
});
$this->addHelperFunction('nl2br', function ($string) {
return nl2br(str_replace(array('\r\n', '\r', '\n'), '
', $string), false);
});
$this->addHelperFunction('markdown', function ($content, $containerAttribs = null) {
if (! isset($containerAttribs['class'])) {
$containerAttribs['class'] = 'markdown';
} else {
$containerAttribs['class'] .= ' markdown';
}
return 'propertiesToString($containerAttribs) . '>' . Markdown::text($content) . '';
});
$this->addHelperFunction('markdownLine', function ($content, $containerAttribs = null) {
if (! isset($containerAttribs['class'])) {
$containerAttribs['class'] = 'markdown inline';
} else {
$containerAttribs['class'] .= ' markdown inline';
}
return 'propertiesToString($containerAttribs) . '>' .
Markdown::line($content) . '';
});