-
-
Notifications
You must be signed in to change notification settings - Fork 189
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Consider making the renderers non-final #379
Comments
The renderers are marked <?php
namespace Spatie\CommonMarkHighlighter;
use League\CommonMark\ElementRendererInterface;
use League\CommonMark\Block\Element\AbstractBlock;
+use League\CommonMark\Block\Renderer\BlockRendererInterface;
use League\CommonMark\Block\Renderer\IndentedCodeRenderer as BaseIndentedCodeRenderer;
-class IndentedCodeRenderer extends BaseIndentedCodeRenderer
+class IndentedCodeRenderer implements BlockRendererInterface
{
/** @var \Spatie\CommonMarkHighlighter\CodeBlockHighlighter */
protected $highlighter;
+ /** @var BaseIndentedCodeRenderer */
+ protected $baseRenderer;
public function __construct(array $autodetectLanguages = [])
{
$this->highlighter = new CodeBlockHighlighter($autodetectLanguages);
+ $this->baseRenderer = new BaseIndentedCodeRenderer();
}
public function render(AbstractBlock $block, ElementRendererInterface $htmlRenderer, $inTightList = false)
{
- $element = parent::render($block, $htmlRenderer, $inTightList);
+ $element = $this->baseRenderer->renderer($block, $htmlRenderer, $inTightList);
$element->setContents(
$this->highlighter->highlight($element->getContents())
);
return $element;
}
} (This code is untested but it should work) |
Thanks 👍 |
Our package extends some of the renderers of this package. Could you consider making your classes non-final?
The text was updated successfully, but these errors were encountered: