类 yii\console\Markdown
| 继承关系 | yii\console\Markdown » cebe\markdown\Parser |
|---|---|
| 使用 Traits | cebe\markdown\block\FencedCodeTrait, cebe\markdown\inline\CodeTrait, cebe\markdown\inline\EmphStrongTrait, cebe\markdown\inline\StrikeoutTrait |
| 可用版本 | 2.0 |
| 源代码 | https://github.com/yiisoft/yii2/blob/master/framework/console/Markdown.php |
一个 Markdown 解析器,增强了 Markdown 在控制台环境中的可读性。
基于 cebe/markdown.
受保护的方法
| 方法 | 描述 | 定义于 |
|---|---|---|
| renderCode() | 渲染代码块。 | yii\console\Markdown |
| renderEmph() | 渲染强调元素。 | yii\console\Markdown |
| renderInlineCode() | 渲染内联代码片段 `。 |
yii\console\Markdown |
| renderParagraph() | 渲染段落块。 | yii\console\Markdown |
| renderStrike() | 渲染删除线功能。 | yii\console\Markdown |
| renderStrong() | 渲染强元素。 | yii\console\Markdown |
属性详情
这些是 "可转义" 的字符。当使用这些字符前缀一个反斜杠时,字符将被输出,没有反斜杠,并且不会被解释为 markdown。
方法详情
渲染代码块。
| protected string renderCode ( $block ) | ||
| $block | array | |
protected function renderCode($block)
{
return Console::ansiFormat($block['content'], [Console::NEGATIVE]) . "\n\n";
}
渲染强调元素。
| protected string renderEmph ( $element ) | ||
| $element | array | |
protected function renderEmph($element)
{
return Console::ansiFormat($this->renderAbsy($element[1]), [Console::ITALIC]);
}
渲染内联代码片段 `。
| protected string renderInlineCode ( $element ) | ||
| $element | array | |
protected function renderInlineCode($element)
{
return Console::ansiFormat($element[1], [Console::UNDERLINE]);
}
渲染段落块。
| protected string renderParagraph ( $block ) | ||
| $block | string | |
protected function renderParagraph($block)
{
return rtrim($this->renderAbsy($block['content'])) . "\n\n";
}
渲染删除线功能。
| protected string renderStrike ( $element ) | ||
| $element | array | |
protected function renderStrike($element)
{
return Console::ansiFormat($this->parseInline($this->renderAbsy($element[1])), [Console::CROSSED_OUT]);
}
渲染强元素。
| protected string renderStrong ( $element ) | ||
| $element | array | |
protected function renderStrong($element)
{
return Console::ansiFormat($this->renderAbsy($element[1]), [Console::BOLD]);
}
注册 或 登录 才能评论。