-
Notifications
You must be signed in to change notification settings - Fork 320
Open
Labels
Description
Steps to reproduce the problem (provide example Markdown if applicable):
List:
1. 2) 2026.
end
Expected behavior:
List:
1. 2) 2026.
end
Actual behavior: (too many spaces, increasing times after times)
List:
1. 2) 2026.
end
(Also see what the reference implementation does: https://spec.commonmark.org/dingus/)
import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.jupiter.api.Assertions.assertAll;
import org.commonmark.node.Node;
import org.commonmark.parser.Parser;
import org.commonmark.renderer.text.LineBreakRendering;
import org.commonmark.renderer.text.TextContentRenderer;
import org.junit.jupiter.api.Test;
public class CommonMarkTest {
String parse(String markdown) {
Parser parser = Parser.builder() //
.build();
Node document = parser.parse(markdown);
TextContentRenderer renderer = TextContentRenderer.builder() //
.lineBreakRendering(LineBreakRendering.COMPACT) //
.build();
return renderer.render(document);
}
@Test
void listTest_inline_ko() {
assertAll( //
() -> assertThat(parse("""
List:
1. 2) 2026.
end""")) //
.isEqualTo("""
List:
1. 2) 2026.
end"""),
() -> assertThat(parse("""
List:
1. first
2. 2025. 2026. 2027.
end""")) //
.isEqualTo("""
List:
1. first
2. 2025. 2026. 2027.
end""") //
);
}
}