public function parse(InlineParserContext $inlineContext)
{
$character = $inlineContext->getCursor()->getCharacter();
if (!in_array($character, $this->getCharacters())) {
return false;
}
$numDelims = 0;
$cursor = $inlineContext->getCursor();
$charBefore = $cursor->peek(-1);
if ($charBefore === null) {
$charBefore = "\n";
}
while ($cursor->peek($numDelims) === $character) {
++$numDelims;
}
if ($numDelims === 0) {
return false;
}
// Skip single delims if emphasis is disabled
if ($numDelims === 1 && !$this->config->getConfig('enable_em')) {
return false;
}
$cursor->advanceBy($numDelims);
$charAfter = $cursor->getCharacter();
if ($charAfter === null) {
$charAfter = "\n";
}
list($canOpen, $canClose) = $this->determineCanOpenOrClose($charBefore, $charAfter, $character);
$node = new Text($cursor->getPreviousText(), ['delim' => true, 'emphasis_config' => $this->config]);
$inlineContext->getContainer()->appendChild($node);
// Add entry to stack to this opener
$delimiter = new Delimiter($character, $numDelims, $node, $canOpen, $canClose);
$inlineContext->getDelimiterStack()->push($delimiter);
return true;
}