Skip to content

Commit

Permalink
[DOXIA-747] Emit headings at beginning of line for Markdown
Browse files Browse the repository at this point in the history
  • Loading branch information
kwin committed Oct 8, 2024
1 parent 864eb9c commit b054e54
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,7 @@ public void date_() {
@Override
public void sectionTitle(int level, SinkEventAttributes attributes) {
if (level > 0) {
ensureBeginningOfLine();
writeUnescaped(StringUtils.repeat(SECTION_TITLE_START_MARKUP, level) + SPACE);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -498,4 +498,19 @@ public void testNestedListWithBlockquotesParagraphsAndCode() {

assertEquals(expected, getSinkContent(), "Wrong inline code!");
}

@Test
public void testHeadingAfterInlineElement() {
try (final Sink sink = getSink()) {
sink.text("Text");
sink.section1();
sink.sectionTitle1();
sink.text("Section1");
sink.sectionTitle1_();
sink.section1_();
}
// heading must be on a new line
String expected = "Text" + EOL + "# Section1" + EOL + EOL;
assertEquals(expected, getSinkContent(), "Wrong heading after inline element!");
}
}

0 comments on commit b054e54

Please sign in to comment.