Allow $markdown = null in 'markdown' Twig filter

pico-3.0
Daniel Rudolf 2 years ago
parent 35d894ec1a
commit 311e21bcf3
No known key found for this signature in database
GPG Key ID: A061F02CD8DE4538
  1. 10
      lib/PicoTwigExtension.php

@ -115,15 +115,15 @@ class PicoTwigExtension extends AbstractTwigExtension
* @see Pico::substituteFileContent()
* @see Pico::parseFileContent()
*
* @param string $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 string|null $markdown markdown to parse
* @param array $meta meta data to use for %meta.*% replacement
* @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);
}

Loading…
Cancel
Save