yii\apidoc\helpers\ApiMarkdown::renderHeadline PHP Method

renderHeadline() protected method

protected renderHeadline ( $block )
    protected function renderHeadline($block)
    {
        $content = $this->renderAbsy($block['content']);
        if (preg_match('~<span id="(.*?)"></span>~', $content, $matches)) {
            $hash = $matches[1];
            $content = preg_replace('~<span id=".*?"></span>~', '', $content);
        } else {
            $hash = Inflector::slug(strip_tags($content));
        }
        $hashLink = "<span id=\"{$hash}\"></span><a href=\"#{$hash}\" class=\"hashlink\">&para;</a>";
        if ($block['level'] == 2) {
            $this->headings[] = ['title' => trim($content), 'id' => $hash];
        } elseif ($block['level'] > 2) {
            if (end($this->headings)) {
                $this->headings[key($this->headings)]['sub'][] = ['title' => trim($content), 'id' => $hash];
            }
        }
        $tag = 'h' . $block['level'];
        return "<{$tag}>{$content} {$hashLink}</{$tag}>";
    }