League\CommonMark\ElementRendererInterface::getOption PHP Method

getOption() public method

public getOption ( string $option, mixed $default = null ) : mixed
$option string
$default mixed
return mixed
    public function getOption($option, $default = null);

Usage Example

 /**
  * @param ListBlock                $block
  * @param ElementRendererInterface $htmlRenderer
  * @param bool                     $inTightList
  *
  * @return HtmlElement
  */
 public function render(AbstractBlock $block, ElementRendererInterface $htmlRenderer, $inTightList = false)
 {
     if (!$block instanceof ListBlock) {
         throw new \InvalidArgumentException('Incompatible block type: ' . get_class($block));
     }
     $listData = $block->getListData();
     $tag = $listData->type === ListBlock::TYPE_UNORDERED ? 'ul' : 'ol';
     $attr = $listData->start === null || $listData->start === 1 ? [] : ['start' => (string) $listData->start];
     return new HtmlElement($tag, $attr, $htmlRenderer->getOption('inner_separator', "\n") . $htmlRenderer->renderBlocks($block->getChildren(), $block->isTight()) . $htmlRenderer->getOption('inner_separator', "\n"));
 }
All Usage Examples Of League\CommonMark\ElementRendererInterface::getOption