convertWithMarkdown() public static method

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.
return string the COnverted output of $text.
 public function getText()
 {
     $text = $this->getVarValue('text');
     if ($this->getVarValue('textType')) {
         return TagParser::convertWithMarkdown($text);
     }
     return $text;
 }
Ejemplo n.º 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)));
     }
 }
Ejemplo n.º 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;
 }
Ejemplo n.º 4
0
 public function testContentWithMarkdown()
 {
     $this->assertSame('<p>foo</p>', trim(TagParser::convertWithMarkdown('foo')));
 }