You are here

function MarkdownExtra_Parser::_doFencedCodeBlocks_callback in Markdown 5

Same name and namespace in other branches
  1. 6 markdown.php \MarkdownExtra_Parser::_doFencedCodeBlocks_callback()

File

./markdown.php, line 2534

Class

MarkdownExtra_Parser

Code

function _doFencedCodeBlocks_callback($matches) {
  $codeblock = $matches[2];
  $codeblock = htmlspecialchars($codeblock, ENT_NOQUOTES);
  $codeblock = preg_replace_callback('/^\\n+/', array(
    &$this,
    '_doFencedCodeBlocks_newlines',
  ), $codeblock);
  $codeblock = "<pre><code>{$codeblock}</code></pre>";
  return "\n\n" . $this
    ->hashBlock($codeblock) . "\n\n";
}