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