-
Notifications
You must be signed in to change notification settings - Fork 48
Expand file tree
/
Copy pathCodeRendererTest.php
More file actions
36 lines (28 loc) · 978 Bytes
/
CodeRendererTest.php
File metadata and controls
36 lines (28 loc) · 978 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?php
namespace Torchlight\Commonmark\Tests\V1;
use League\CommonMark\DocParser;
use League\CommonMark\Environment;
use League\CommonMark\Extension\Attributes\AttributesExtension;
use League\CommonMark\HtmlRenderer;
use Torchlight\Commonmark\Tests\BaseRendererTest;
class CodeRendererTest extends BaseRendererTest
{
protected function version()
{
return 1;
}
protected function extension()
{
return new \Torchlight\Commonmark\V1\TorchlightExtension();
}
protected function render($markdown, $extension = null)
{
$environment = Environment::createCommonMarkEnvironment();
$environment->addExtension(new AttributesExtension);
$environment->addExtension($extension ?? $this->extension());
$parser = new DocParser($environment);
$htmlRenderer = new HtmlRenderer($environment);
$document = $parser->parse($markdown);
return $htmlRenderer->renderBlock($document);
}
}