Class yii\console\Markdown
Inheritance | yii\console\Markdown » cebe\markdown\Parser |
---|---|
Uses Traits | cebe\markdown\block\FencedCodeTrait, cebe\markdown\inline\CodeTrait, cebe\markdown\inline\EmphStrongTrait, cebe\markdown\inline\StrikeoutTrait |
Available since version | 2.0 |
Source Code | https://github.com/yiisoft/yii2/blob/master/framework/console/Markdown.php |
A Markdown parser that enhances markdown for reading in console environments.
Based on cebe/markdown.
Protected Methods
Method | Description | Defined By |
---|---|---|
renderCode() | Renders a code block. | yii\console\Markdown |
renderEmph() | Renders empathized elements. | yii\console\Markdown |
renderInlineCode() | Renders an inline code span ` . |
yii\console\Markdown |
renderParagraph() | Render a paragraph block. | yii\console\Markdown |
renderStrike() | Renders the strike through feature. | yii\console\Markdown |
renderStrong() | Renders strong elements. | yii\console\Markdown |
Property Details
These are "escapeable" characters. When using one of these prefixed with a backslash, the character will be outputted without the backslash and is not interpreted as markdown.
Method Details
Renders a code block.
protected string renderCode ( $block ) | ||
$block | array |
protected function renderCode($block)
{
return Console::ansiFormat($block['content'], [Console::NEGATIVE]) . "\n\n";
}
Renders empathized elements.
protected string renderEmph ( $element ) | ||
$element | array |
protected function renderEmph($element)
{
return Console::ansiFormat($this->renderAbsy($element[1]), [Console::ITALIC]);
}
Renders an inline code span `
.
protected string renderInlineCode ( $element ) | ||
$element | array |
protected function renderInlineCode($element)
{
return Console::ansiFormat($element[1], [Console::UNDERLINE]);
}
Render a paragraph block.
protected string renderParagraph ( $block ) | ||
$block | string |
protected function renderParagraph($block)
{
return rtrim($this->renderAbsy($block['content'])) . "\n\n";
}
Renders the strike through feature.
protected string renderStrike ( $element ) | ||
$element | array |
protected function renderStrike($element)
{
return Console::ansiFormat($this->parseInline($this->renderAbsy($element[1])), [Console::CROSSED_OUT]);
}
Renders strong elements.
protected string renderStrong ( $element ) | ||
$element | array |
protected function renderStrong($element)
{
return Console::ansiFormat($this->renderAbsy($element[1]), [Console::BOLD]);
}
Signup or Login in order to comment.