2016-04-14 12:02:31 +02:00
|
|
|
<?php namespace Todaymade\Daux\Format\Confluence\ContentTypes\Markdown;
|
|
|
|
|
|
|
|
use League\CommonMark\Block\Element\AbstractBlock;
|
|
|
|
use League\CommonMark\Block\Renderer\BlockRendererInterface;
|
|
|
|
use League\CommonMark\ElementRendererInterface;
|
2019-11-30 22:24:10 +01:00
|
|
|
use Todaymade\Daux\ContentTypes\Markdown\TableOfContents;
|
2016-04-14 12:02:31 +02:00
|
|
|
|
|
|
|
class TOCRenderer implements BlockRendererInterface
|
|
|
|
{
|
|
|
|
public function render(AbstractBlock $block, ElementRendererInterface $htmlRenderer, $inTightList = false)
|
|
|
|
{
|
2019-11-30 22:24:10 +01:00
|
|
|
if (!($block instanceof TableOfContents)) {
|
|
|
|
throw new \InvalidArgumentException('Incompatible block type: ' . get_class($block));
|
|
|
|
}
|
|
|
|
|
2016-04-14 12:02:31 +02:00
|
|
|
return '<ac:structured-macro ac:name="toc"></ac:structured-macro>';
|
|
|
|
}
|
|
|
|
}
|