You are here

protected function Markdown::_generateIdFromHeaderValue in Markdown 7

* If a header_id_func property is set, we can use it to automatically * generate an id attribute. * * This method returns a string in the form id="foo", or an empty string * otherwise. *

Parameters

string $headerValue: * @return string

2 calls to Markdown::_generateIdFromHeaderValue()
Markdown::_doHeaders_callback_atx in includes/Markdown.php
* ATX header parsing callback *
Markdown::_doHeaders_callback_setext in includes/Markdown.php
* Setext header parsing callback *

File

includes/Markdown.php, line 980

Class

Markdown
Markdown Parser Class

Namespace

Michelf

Code

protected function _generateIdFromHeaderValue($headerValue) {
  if (!is_callable($this->header_id_func)) {
    return "";
  }
  $idValue = call_user_func($this->header_id_func, $headerValue);
  if (!$idValue) {
    return "";
  }
  return ' id="' . $this
    ->encodeAttribute($idValue) . '"';
}