convertWithMarkdown() публичный статический Метод

Convert the CMS-Tags into HTMl-Tags and additional convert GFM Markdown into Html as well. The main purpose of this method to fix the conflict between markdown and tag parser when using urls.
public static convertWithMarkdown ( string $text ) : string
$text string The content where the CMS-Tags should be found and convert into Html-Tags and Markdown Tags.
Результат string the COnverted output of $text.
 public function getText()
 {
     $text = $this->getVarValue('text');
     if ($this->getVarValue('textType')) {
         return TagParser::convertWithMarkdown($text);
     }
     return $text;
 }
Пример #2
0
 /**
  * @inheritdoc
  */
 public function onAfterFind($event)
 {
     if ($this->nl2br) {
         $event->sender->setAttribute($this->name, nl2br($event->sender->getAttribute($this->name)));
     }
     if ($this->markdown) {
         $event->sender->setAttribute($this->name, TagParser::convertWithMarkdown($event->sender->getAttribute($this->name)));
     }
 }
Пример #3
0
 public function getTableData()
 {
     $table = [];
     $i = 0;
     foreach ($this->getVarValue('table', []) as $key => $row) {
         ++$i;
         if ($this->getCfgValue('header', 0) == 1 && $i == 1) {
             continue;
         }
         if ($this->getCfgValue('parseMarkdown', false)) {
             foreach ($row as $k => $v) {
                 $row[$k] = TagParser::convertWithMarkdown($v);
             }
         }
         $table[] = $row;
     }
     return $table;
 }
Пример #4
0
 public function testContentWithMarkdown()
 {
     $this->assertSame('<p>foo</p>', trim(TagParser::convertWithMarkdown('foo')));
 }