in src/inlines/StrikethroughExtension.php [34:59]
public static function consume(
Context $context,
string $string,
int $offset,
): ?(Inline, int) {
if ($string[$offset] !== '~') {
return null;
}
$start_pos = StrPos\trim_left($string, $offset, '~');
$end_pos = Str\search($string, '~', $start_pos);
if ($end_pos === null) {
return null;
}
$para_pos = Str\search($string, "\n\n", $start_pos);
if ($para_pos !== null && $para_pos < $end_pos) {
return null;
}
$matched = Str\slice($string, $start_pos, $end_pos - $start_pos);
$children = parse($context, $matched);
$end_pos = StrPos\trim_left($string, $end_pos, '~');
return tuple(new self($children), $end_pos);
}