in src/unparsed-blocks/SetextHeading.php [22:58]
public static function consume(
Context $context,
Lines $lines,
): ?(Block, Lines) {
if ($context->isInParagraphContinuation()) {
return null;
}
list($first_col, $first, $lines) = $lines->getColumnFirstLineAndRest();
$heading = $first;
while (!$lines->isEmpty()) {
list($col, $line, $rest) = $lines->getColumnFirstLineAndRest();
if (Lines::isBlankLine($line)) {
return null;
}
$matches = Regex\first_match($line, re"/^ {0,3}(?<level>=+|-+) *$/");
if ($matches is nonnull) {
// Heading underline can not be a lazy continuation item
if ($col >= $first_col) {
$level = $matches['level'][0] === '=' ? 1 : 2;
return tuple(
new self($level, Str\trim($heading)),
$rest,
);
}
}
if (!_Private\is_paragraph_continuation_text($context, $lines)) {
return null;
}
$heading .= "\n".$line;
$lines = $rest;
}
return null;
}