You are here

function Markdown_Parser::_doHeaders_callback_setext in Markdown 6

Same name and namespace in other branches
  1. 5 markdown.php \Markdown_Parser::_doHeaders_callback_setext()
1 method overrides Markdown_Parser::_doHeaders_callback_setext()
MarkdownExtra_Parser::_doHeaders_callback_setext in ./markdown.php

File

./markdown.php, line 944

Class

Markdown_Parser

Code

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;
  $block = "<h{$level}>" . $this
    ->runSpanGamut($matches[1]) . "</h{$level}>";
  return "\n" . $this
    ->hashBlock($block) . "\n\n";
}