in src/unparsed-blocks/IndentedCodeBlock.php [21:61]
public static function consume(
Context $context,
Lines $lines,
): ?(Block, Lines) {
if ($context->isInParagraphContinuation()) {
return null;
}
$matched = vec[];
$blank_line_stash = null;
while (!$lines->isEmpty()) {
list($col, $line, $rest) = $lines->getColumnFirstLineAndRest();
$stripped = Lines::stripNLeadingWhitespace($line, 4, $col);
if ($stripped !== null && $stripped !== '') {
$blank_line_stash = null;
$matched[] = $stripped;
$lines = $rest;
continue;
}
if (!Lines::isBlankLine($line)) {
break;
}
if ($blank_line_stash === null) {
$blank_line_stash = tuple($matched, $lines);
}
$matched[] = '';
$lines = $rest;
}
if ($blank_line_stash !== null) {
list($matched, $lines) = $blank_line_stash;
}
if (C\is_empty($matched)) {
return null;
}
return tuple(new self(Str\join($matched, "\n")), $lines);
}