You are here

protected function Markdown::hashPart in Markdown 7

* Called whenever a tag must be hashed when a function insert an atomic * element in the text stream. Passing $text to through this function gives * a unique text-token which will be reverted back when calling unhash. * * The $boundary argument specify what character should be used to surround * the token. By convension, "B" is used for block elements that needs not * to be wrapped into paragraph tags at the end, ":" is used for elements * that are word separators and "X" is used in the general case. * *

Parameters

string $text: * @param string $boundary * @return string

18 calls to Markdown::hashPart()
Markdown::doItalicsAndBold in includes/Markdown.php
* Convert Markdown italics (emphasis) and bold (strong) to HTML *
Markdown::handleSpanToken in includes/Markdown.php
* Handle $token provided by parseSpan by determining its nature and * returning the corresponding value that should replace it. *
Markdown::hashBlock in includes/Markdown.php
* Shortcut function for hashPart with block-level boundaries. *
Markdown::makeCodeSpan in includes/Markdown.php
* Create a code span markup for $code. Called from handleSpanToken. *
Markdown::_doAnchors_inline_callback in includes/Markdown.php
* Callback method to parse inline anchors *

... See full list

File

includes/Markdown.php, line 497

Class

Markdown
Markdown Parser Class

Namespace

Michelf

Code

protected function hashPart($text, $boundary = 'X') {

  // Swap back any tag hash found in $text so we do not have to `unhash`
  // multiple times at the end.
  $text = $this
    ->unhash($text);

  // Then hash the block.
  static $i = 0;
  $key = "{$boundary}\32" . ++$i . $boundary;
  $this->html_hashes[$key] = $text;
  return $key;

  // String that will replace the tag.
}