parsedown = new Parsedown(); $this->parsedown->setSafeMode(true); } public function getFilters(): array { return [ new TwigFilter('chill_markdown_to_html', [$this, 'renderMarkdownToHtml'], [ 'is_safe' => ['html'], ]), ]; } public function renderMarkdownToHtml(?string $var): string { return $this->parsedown->parse((string) $var); } }