This package is abandoned and no longer maintained. No replacement package was suggested.

Twig extension to turn Markdown formatted text into HTML

v1.0.2 2012-10-09 09:30 UTC

This package is not auto-updated.

Last update: 2020-04-05 18:57:00 UTC


Converts text with Markdown syntax into HTML in Twig templates.



  1. Add TwigMarkdowner to your dependencies

     // composer.json
         // ...
         "require": {
             // ...
             "misd/twig-markdowner": "1.0.*"
  2. Use Composer to download and install TwigMarkdowner

     $ php composer.phar update misd/twig-markdowner
  3. Instantiate a MarkdownParser and add the extension to the Twig environment

     $parser = new \dflydev\markdown\MarkdownParser();
     /** @var $twig Twig_Environment */
     $twig->addExtension(new Misd\TwigMarkdowner\Twig\Extension\MarkdownerExtension($parser));


In a Twig template:

    {{ "My *Markdown* text"|markdown }}


    {{ object.property|markdown }}

Please note

This filter does not prevent the injection of arbitrary HTML and JavaScript; the output should be filtered (using HTMLPurifier, or equivalent) before being output in a template.