Skip to content

Commit

Permalink
Merge branch '2.x' into 3.x
Browse files Browse the repository at this point in the history
* 2.x:
  Fix call to deprecated "convertToHtml" method
  • Loading branch information
fabpot committed Jan 29, 2022
2 parents 8717478 + e056e63 commit 25d410b
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 25d410b

Please sign in to comment.