Class CMarkdownParser
CMarkdownParser is a wrapper of MarkdownExtra_Parser.
CMarkdownParser extends MarkdownExtra_Parser by using Text_Highlighter to highlight code blocks with specific language syntax. In particular, if a code block starts with the following:
[language]
The syntax for the specified language will be used to highlight code block. The languages supported include (case-insensitive): ABAP, CPP, CSS, DIFF, DTD, HTML, JAVA, JAVASCRIPT, MYSQL, PERL, PHP, PYTHON, RUBY, SQL, XML
You can also specify options to be passed to the syntax highlighter. For example:
[php showLineNumbers=1]
which will show line numbers in each line of the code block.
For details about the standard markdown syntax, please check the following:- Markdown_Parser
- MarkdownExtra_Parser
- CMarkdownParser
Copyright: 2008-2013 Yii Software LLC
License: http://www.yiiframework.com/license/
Author: Qiang Xue <qiang.xue@gmail.com>
Since: 1.0
Located at x2engine/framework/utils/CMarkdownParser.php
public
string
|
#
safeTransform( string $content )
Transforms the content and purifies the result. This method calls the
transform() method to convert markdown content into HTML content. It then uses
|
public
string
|
|
public
string
|
|
public
string
|
#
_doFencedCodeBlocks_callback( array $matches )
Callback function when a fenced code block is matched. |
protected
string
|
|
protected
string
|
|
protected
|
|
public
array
|
|
public
array
|
|
protected
mixed
|
#
getInlineOption( string $name, string $str, mixed $defaultValue )
Retrieves the specified configuration. |
public
string
|
$highlightCssClass | 'hl-code' |
#
the css class for the div element containing the code block that is highlighted. Defaults to 'hl-code'. |
public
mixed
|
$purifierOptions | null |
#
the options to be passed to HTML Purifier. This
can be a HTMLPurifier_Config object, an array of directives (Namespace.Directive
=> Value) or the filename of an ini file. This property is used only when
|
public
string
|
$defaultCssFile |
#
The default CSS file that is used to highlight code blocks. |