$this->parseInline(trim($lines[$current], "# \t")), 'level' => $level, ]; return [$block, $current]; } else { // underlined headline $block = [ 'headline', 'content' => $this->parseInline($lines[$current]), 'level' => $lines[$current + 1][0] === '=' ? 1 : 2, ]; return [$block, $current + 1]; } } /** * Renders a headline */ protected function renderHeadline($block) { $tag = 'h' . $block['level']; return "<$tag>" . $this->renderAbsy($block['content']) . "\n"; } abstract protected function parseInline($text); abstract protected function renderAbsy($absy); }