public function render(AbstractBlock $block, ElementRendererInterface $htmlRenderer, $inTightList = false)
{
if (!$block instanceof ListItem) {
throw new \InvalidArgumentException('Incompatible block type: ' . get_class($block));
}
$contents = $htmlRenderer->renderBlocks($block->children(), $inTightList);
if (substr($contents, 0, 1) === '<') {
$contents = "\n" . $contents;
}
if (substr($contents, -1, 1) === '>') {
$contents .= "\n";
}
$attrs = [];
foreach ($block->getData('attributes', []) as $key => $value) {
$attrs[$key] = $htmlRenderer->escape($value, true);
}
$li = new HtmlElement('li', $attrs, $contents);
return $li;
}