renderer = $renderer; } /** * @return array */ public function getFilters(): array { $options = ['is_safe' => ['html']]; return [ new TwigFilter('markdown', [$this, 'render'], $options), new TwigFilter('md', [$this, 'render'], $options), ]; } /** * @param string $text * @return string */ public function render($text): string { return $this->renderer->text(htmlspecialchars($text)); } }