protected function renderNodes()

in src/render/MarkdownRenderer.php [25:47]


  protected function renderNodes(vec<ASTNode> $nodes): string {
    $this->outContext = '';
    return $nodes
      |> Vec\map(
        $$,
        $node ==> {
          $content = $this->render($node);
          if ($node is Blocks\Block) {
            $content = $content."\n\n";
          }
          invariant(
            $this->outContext is nonnull,
            'OutContext is set before this mapping. '.
            'We can not postpone this append, there is a reader in $this->render().',
          );
          $this->outContext .= $content;
          return $content;
        },
      )
      |> Vec\filter($$, $line ==> $line !== '')
      |> Str\join($$, '')
      |> Str\strip_suffix($$, "\n\n");
  }