function Markdown_Parser::doCodeBlocks in Markdown 5
Same name and namespace in other branches
- 6 markdown.php \Markdown_Parser::doCodeBlocks()
File
- ./
markdown.php, line 1073
Class
Code
function doCodeBlocks($text) {
#
# Process Markdown `<pre><code>` blocks.
#
$text = preg_replace_callback('{
(?:\\n\\n|\\A\\n?)
( # $1 = the code block -- one or more lines, starting with a space/tab
(?>
[ ]{' . $this->tab_width . '} # Lines must start with a tab or a tab-width of spaces
.*\\n+
)+
)
((?=^[ ]{0,' . $this->tab_width . '}\\S)|\\Z) # Lookahead for non-space at line-start, or end of doc
}xm', array(
&$this,
'_doCodeBlocks_callback',
), $text);
return $text;
}