8
0
daux.io/libs/Format/Base/CommonMark/CommonMarkConverter.php

38 Zeilen
1.1 KiB
PHP

2015-06-29 16:16:39 +02:00
<?php namespace Todaymade\Daux\Format\Base\CommonMark;
use League\CommonMark\DocParser;
use League\CommonMark\Environment;
use League\CommonMark\HtmlRenderer;
class CommonMarkConverter extends \League\CommonMark\CommonMarkConverter
{
/**
* Create a new commonmark converter instance.
*
* @param array $config
*/
public function __construct(array $config = array())
{
$environment = Environment::createCommonMarkEnvironment();
$environment->mergeConfig($config);
2015-06-29 16:16:39 +02:00
$this->extendEnvironment($environment);
2015-07-17 18:34:00 +02:00
//TODO :: finish
//$daux->getProcessor()->extendCommonMarkEnvironment($environment);
$this->docParser = new DocParser($environment);
$this->htmlRenderer = new HtmlRenderer($environment);
}
2015-06-29 16:16:39 +02:00
protected function getLinkRenderer(Environment $environment)
{
2015-07-17 23:38:06 +02:00
return new LinkRenderer($environment->getConfig('daux'));
2015-06-29 16:16:39 +02:00
}
protected function extendEnvironment(Environment $environment)
{
$environment->addInlineRenderer('Link', $this->getLinkRenderer($environment));
}
}