Go to file
2011-05-10 09:14:21 -07:00
DependencyInjection Modernize the bundle, add parser implementation choice, and improve doc. 2011-04-06 23:35:00 -07:00
Helper Change namespaces to Vendor\Bundle\BundleName to reflect best practices. 2011-03-12 18:47:26 +01:00
Parser Merge branch 'master' of git://github.com/knplabs/MarkdownBundle 2011-04-25 21:03:03 -07:00
Resources/config Modernize the bundle, add parser implementation choice, and improve doc. 2011-04-06 23:35:00 -07:00
Tests Add phpunit.xml and test bootstrap 2011-05-10 09:14:21 -07:00
Twig/Extension Change namespaces to Vendor\Bundle\BundleName to reflect best practices. 2011-03-12 18:47:26 +01:00
vendor/parser Improve doc and comments 2010-07-22 12:06:54 +02:00
.gitignore Update gitignore 2011-05-10 09:14:07 -07:00
KnplabsMarkdownBundle.php Remove useless code from the bundle class 2011-05-10 09:13:33 -07:00
LICENSE Initial commit 2010-05-05 17:11:02 +02:00
MarkdownParserInterface.php Modernize the bundle, add parser implementation choice, and improve doc. 2011-04-06 23:35:00 -07:00
phpunit.xml.dist Add phpunit.xml and test bootstrap 2011-05-10 09:14:21 -07:00
README.markdown Merge branch 'master' of git://github.com/knplabs/MarkdownBundle 2011-04-25 21:03:03 -07:00

Provide markdown conversion to your Symfony2 projects.

This implementation is based on Michel Fortin work. We added PHP5 sugar, feature selection, and unit tests.

INSTALLATION

Put MarkdownBundle in your src/Bundle dir.

USAGE

// Use the service
$html = $this->container->get('markdownParser')->transform($text);

// Use the helper
echo $view['markdown']->transform($text);

If you have enabled the twig markdown filter, you can use the following in your twig templates:

{{ my_data | markdown }}

Change the parser implementation

Create a service implementing Knplabs\Bundle\MarkdownBundle\ParserInterface, then configure the bundle to use it:

knplabs_markdown:
      parser:
              service: my.markdown.parser

This bundle comes with 4 parser services, all based on the same algorithm but providing different levels of compliance to the markdown specification:

  • markdown.parser.max // fully compliant = slower (default implementation)
  • markdown.parser.medium // expensive and uncommon features dropped
  • markdown.parser.light // expensive features dropped
  • markdown.parser.min // most features dropped = faster

For more details, see the implementations in Parser/Preset.

TEST

phpunit -c myapp src/Bundle/MarkdownBundle