KnpMarkdownBundle/Parser/Preset/Flavored.php
Joseph Bielawski bd597e66a1 Fix way how Sundown parser is added
Fix detection of default parser when none is set
Add Flavored preset from KnpBundles.com
2012-10-17 12:01:25 +02:00

25 lines
539 B
PHP

<?php
namespace Knp\Bundle\MarkdownBundle\Parser\Preset;
/**
* Copyrights KnpBundle.com
*/
class Flavored extends Max
{
/**
* {@inheritDoc}
*/
public function transformMarkdown($text)
{
$types = array();
$markdown = preg_replace_callback("@```[ ]*([^\n]*)(.+?)```@smi", function ($m) use (&$types) {
$types[] = trim($m[1]);
return ' '.str_replace("\n", "\n ", trim($m[2], "\r\n"));
}, parent::transformMarkdown($text));
return $markdown;
}
}