You are here

protected function Markdown::doHeaders in Express 8

* Parse Markdown heading elements to HTML *

Parameters

string $text: * @return string

1 method overrides Markdown::doHeaders()
MarkdownExtra::doHeaders in vendor/michelf/php-markdown/Michelf/MarkdownExtra.php
* Process markdown headers. Redefined to add ID and class attribute support. *

File

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

Class

Markdown
Markdown Parser Class

Namespace

Michelf

Code

protected function doHeaders($text) {

  /**
   * Setext-style headers:
   *	  Header 1
   *	  ========
   *
   *	  Header 2
   *	  --------
   */
  $text = preg_replace_callback('{ ^(.+?)[ ]*\\n(=+|-+)[ ]*\\n+ }mx', array(
    $this,
    '_doHeaders_callback_setext',
  ), $text);

  /**
   * atx-style headers:
   *   # Header 1
   *   ## Header 2
   *   ## Header 2 with closing hashes ##
   *   ...
   *   ###### Header 6
   */
  $text = preg_replace_callback('{
				^(\\#{1,6})	# $1 = string of #\'s
				[ ]*
				(.+?)		# $2 = Header text
				[ ]*
				\\#*			# optional closing #\'s (not counted)
				\\n+
			}xm', array(
    $this,
    '_doHeaders_callback_atx',
  ), $text);
  return $text;
}