mirror of
https://github.com/retailcrm/NelmioApiDocBundle.git
synced 2025-04-09 12:12:10 +00:00
Compare commits
No commits in common. "master" and "3.0.0" have entirely different histories.
1 changed files with 5 additions and 6 deletions
|
@ -4,30 +4,29 @@ namespace Nelmio\ApiDocBundle\Twig\Extension;
|
||||||
|
|
||||||
use Michelf\MarkdownExtra;
|
use Michelf\MarkdownExtra;
|
||||||
use Twig\Extension\AbstractExtension;
|
use Twig\Extension\AbstractExtension;
|
||||||
use Twig\TwigFilter;
|
|
||||||
|
|
||||||
class MarkdownExtension extends AbstractExtension
|
class MarkdownExtension extends AbstractExtension
|
||||||
{
|
{
|
||||||
private MarkdownExtra $markdownParser;
|
protected $markdownParser;
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->markdownParser = new MarkdownExtra();
|
$this->markdownParser = new MarkdownExtra();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getFilters(): array
|
public function getFilters()
|
||||||
{
|
{
|
||||||
return [
|
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';
|
return 'nelmio_api_doc';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function markdown($text): string
|
public function markdown($text)
|
||||||
{
|
{
|
||||||
return $this->markdownParser->transform($text);
|
return $this->markdownParser->transform($text);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue