You are here

protected function MarkdownExtra::_doHeaders_callback_setext in Markdown 7

* Callback for setext headers *

Parameters

array $matches: * @return string

Overrides Markdown::_doHeaders_callback_setext

File

includes/MarkdownExtra.php, line 1063

Class

MarkdownExtra
Markdown Extra Parser Class

Namespace

Michelf

Code

protected function _doHeaders_callback_setext($matches) {
  if ($matches[3] == '-' && preg_match('{^- }', $matches[1])) {
    return $matches[0];
  }
  $level = $matches[3][0] == '=' ? 1 : 2;
  $defaultId = is_callable($this->header_id_func) ? call_user_func($this->header_id_func, $matches[1]) : null;
  $attr = $this
    ->doExtraAttributes("h{$level}", $dummy =& $matches[2], $defaultId);
  $block = "<h{$level}{$attr}>" . $this
    ->runSpanGamut($matches[1]) . "</h{$level}>";
  return "\n" . $this
    ->hashBlock($block) . "\n\n";
}