templateRenderer = new Template();
return ['daux' => $config];
}
public function testNoTOCByDefault()
{
$converter = new CommonMarkConverter($this->getConfig());
$this->assertEquals("
Test
\n", $converter->convertToHtml('# Test'));
}
public function testTOCToken()
{
$converter = new CommonMarkConverter($this->getConfig());
$source = "[TOC]\n# Title";
$expected = <<<'EXPECTED'
Title
EXPECTED;
$this->assertEquals($expected, $converter->convertToHtml($source));
}
public function testUnicodeTOC()
{
$converter = new CommonMarkConverter($this->getConfig());
$source = "[TOC]\n# 基础操作\n# 操作基础";
$expected = <<<'EXPECTED'
基础操作
操作基础
EXPECTED;
$this->assertEquals($expected, $converter->convertToHtml($source));
}
public function testDuplicatedTOC()
{
$converter = new CommonMarkConverter($this->getConfig());
$source = "[TOC]\n# Test\n# Test";
$expected = <<<'EXPECTED'
Test
Test
EXPECTED;
$this->assertEquals($expected, $converter->convertToHtml($source));
}
public function testEscapedTOC()
{
$converter = new CommonMarkConverter($this->getConfig());
$source = "[TOC]\n# TEST : Test";
$expected = <<<'EXPECTED'
TEST : Test
EXPECTED;
$this->assertEquals($expected, $converter->convertToHtml($source));
}
}