yii\helpers\Markdown - Yii2 类参考手册

Class yii\helpers\Markdown

Inheritanceyii\helpers\Markdown » yii\helpers\BaseMarkdown
Available since version2.0

Markdown provides an ability to transform markdown into HTML.

Basic usage is the following:

$myHtml = Markdown::process($myText); // use original markdown flavor
$myHtml = Markdown::process($myText, 'gfm'); // use github flavored markdown
$myHtml = Markdown::process($myText, 'extra'); // use markdown extra

You can configure multiple flavors using the $flavors property.

For more details please refer to the Markdown library documentation.

Note: The Markdown library works with PHPDoc annotations so if you use it together with PHP opcache make sure it does not strip comments.

Public Properties

隐藏继承的属性 Hide inherited properties

属性Property类型 Type简介 Description定义在 Defined By
$defaultFlavor string The markdown flavor to use when none is specified explicitly. yii\helpers\BaseMarkdown
$flavors array A map of markdown flavor names to corresponding parser class configurations. yii\helpers\BaseMarkdown

Public Methods

隐藏继承的方法 Hide inherited methods

方法 Method简介 Description定义在 Defined By
process() Converts markdown into HTML. yii\helpers\BaseMarkdown
processParagraph() Converts markdown into HTML but only parses inline elements. yii\helpers\BaseMarkdown

Protected Methods

隐藏继承的方法 Hide inherited methods

方法 Method简介 Description定义在 Defined By
getParser() yii\helpers\BaseMarkdown