Skip to content

Commit

Permalink
Fix call to deprecated "convertToHtml" method
Browse files Browse the repository at this point in the history
  • Loading branch information
jderusse authored and fabpot committed Jan 29, 2022
1 parent bbc3377 commit 779fdd0
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion extra/markdown-extra/LeagueMarkdown.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,20 @@
class LeagueMarkdown implements MarkdownInterface
{
private $converter;
private $legacySupport;

public function __construct(CommonMarkConverter $converter = null)
{
$this->converter = $converter ?: new CommonMarkConverter();
$this->legacySupport = !method_exists($this->converter, 'convert');
}

public function convert(string $body): string
{
return $this->converter->convertToHtml($body);
if ($this->legacySupport) {
return $this->converter->convertToHtml($body);
}

return $this->converter->convert($body);
}
}

0 comments on commit 779fdd0

Please sign in to comment.