1<?php
2
3/*
4 * This file is part of the clockoon/dokuwiki-commonmark-plugin package.
5 *
6 * (c) Sungbin Jeon <clockoon@gmail.com>
7 *
8 * Original code based on the followings:
9 * - CommonMark JS reference parser (https://bitly.com/commonmark-js) (c) John MacFarlane
10 * - league/commonmark (https://github.com/thephpleague/commonmark) (c) Colin O'Dell <colinodell@gmail.com>
11 *
12 * For the full copyright and license information, please view the LICENSE
13 * file that was distributed with this source code.
14 */
15
16namespace DokuWiki\Plugin\Commonmark\Extension\Renderer\Block;
17
18use League\CommonMark\Block\Element\AbstractBlock;
19use League\CommonMark\Block\Element\ThematicBreak;
20use League\CommonMark\ElementRendererInterface;
21use League\CommonMark\Block\Renderer\BlockRendererInterface;
22
23final class ThematicBreakRenderer implements BlockRendererInterface
24{
25    /**
26     * @param ThematicBreak            $block
27     * @param ElementRendererInterface $DWRenderer
28     * @param bool                     $inTightList
29     *
30     * @return string
31     */
32    public function render(AbstractBlock $block, ElementRendererInterface $htmlRenderer, bool $inTightList = false)
33    {
34        if (!($block instanceof ThematicBreak)) {
35            throw new \InvalidArgumentException('Incompatible block type: ' . \get_class($block));
36        }
37
38        return "----";
39    }
40}
41