public function processInlines(ArrayCollection $inlines, DelimiterStack $delimiterStack, Delimiter $stackBottom = null)
 {
     $previous = null;
     foreach ($inlines as $key => $inline) {
         if (!$inline instanceof InlineAttributes) {
             $previous = $inline;
             continue;
         }
         $inlines->remove($key);
         if (0 === count($inline->getAttributes())) {
             continue;
         }
         $node = null;
         if ($inline->isBlock()) {
             foreach (debug_backtrace(false) as $trace) {
                 if ('League\\CommonMark\\DocParser' === $trace['class'] && 'processInlines' === $trace['function']) {
                     $node = $trace['args'][1];
                     break;
                 }
             }
             if ($node->getParent() instanceof ListItem && $node->getParent()->getParent()->isTight()) {
                 $node = $node->getParent();
             }
         } elseif ($previous) {
             $node = $previous;
         }
         if ($node) {
             $node->data['attributes'] = AttributesUtils::merge($node, $inline->getAttributes());
         }
     }
 }
 public function replaceChild(ContextInterface $context, AbstractBlock $original, AbstractBlock $replacement)
 {
     if (($index = $this->children->indexOf($original)) !== false) {
         $this->children->remove($index);
         $replacement->setParent($this);
         $this->children->set($index, $replacement);
     } else {
         $this->addChild($replacement);
     }
     if ($context->getTip() === $original) {
         $context->setTip($replacement);
     }
 }