convertToHtml() public méthode

Converts CommonMark to HTML.
public convertToHtml ( string $commonMark ) : string
$commonMark string
Résultat string
Exemple #1
0
 public function getArticle($uri)
 {
     $environment = Environment::createCommonMarkEnvironment();
     $environment->addExtension(new TableExtension());
     $converter = new Converter(new DocParser($environment), new HtmlRenderer($environment));
     $contents = \Storage::get($uri . '.md');
     preg_match('/^.*$/m', $contents, $matches);
     return view('portal', array('body' => $converter->convertToHtml($contents), 'title' => substr($matches[0], 2)));
 }
 /**
  * Compile the view at the given path.
  *
  * @param string $path
  *
  * @return void
  */
 public function compile($path)
 {
     $contents = $this->markdown->convertToHtml($this->files->get($path));
     $this->files->put($this->getCompiledPath($path), $contents);
 }
 /**
  * Get the evaluated contents of the view.
  *
  * @param string $path
  * @param array  $data
  *
  * @return string
  */
 public function get($path, array $data = [])
 {
     $contents = parent::get($path, $data);
     return $this->markdown->convertToHtml($contents);
 }
 /**
  * {@inheritdoc}
  */
 public function convert(ConverterContextInterface $converterContext)
 {
     $converterContext->setContent($this->converter->convertToHtml($converterContext->content()));
 }
 /**
  * Compile the view at the given path.
  *
  * @param string $path
  *
  * @return void
  */
 public function compile($path)
 {
     $contents = $this->reStructuredText->convertToHtml($this->files->get($path));
     $this->files->put($this->getCompiledPath($path), $contents);
 }
Exemple #6
0
 /**
  * Converts CommonMark to HTML.
  *
  * @param string $commonMark
  * @return string 
  * @api 
  * @static 
  */
 public static function convertToHtml($commonMark)
 {
     return \League\CommonMark\Converter::convertToHtml($commonMark);
 }