|
@@ -2,28 +2,15 @@
|
|
|
|
|
|
namespace App\Twig;
|
|
|
|
|
|
-use App\Service\MarkdownParser;
|
|
|
use Twig\Extension\AbstractExtension;
|
|
|
use Twig\TwigFilter;
|
|
|
|
|
|
class MarkdownExtension extends AbstractExtension
|
|
|
{
|
|
|
- public function __construct(
|
|
|
- protected readonly MarkdownParser $markdownParser
|
|
|
- )
|
|
|
-
|
|
|
- {
|
|
|
-
|
|
|
- }
|
|
|
public function getFilters()
|
|
|
{
|
|
|
return [
|
|
|
- new TwigFilter('markdown', [$this, 'parse'], ['is_safe' => ['html']])
|
|
|
+ new TwigFilter('markdown', [AppRuntimeExtension::class, 'parse'], ['is_safe' => ['html']])
|
|
|
];
|
|
|
- }
|
|
|
-
|
|
|
- public function parse(string $content): string
|
|
|
- {
|
|
|
- return $this->markdownParser->convertToHtml($content);
|
|
|
- }
|
|
|
+ }
|
|
|
}
|