59b8c04161
Make it easier to spot where an error comes from when uploading to confluence. Allow to upload documentation without a prefix.
26 lignes
828 B
PHP
26 lignes
828 B
PHP
<?php namespace Todaymade\Daux\Format\Confluence\ContentTypes\Markdown;
|
|
|
|
use League\CommonMark\Block\Element\AbstractBlock;
|
|
use League\CommonMark\Block\Element\IndentedCode;
|
|
use League\CommonMark\ElementRendererInterface;
|
|
use League\CommonMark\HtmlElement;
|
|
|
|
class IndentedCodeRenderer extends CodeRenderer
|
|
{
|
|
/**
|
|
* @param AbstractBlock $block
|
|
* @param HtmlRendererInterface $htmlRenderer
|
|
* @param bool $inTightList
|
|
*
|
|
* @return HtmlElement
|
|
*/
|
|
public function render(AbstractBlock $block, ElementRendererInterface $htmlRenderer, $inTightList = false)
|
|
{
|
|
if (!($block instanceof IndentedCode)) {
|
|
throw new \InvalidArgumentException('Incompatible block type: ' . get_class($block));
|
|
}
|
|
|
|
return $this->getHTMLElement($block->getStringContent(), "");
|
|
}
|
|
}
|