/** * Process $text using settings without explode \n to <p> * $ntext = true change \n to <br> * @param $text * @param bool $ntext * @return string */ public function directTypo($text) { $t = $this->Setup(); $text = Markdown::processParagraph($text, $this->markdownType); $t->set_text($text); return $t->apply(); }
public function run() { if ($this->hasModel()) { $tagOptions = ArrayHelper::merge($this->options, ['id' => $this->targetId, 'class' => $this->clientOptions['class'] ?: '', 'data' => ['target' => $this->options['id']]]); if (isset($this->clientOptions['inline'])) { $value = Markdown::processParagraph(Html::getAttributeValue($this->model, $this->attribute)); echo Html::tag($this->clientOptions['tag'] ?: 'p', $value, $tagOptions); } else { $value = MarkdownExtra::defaultTransform(Html::getAttributeValue($this->model, $this->attribute)); echo Html::tag('section', Html::tag($this->clientOptions['tag'] ?: 'p', $value), $tagOptions); } echo Html::activeHiddenInput($this->model, $this->attribute); } $this->registerPlugin(); }
/** * Converts markdown into HTML * * @param string $content * @param TypeDoc $context * @param boolean $paragraph * @return string */ public static function process($content, $context = null, $paragraph = false) { if (!isset(Markdown::$flavors['api-latex'])) { Markdown::$flavors['api-latex'] = new static(); } if (is_string($context)) { $context = static::$renderer->apiContext->getType($context); } Markdown::$flavors['api-latex']->renderingContext = $context; if ($paragraph) { return Markdown::processParagraph($content, 'api-latex'); } else { return Markdown::process($content, 'api-latex'); } }