protected function parseInline($text) { $elements = parent::parseInline($text); // merge special attribute elements to links and images as they are not part of the final absy later $relatedElement = null; foreach ($elements as $i => $element) { if ($element[0] === 'link' || $element[0] === 'images') { $relatedElement = $i; } elseif ($element[0] === 'specialAttributes') { if ($relatedElement !== null) { $elements[$relatedElement]['attributes'] = $element[1]; unset($elements[$i]); } $relatedElement = null; } else { $relatedElement = null; } } return $elements; }