protected function renderListItem()

in src/render/HTMLRenderer.php [150:192]


  protected function renderListItem(
    Blocks\ListOfItems $list,
    Blocks\ListItem $item,
  ): string {
    if ($item is Blocks\TaskListItemExtension) {
      return $this->renderTaskListItemExtension($list, $item);
    }

    $children = $item->getChildren();
    if (C\is_empty($children)) {
      return "<li></li>\n";
    }

    $content = '';

    if ($list->isTight()) {
      if (!C\first($children) is Blocks\Paragraph) {
        $content .= "\n";
      }

      $content .= $children
        |> Vec\map(
          $$,
          $child ==> {
            if ($child is Blocks\Paragraph) {
              return $this->renderNodes($child->getContents());
            }
            if ($child is Blocks\Block) {
              return Str\trim($this->render($child));
            }
            return $this->render($child);
          },
        )
        |> Str\join($$, "\n");
      if (!C\last($children) is Blocks\Paragraph) {
        $content .= "\n";
      }
    } else {
      $content = "\n".$this->renderNodes($children);
    }

    return '<li>'.$content."</li>\n";
  }