mirror of
https://github.com/KnpLabs/KnpMarkdownBundle.git
synced 2024-06-08 00:42:17 +02:00
23 lines
490 B
PHP
23 lines
490 B
PHP
<?php
|
|
|
|
namespace Bundle\MarkdownBundle\Parser;
|
|
|
|
require_once(realpath(__DIR__.'/..').'/vendor/parser/MarkdownExtraParser.php');
|
|
|
|
class MarkdownParser extends \MarkdownExtraParser
|
|
{
|
|
|
|
public function transform($text)
|
|
{
|
|
$html = parent::transform($text);
|
|
|
|
$html = $this->removeWhiteSpacesOnBlankLines($html);
|
|
|
|
return $html;
|
|
}
|
|
|
|
protected function removeWhiteSpacesOnBlankLines($html)
|
|
{
|
|
return preg_replace("/\n\s+\n/m", "\n\n", $html);
|
|
}
|
|
} |