Overview

Packages

  • application
    • commands
    • components
      • actions
      • filters
      • leftWidget
      • permissions
      • sortableWidget
      • util
      • webupdater
      • x2flow
        • actions
        • triggers
      • X2GridView
      • X2Settings
    • controllers
    • models
      • embedded
    • modules
      • accounts
        • controllers
        • models
      • actions
        • controllers
        • models
      • calendar
        • controllers
        • models
      • charts
        • models
      • contacts
        • controllers
        • models
      • docs
        • components
        • controllers
        • models
      • groups
        • controllers
        • models
      • marketing
        • components
        • controllers
        • models
      • media
        • controllers
        • models
      • mobile
        • components
      • opportunities
        • controllers
        • models
      • products
        • controllers
        • models
      • quotes
        • controllers
        • models
      • services
        • controllers
        • models
      • template
        • models
      • users
        • controllers
        • models
      • workflow
        • controllers
        • models
      • x2Leads
        • controllers
        • models
  • Net
  • None
  • PHP
  • system
    • base
    • caching
      • dependencies
    • collections
    • console
    • db
      • ar
      • schema
        • cubrid
        • mssql
        • mysql
        • oci
        • pgsql
        • sqlite
    • i18n
      • gettext
    • logging
    • test
    • utils
    • validators
    • web
      • actions
      • auth
      • filters
      • form
      • helpers
      • renderers
      • services
      • widgets
        • captcha
        • pagers
  • Text
    • Highlighter
  • zii
    • behaviors
    • widgets
      • grid
      • jui

Classes

  • CDateTimeParser
  • CFileHelper
  • CFormatter
  • CLocalizedFormatter
  • CMarkdownParser
  • CPasswordHelper
  • CPropertyValue
  • CTimestamp
  • CVarDumper
  • Overview
  • Package
  • Class
  • Tree

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:
  • official markdown syntax
  • markdown extra syntax
Markdown_Parser
Extended by MarkdownExtra_Parser
Extended by CMarkdownParser
Package: system\utils
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
Methods summary
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 CHtmlPurifier to purify the HTML content to avoid XSS attacks.

Transforms the content and purifies the result. This method calls the transform() method to convert markdown content into HTML content. It then uses CHtmlPurifier to purify the HTML content to avoid XSS attacks.

Parameters

$content
string
$content the markdown content

Returns

string
the purified HTML content
public string
# getDefaultCssFile( )

Returns

string
the default CSS file that is used to highlight code blocks.
public string
# _doCodeBlocks_callback( array $matches )

Callback function when a code block is matched.

Callback function when a code block is matched.

Parameters

$matches
array
$matches matches

Returns

string
the highlighted code block

Overrides

Markdown_Parser::_doCodeBlocks_callback()
public string
# _doFencedCodeBlocks_callback( array $matches )

Callback function when a fenced code block is matched.

Callback function when a fenced code block is matched.

Parameters

$matches
array
$matches matches

Returns

string
the highlighted code block

Overrides

MarkdownExtra_Parser::_doFencedCodeBlocks_callback()
protected string
# highlightCodeBlock( string $codeblock )

Highlights the code block.

Highlights the code block.

Parameters

$codeblock
string
$codeblock the code block

Returns

string
the highlighted code block. Null if the code block does not need to highlighted
protected string
# getHighlightTag( string $codeblock )

Returns the user-entered highlighting options.

Returns the user-entered highlighting options.

Parameters

$codeblock
string
$codeblock code block with highlighting options.

Returns

string
the user-entered highlighting options. Null if no option is entered.
protected Text_Highlighter
# createHighLighter( string $options )

Creates a highlighter instance.

Creates a highlighter instance.

Parameters

$options
string
$options the user-entered options

Returns

Text_Highlighter
the highlighter instance
public array
# getHighlightConfig( string $options )

Generates the config for the highlighter.

Generates the config for the highlighter.

Parameters

$options
string
$options user-entered options

Returns

array
the highlighter config
public array
# getHiglightConfig( string $options )

Generates the config for the highlighter.

Generates the config for the highlighter.

