Allow $markdown = null in 'markdown' Twig filter

This commit is contained in:
Daniel Rudolf 2023-01-05 22:17:37 +01:00
parent 35d894ec1a
commit 311e21bcf3
No known key found for this signature in database
GPG key ID: A061F02CD8DE4538

View file

@ -115,15 +115,15 @@ class PicoTwigExtension extends AbstractTwigExtension
* @see Pico::substituteFileContent()
* @see Pico::parseFileContent()
*
* @param string $markdown markdown to parse
* @param string|null $markdown markdown to parse
* @param array $meta meta data to use for %meta.*% replacement
* @param bool $singleLine whether to parse just a single line of markup
* @param bool $singleLine whether to parse a single line of markup
*
* @return string parsed HTML
*/
public function markdownFilter(string $markdown, array $meta = [], bool $singleLine = false): string
public function markdownFilter(?string $markdown, array $meta = [], bool $singleLine = false): string
{
$markdown = $this->getPico()->substituteFileContent($markdown, $meta);
$markdown = $this->getPico()->substituteFileContent($markdown ?? '', $meta);
return $this->getPico()->parseFileContent($markdown, $singleLine);
}