Colibo Parsedown Bundle
Add support for parsedown and parsedown-extra in Symfony 3., (*1)
Provides :, (*2)
- Two services:
-
parsedown : parsedown parser.
-
parsedown_extra : parsedown-extra parser (support for Markdown Extra).
- Two twig filter:
-
md : parse markdown with parsedown.
-
mde : parse markdown with parsedown-extra.
Install
Add the bundle in your composer.json :, (*3)
"require": {
"colibo/parsedown-bundle": "dev-master"
}
Update your vendors, then enable bundle in AppKernel.php :, (*4)
new Colibo\ParsedownBundle\ColiboParsedownBundle(),
Usage
In twig templates:, (*5)
{# Parse markdown using parsedown standard parser #}
{{ var|md }}
{# Parse markdown using parsedown-extra parser #}
{{ var|mde }}
In PHP :, (*6)
// Parse markdown using parsedown standard parser.
echo $container->get('parsedown')->text($var);
// Parse markdown using parsedown-extra parser.
echo $container->get('parsedown_extra')->text($var);