1<?php 2 3/* 4 * This file is part of the league/commonmark package. 5 * 6 * (c) Colin O'Dell <colinodell@gmail.com> and uAfrica.com (http://uafrica.com) 7 * 8 * For the full copyright and license information, please view the LICENSE 9 * file that was distributed with this source code. 10 */ 11 12namespace League\CommonMark\Extension\Strikethrough; 13 14use League\CommonMark\ElementRendererInterface; 15use League\CommonMark\HtmlElement; 16use League\CommonMark\Inline\Element\AbstractInline; 17use League\CommonMark\Inline\Renderer\InlineRendererInterface; 18 19final class StrikethroughRenderer implements InlineRendererInterface 20{ 21 public function render(AbstractInline $inline, ElementRendererInterface $htmlRenderer) 22 { 23 if (!($inline instanceof Strikethrough)) { 24 throw new \InvalidArgumentException('Incompatible inline type: ' . get_class($inline)); 25 } 26 27 return new HtmlElement('del', $inline->getData('attributes', []), $htmlRenderer->renderInlines($inline->children())); 28 } 29} 30