Compare commits

..

No commits in common. "master" and "3.0.0" have entirely different histories.

View file

@ -4,30 +4,29 @@ namespace Nelmio\ApiDocBundle\Twig\Extension;
use Michelf\MarkdownExtra;
use Twig\Extension\AbstractExtension;
use Twig\TwigFilter;
class MarkdownExtension extends AbstractExtension
{
private MarkdownExtra $markdownParser;
protected $markdownParser;
public function __construct()
{
$this->markdownParser = new MarkdownExtra();
}
public function getFilters(): array
public function getFilters()
{
return [
new TwigFilter('extra_markdown', [$this, 'markdown'], ['is_safe' => ['html']]),
new \Twig\TwigFilter('extra_markdown', [$this, 'markdown'], ['is_safe' => ['html']]),
];
}
public function getName(): string
public function getName()
{
return 'nelmio_api_doc';
}
public function markdown($text): string
public function markdown($text)
{
return $this->markdownParser->transform($text);
}