li3_docs\doc\UorMarkdown
Extends
cebe\markdown\GithubMarkdown
Union of RAD flavored Markdown.
Source
class UorMarkdown extends \cebe\markdown\GithubMarkdown {
/**
* Overwritten to default to HTML5 output.
*/
public $html5 = true;
/**
* Overwritten to make headlines linkable.
*/
protected function renderHeadline($block) {
$tag = 'h' . $block['level'];
$text = $this->renderAbsy($block['content']);
$slug = strtolower(Inflector::slug($text));
return sprintf(
'<%s><a id="%s" class="anchor" href="%s">%s</a></%s>' . "\n",
$tag,
$slug,
'#' . $slug,
$text,
$tag
);
}
/**
* Overwritten to default to PHP language in code blocks.
*/
protected function consumeFencedCode($lines, $current) {
list($block, $i) = parent::consumeFencedCode($lines, $current);
if (empty($block['language'])) {
$block['language'] = 'php';
}
return [$block, $i];
}
}