1<?php 2 3/* 4 * This file is part of the league/commonmark package. 5 * 6 * (c) Colin O'Dell <colinodell@gmail.com> 7 * 8 * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) 9 * - (c) John MacFarlane 10 * 11 * For the full copyright and license information, please view the LICENSE 12 * file that was distributed with this source code. 13 */ 14 15namespace League\CommonMark; 16 17use League\CommonMark\Block\Element\AbstractBlock; 18use League\CommonMark\Inline\Element\AbstractInline; 19 20/** 21 * Renders a parsed AST to a string representation 22 */ 23interface ElementRendererInterface 24{ 25 /** 26 * @param string $option 27 * @param mixed $default 28 * 29 * @return mixed|null 30 */ 31 public function getOption(string $option, $default = null); 32 33 /** 34 * @param AbstractInline $inline 35 * 36 * @return string 37 */ 38 public function renderInline(AbstractInline $inline): string; 39 40 /** 41 * @param AbstractInline[] $inlines 42 * 43 * @return string 44 */ 45 public function renderInlines(iterable $inlines): string; 46 47 /** 48 * @param AbstractBlock $block 49 * @param bool $inTightList 50 * 51 * @throws \RuntimeException 52 * 53 * @return string 54 */ 55 public function renderBlock(AbstractBlock $block, bool $inTightList = false): string; 56 57 /** 58 * @param AbstractBlock[] $blocks 59 * @param bool $inTightList 60 * 61 * @return string 62 */ 63 public function renderBlocks(iterable $blocks, bool $inTightList = false): string; 64} 65