public function parse(InlineParserContext $inlineContext)
{
$cursor = $inlineContext->getCursor();
if ($cursor->getCharacter() !== '\\') {
return false;
}
$nextChar = $cursor->peek();
if ($nextChar === "\n") {
$cursor->advanceBy(2);
$inlineContext->getContainer()->appendChild(new Newline(Newline::HARDBREAK));
return true;
} elseif ($nextChar !== null && preg_match('/' . RegexHelper::REGEX_ESCAPABLE . '/', $nextChar)) {
$cursor->advanceBy(2);
$inlineContext->getContainer()->appendChild(new Text($nextChar));
return true;
}
$cursor->advance();
$inlineContext->getContainer()->appendChild(new Text('\\'));
return true;
}