return sw.toString();
}
@Test
public void testSplit() {
Document doc = Markdown.markdown("Some stuff\n" +
"\n" +
"# First `H1`\n" +
"\n" +
"A sentence\n" +
"\n" +
"## `H2` under first `H1`" +
"\n" +
"A sentence\n" +
"\n" +
"# Second `H1`\n" +
"\n" +
"A sentence\n" +
"\n" +
"## `H2` under second `H1`" +
"\n" +
"A sentence\n" +
"\n");
List<Section> sections = Markdown.extractSections(doc);
Assert.assertEquals(3, sections.size());
Section section = sections.get(0);
Assert.assertNull(section.getHeading());
Document sectionBody = section.getDoc();
Assert.assertEquals("<p>Some stuff</p>", html(sectionBody).trim());
section = sections.get(1);
Assert.assertEquals("<h1> First <code>H1</code></h1>",
html(section.getHeading()).trim());