framework/utils/CMarkdownParser.php
protected function highlightCodeBlock($codeblock)
	{
		if(($tag=$this->getHighlightTag($codeblock))!==null && ($highlighter=$this->createHighLighter($tag)))
		{
			$codeblock = preg_replace('/\A\n+|\n+\z/', '', $codeblock);
			$tagLen = strpos($codeblock, $tag)+strlen($tag);
			$codeblock = ltrim(substr($codeblock, $tagLen));
			$output=preg_replace('/<span\s+[^>]*>(\s*)<\/span>/', '\1', $highlighter->highlight($codeblock));
			return "<div class=\"{$this->highlightCssClass}\">".$output."</div>";
		}
		else
			return "<pre>".CHtml::encode($codeblock)."</pre>";
	}
protected function highlightCodeBlock($codeblock)
	{
		if(($tag=$this->getHighlightTag($codeblock))!==null && ($highlighter=$this->createHighLighter($tag)))
		{
			$codeblock = preg_replace('/\A\n+|\n+\z/', '', $codeblock);
			$tagLen = strpos($codeblock, $tag)+strlen($tag);
			$codeblock = ltrim(substr($codeblock, $tagLen));
			$output=preg_replace('/<span\s+[^>]*>(\s*)<\/span>/', '\1', $highlighter->highlight($codeblock));
			return "<div class=\"{$this->highlightCssClass}\">".$output."</div>";
		}
		else
			return "<pre>".CHtml::encode($codeblock)."</pre>";
	}
protected function highlightCodeBlock ( $ codeblock ) { if ( ( $ tag = $ this -> getHighlightTag ( $ codeblock ) ) !== null && ( $ highlighter = $ this -> createHighLighter ( $ tag ) ) ) { $ codeblock = preg_replace ( '/\A\n+|\n+\z/' , '' , $ codeblock ) ; $ tagLen = strpos ( $ codeblock , $ tag ) + strlen ( $ tag ) ; $ codeblock = ltrim ( substr ( $ codeblock , $ tagLen ) ) ; $ output = preg_replace ( '/<span\s+[^>]*>(\s*)<\/span>/' , '\1' , $ highlighter -> highlight ( $ codeblock ) ) ; return "<div class=\"{$this->highlightCssClass}\">" . $ output . "</div>" ; } else return "<pre>" . CHtml :: encode ( $ codeblock ) . "</pre>" ; }
Highlights the code block.
@param string $codeblock the code block
@return string the highlighted code block. Null if the code block does not need to highlighted
Highlights the code block .