Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,12 @@ public void visit(Document document) {

@Override
public void visit(ThematicBreak thematicBreak) {
// Let's use ___ as it doesn't introduce ambiguity with * or - list item markers
writer.raw("___");
String literal = thematicBreak.getLiteral();
if (literal == null) {
// Let's use ___ as it doesn't introduce ambiguity with * or - list item markers
literal = "___";
}
writer.raw(literal);
writer.block();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,14 @@ public void testThematicBreaks() {
// List item with hr -> hr needs to not use the same as the marker
assertRoundTrip("* ___\n");
assertRoundTrip("- ___\n");

// Preserve the literal
assertRoundTrip("----\n");
assertRoundTrip("*****\n");

// Apply fallback for null literal
ThematicBreak node = new ThematicBreak();
assertEquals("___", render(node));
}

@Test
Expand Down