mirror of
https://github.com/KnpLabs/KnpMarkdownBundle.git
synced 2024-06-28 02:10:34 +02:00
25 lines
539 B
PHP
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;
|
||
|
}
|
||
|
}
|