Twig/Symfony "markdown_to_html" 找不到 **debug:translation** 过滤器

Twig/Symfony "markdown_to_html" filter not found for **debug:translation**

即使没有任何模板和翻译文件也会出现此错误。

Symfony 4.4.0(环境:开发,调试:真)

没有其他调试命令以这种方式失败,因此此错误必须与模板相关。

实际上没有找到过滤器

为什么?

website@2ec9200e4614:~$ console -vvvv debug:transl en

In content_markdown.html.twig line 1:

  [Twig\Error\SyntaxError]            
  Unknown "markdown_to_html" filter.  

Exception trace:
  at /var/lib/website/vendor/symfony/twig-bridge/Resources/views/Email/zurb_2/notification/content_markdown.html.twig:1
 ...
 Symfony\Bridge\Twig\Translation\TwigExtractor->extractTemplate() at /var/lib/website/vendor/symfony/twig-bridge/Translation/TwigExtractor.php:59
 ...
 Symfony\Component\Console\Application->run() at /var/lib/website/bin/console:39

debug:translation [--domain [DOMAIN]] [--only-missing] [--only-unused] [--all] [-h|--help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interaction] [-e|--env ENV] [--no-debug] [--] <command> <locale> [<bundle>]

我相信这是 Symfony 4.4.0 和 5.0 中的一个错误,我刚才也遇到过;有关详细信息,请参阅我的问题报告: https://github.com/symfony/symfony/issues/34618

[编辑] 这里是关于这个问题的较旧问题,因为较早的问题是骗人的。 https://github.com/symfony/symfony/issues/34586

您可以通过将必要的可选 Twig 过滤器和捆绑包添加到您的项目来解决此问题,如下所示: composer require twig/extra-bundle twig/markdown-extra twig/inky-extra twig/cssinliner-extra

我不确定为什么这会立即收到反对票,但也许在标题中包含您的 Symfony 版本或者 body 下次会有所帮助。祝你好运!