colibo/parsedown-bundle

Add support for parsedown and parsedown-extra in Symfony 3 by providing services and Twig filters.

Installs: 162

Dependents: 0

Suggesters: 0

Security: 0

Stars: 1

Watchers: 1

Forks: 3

Open Issues: 1

Type:symfony-bundle

dev-master 2016-03-23 18:17 UTC

This package is not auto-updated.

Last update: 2024-11-01 20:16:50 UTC


README

Add support for parsedown and parsedown-extra in Symfony 3.

Provides :

  • 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 :

"require": {
    "colibo/parsedown-bundle": "dev-master"
}

Update your vendors, then enable bundle in AppKernel.php :

new Colibo\ParsedownBundle\ColiboParsedownBundle(),

Usage

In twig templates:

{# Parse markdown using parsedown standard parser #}
{{ var|md }}

{# Parse markdown using parsedown-extra parser #}
{{ var|mde }}

In PHP :

// 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);