BaseMarkdown
API reference › yii › helpers › BaseMarkdown
1 subclass
BaseMarkdown provides concrete implementation for Markdown.
Do not use BaseMarkdown. Use Markdown instead.
Properties
Section titled “Properties”| Property | Type | Description | Defined by |
|---|---|---|---|
$defaultFlavor static | string | The markdown flavor to use when none is specified explicitly. Default: 'original'. | BaseMarkdown |
$flavors static | array | A map of markdown flavor names to corresponding parser class configurations. Default: ['original' => ['class' => 'cebe\. | BaseMarkdown |
Methods
Section titled “Methods”| Method | Description | Defined by |
|---|---|---|
process() static | Converts markdown into HTML. | BaseMarkdown |
processParagraph() static | Converts markdown into HTML but only parses inline elements. | BaseMarkdown |
getParser() protected static | BaseMarkdown |
Property details
Section titled “Property details”$defaultFlavor
Section titled “$defaultFlavor ”public static string $defaultFlavor = 'original'The markdown flavor to use when none is specified explicitly.
Defaults to original.
Method details
Section titled “Method details”process()
Section titled “process() ”public static function process(string $markdown, string|null $flavor = null): stringConverts markdown into HTML.
Parameters
| Parameter | Type | Description |
|---|---|---|
$markdown | string | The markdown text to parse |
$flavor | string| | The markdown flavor to use. See $flavors for available values. Defaults to $defaultFlavor, if not set. |
Returns
string: The parsed HTML output
Throws
yii\base\InvalidArgumentException: when an undefined flavor is given.
processParagraph()
Section titled “processParagraph() ”public static function processParagraph(string $markdown, string|null $flavor = null): stringConverts markdown into HTML but only parses inline elements.
This can be useful for parsing small comments or description lines.
Parameters
| Parameter | Type | Description |
|---|---|---|
$markdown | string | The markdown text to parse |
$flavor | string| | The markdown flavor to use. See $flavors for available values. Defaults to $defaultFlavor, if not set. |
Returns
string: The parsed HTML output
Throws
yii\base\InvalidArgumentException: when an undefined flavor is given.
getParser()
Section titled “getParser() ”protected static function getParser(string|null $flavor): cebe\markdown\ParserParameters
| Parameter | Type | Description |
|---|---|---|
$flavor | string| | The markdown flavor to use. See $flavors for available values. Defaults to $defaultFlavor, if not set. |
Returns
cebe\markdown\Parser
Throws
yii\base\InvalidArgumentException: when an undefined flavor is given.