NOTE: This method is deprecated due to a mistake in the method name. Use CMarkdownParser::getHighlightConfig() instead of this.

Parameters

$options
string
$options user-entered options

Returns

array
the highlighter config
protected mixed
# getInlineOption( string $name, string $str, mixed $defaultValue )

Retrieves the specified configuration.

Retrieves the specified configuration.

Parameters

$name
string
$name the configuration name
$str
string
$str the user-entered options
$defaultValue
mixed
$defaultValue default value if the configuration is not present

Returns

mixed
the configuration value
Methods inherited from MarkdownExtra_Parser
__construct(), _appendFootnotes_callback(), _doAbbreviations_callback(), _doDefLists_callback(), _doFencedCodeBlocks_newlines(), _doHeaders_attr(), _doHeaders_callback_atx(), _doHeaders_callback_setext(), _doTable_callback(), _doTable_leadingPipe_callback(), _hashHTMLBlocks_inHTML(), _hashHTMLBlocks_inMarkdown(), _processDefListItems_callback_dd(), _processDefListItems_callback_dt(), _stripAbbreviations_callback(), _stripFootnotes_callback(), appendFootnotes(), doAbbreviations(), doDefLists(), doFencedCodeBlocks(), doFootnotes(), doHeaders(), doTables(), formParagraphs(), hashClean(), hashHTMLBlocks(), processDefListItems(), setup(), stripAbbreviations(), stripFootnotes(), teardown()
Methods inherited from Markdown_Parser
_detab_callback(), _doAnchors_inline_callback(), _doAnchors_reference_callback(), _doAutoLinks_email_callback(), _doAutoLinks_url_callback(), _doBlockQuotes_callback(), _doBlockQuotes_callback2(), _doHardBreaks_callback(), _doImages_inline_callback(), _doImages_reference_callback(), _doLists_callback(), _hashHTMLBlocks_callback(), _initDetab(), _processListItems_callback(), _stripLinkDefinitions_callback(), _unhash_callback(), detab(), doAnchors(), doAutoLinks(), doBlockQuotes(), doCodeBlocks(), doHardBreaks(), doHorizontalRules(), doImages(), doItalicsAndBold(), doLists(), encodeAmpsAndAngles(), encodeAttribute(), encodeEmailAddress(), handleSpanToken(), hashBlock(), hashPart(), makeCodeSpan(), outdent(), parseSpan(), prepareItalicsAndBold(), processListItems(), runBasicBlockGamut(), runBlockGamut(), runSpanGamut(), stripLinkDefinitions(), transform(), unhash()
Properties summary
public string $highlightCssClass 'hl-code'
#

the css class for the div element containing the code block that is highlighted. Defaults to '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 CMarkdownParser::safeTransform() is invoked.

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 CMarkdownParser::safeTransform() is invoked.

Since

1.1.4

See

http://htmlpurifier.org/live/configdoc/plain.html
Properties inherited from MarkdownExtra_Parser
$abbr_desciptions, $abbr_word_re, $auto_close_tags_re, $block_tags_re, $clean_tags_re, $contain_span_tags_re, $context_block_tags_re, $em_relist, $em_strong_relist, $fn_backlink_class, $fn_backlink_title, $fn_id_prefix, $fn_link_class, $fn_link_title, $footnote_counter, $footnotes, $footnotes_ordered, $predef_abbr, $strong_relist
Properties inherited from Markdown_Parser
$block_gamut, $document_gamut, $em_strong_prepared_relist, $empty_element_suffix, $escape_chars, $escape_chars_re, $html_hashes, $in_anchor, $list_level, $nested_brackets_depth, $nested_brackets_re, $nested_url_parenthesis_depth, $nested_url_parenthesis_re, $no_entities, $no_markup, $predef_titles, $predef_urls, $span_gamut, $tab_width, $titles, $urls, $utf8_strlen
Magic properties summary
public string $defaultCssFile
#

The default CSS file that is used to highlight code blocks.

The default CSS file that is used to highlight code blocks.

API documentation generated by ApiGen 2.8.0