示例#1
0
 /**
  * convert 
  * 
  * @param string $text 
  * @return string
  */
 public static function convert($text)
 {
     static $docParser, $renderer;
     if (empty($docParser)) {
         $docParser = new CommonMark_DocParser();
     }
     if (empty($renderer)) {
         $renderer = new HtmlRendererExtra();
     }
     $doc = $docParser->parse($text);
     return $renderer->render($doc);
 }
示例#2
0
 /**
  * @param DocParser $self 
  * @param mixed $oldTip 
  * @param mixed $lastMatchedContainer 
  * @param mixed $lineNumber 
  * @param bool $closeUnmatchedBlocksAlreadyDone 
  */
 protected function closeUnmatchedBlocks(CommonMark_DocParser $self, $oldTip, $lastMatchedContainer, $lineNumber, &$closeUnmatchedBlocksAlreadyDone)
 {
     // finalize any blocks not matched
     while (!$closeUnmatchedBlocksAlreadyDone && $oldTip != $lastMatchedContainer && $oldTip !== null) {
         $self->finalize($oldTip, $lineNumber);
         $oldTip = $oldTip->getParent();
     }
     $closeUnmatchedBlocksAlreadyDone = true;
 }