You are here

protected function Markdown::_doHeaders_callback_setext in Express 8

* Setext header parsing callback *

Parameters

array $matches: * @return string

1 method overrides Markdown::_doHeaders_callback_setext()
MarkdownExtra::_doHeaders_callback_setext in vendor/michelf/php-markdown/Michelf/MarkdownExtra.php
* Callback for setext headers *

File

vendor/michelf/php-markdown/Michelf/Markdown.php, line 942

Class

Markdown
Markdown Parser Class

Namespace

Michelf

Code

protected function _doHeaders_callback_setext($matches) {

  // Terrible hack to check we haven't found an empty list item.
  if ($matches[2] == '-' && preg_match('{^-(?: |$)}', $matches[1])) {
    return $matches[0];
  }
  $level = $matches[2][0] == '=' ? 1 : 2;

  // ID attribute generation
  $idAtt = $this
    ->_generateIdFromHeaderValue($matches[1]);
  $block = "<h{$level}{$idAtt}>" . $this
    ->runSpanGamut($matches[1]) . "</h{$level}>";
  return "\n" . $this
    ->hashBlock($block) . "\n\n";
}