KnpMarkdownBundle/README.markdown

32 lines
778 B
Markdown
Raw Normal View History

2010-09-12 12:20:29 +02:00
Provide markdown conversion to your Symfony2 projects.
2010-05-05 18:38:36 +02:00
## INSTALLATION
2010-09-12 12:20:29 +02:00
Put MarkdownBundle in your `src/Bundle` dir.
2010-05-05 18:38:36 +02:00
2010-09-12 12:20:29 +02:00
Then enable it in your `config.yml`:
2010-05-05 18:38:36 +02:00
2010-05-06 15:20:04 +02:00
markdown.parser: ~ # Enable the parser service
2010-09-12 12:20:29 +02:00
markdown.helper: ~ # Enable the helper in the templates
2010-05-05 18:38:36 +02:00
2010-09-19 21:05:36 +02:00
Optionnally enable the twig markdown filter :
twig.config: ~ # Enable Twig
markdown.twig: ~ # Enable the markdown filter
2010-05-05 18:38:36 +02:00
## USAGE
2010-05-06 15:20:04 +02:00
// Use the service
2010-09-12 12:20:29 +02:00
$html = $this->container['markdownParser']->transform($text);
2010-05-06 15:20:04 +02:00
// Use the helper
2010-09-12 13:25:50 +02:00
echo $view['markdown']->transform($text);
2010-07-22 12:06:54 +02:00
2010-09-19 21:05:36 +02:00
If you have enabled the twig markdown filter, you can use the following in your twig templates:
{{ my_data | markdown }}
2010-07-22 12:06:54 +02:00
## TEST
phpunit -c myapp src/Bundle/MarkdownBundle