in src/unparsed-blocks/TaskListItemExtension.php [33:80]
protected static function createFromContents(
Context $context,
int $indentation,
string $delimiter,
?int $number,
Lines $contents,
): ListItem {
if ($contents->isEmpty()) {
return parent::createFromContents(
$context,
$indentation,
$delimiter,
$number,
$contents,
);
}
list($first, $_rest) = $contents->getFirstLineAndRest();
$first = Str\trim_left($first);
if (Str\starts_with($first, '[ ] ')) {
$contents = $contents->withoutFirstNBytes(4);
return new self(
/* checked = */ false,
$indentation,
$delimiter,
$number,
self::consumeChildren($context, $contents),
);
}
if (Str\starts_with($first, '[x] ')) {
$contents = $contents->withoutFirstNBytes(4);
return new self(
/* checked = */ true,
$indentation,
$delimiter,
$number,
self::consumeChildren($context, $contents),
);
}
return parent::createFromContents(
$context,
$indentation,
$delimiter,
$number,
$contents,
);
}