mirror of
https://github.com/twigphp/Twig.git
synced 2026-10-09 13:25:41 +00:00
Remove the League CommonMark fallback for converters without convert()
This commit is contained in:
@@ -17,20 +17,14 @@ use League\CommonMark\MarkdownConverter;
|
||||
class LeagueMarkdown implements MarkdownInterface
|
||||
{
|
||||
private $converter;
|
||||
private $legacySupport;
|
||||
|
||||
public function __construct(?MarkdownConverter $converter = null)
|
||||
{
|
||||
$this->converter = $converter ?: new CommonMarkConverter();
|
||||
$this->legacySupport = !method_exists($this->converter, 'convert');
|
||||
}
|
||||
|
||||
public function convert(string $body): string
|
||||
{
|
||||
if ($this->legacySupport) {
|
||||
return $this->converter->convertToHtml($body);
|
||||
}
|
||||
|
||||
return $this->converter->convert($body);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user