mirror of
https://github.com/KnpLabs/KnpMarkdownBundle.git
synced 2024-05-05 23:23:16 +02:00
7f115dc73f
All code in the bundle is still relying on the transformMarkdown method in parsers, not on the transform method. Normal parsers are still working because they still have the method, and PHP does not have strict type checking for typehints. However, the SundownParser was still broken. #51 renamed the method to avoid a fatal error for the interface, but then the method used by the bundle became missing.
31 lines
567 B
PHP
31 lines
567 B
PHP
<?php
|
|
|
|
namespace Knp\Bundle\MarkdownBundle\Parser;
|
|
|
|
use Knp\Bundle\MarkdownBundle\MarkdownParserInterface;
|
|
|
|
use Sundown\Markdown;
|
|
|
|
/**
|
|
* SundownParser
|
|
*
|
|
* This class wraps the original Sundown parser to implement the KnpMardownBundle interface
|
|
*/
|
|
class SundownParser implements MarkdownParserInterface
|
|
{
|
|
private $parser;
|
|
|
|
public function __construct(Markdown $parser)
|
|
{
|
|
$this->parser = $parser;
|
|
}
|
|
|
|
/**
|
|
* {@inheritdoc}
|
|
*/
|
|
public function transformMarkdown($text)
|
|
{
|
|
return $this->parser->render($text);
|
|
}
|
|
}
|