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 = <<
Title
Title
EXPECTED;
$this->assertEquals($expected, $converter->convertToHtml($source));
}
public function testUnicodeTOC()
{
$converter = new CommonMarkConverter($this->getConfig());
$source = "[TOC]\n# 基础操作\n# 操作基础";
$expected = <<
基础操作
操作基础
基础操作
操作基础
EXPECTED;
$this->assertEquals($expected, $converter->convertToHtml($source));
}
public function testDuplicatedTOC()
{
$converter = new CommonMarkConverter($this->getConfig());
$source = "[TOC]\n# Test\n# Test";
$expected = <<
Test
Test
Test
Test
EXPECTED;
$this->assertEquals($expected, $converter->convertToHtml($source));
}
public function testEscapedTOC()
{
$converter = new CommonMarkConverter($this->getConfig());
$source = "[TOC]\n# TEST : Test";
$expected = <<
TEST : Test
TEST : Test
EXPECTED;
$this->assertEquals($expected, $converter->convertToHtml($source));
}
}