File tree Expand file tree Collapse file tree 4 files changed +26
-2
lines changed
main/java/org/commonmark/internal
test/java/org/commonmark/test Expand file tree Collapse file tree 4 files changed +26
-2
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,11 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
66This project adheres to [ Semantic Versioning] ( http://semver.org/spec/v2.0.0.html ) ,
77with the exception that 0.x versions can break between minor versions.
88
9+ ## [ Unreleased]
10+ ### Fixed
11+ - Line(s) after a hard line break would sometimes also get an unwanted hard
12+ line break, e.g. if they ended in emphasis or other non-text inlines (#415 )
13+
914## [ 0.27.0] - 2025-10-12
1015### Added
1116- Autolink extension: Now supports configuration of different link types that
@@ -510,6 +515,7 @@ API breaking changes (caused by changes in spec):
510515Initial release of commonmark-java, a port of commonmark.js with extensions
511516for autolinking URLs, GitHub flavored strikethrough and tables.
512517
518+ [Unreleased]: https://github.com/commonmark/commonmark-java/compare/commonmark-parent-0.27.0...main
513519[0.27.0]: https://github.com/commonmark/commonmark-java/compare/commonmark-parent-0.26.0...commonmark-parent-0.27.0
514520[0.26.0]: https://github.com/commonmark/commonmark-java/compare/commonmark-parent-0.25.1...commonmark-parent-0.26.0
515521[0.25.1]: https://github.com/commonmark/commonmark-java/compare/commonmark-parent-0.25.0...commonmark-parent-0.25.1
Original file line number Diff line number Diff line change @@ -598,7 +598,9 @@ static String parseLinkLabel(Scanner scanner) {
598598 private Node parseLineBreak () {
599599 scanner .next ();
600600
601- if (trailingSpaces >= 2 ) {
601+ var hard = trailingSpaces >= 2 ;
602+ trailingSpaces = 0 ;
603+ if (hard ) {
602604 return new HardLineBreak ();
603605 } else {
604606 return new SoftLineBreak ();
Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ public class CoreRenderingTestCase extends RenderingTestCase {
1111
1212 @ Override
1313 protected String render (String source ) {
14- return RENDERER .render (PARSER .parse (source ));
14+ var node = PARSER .parse (source );
15+ return RENDERER .render (node );
1516 }
1617}
Original file line number Diff line number Diff line change @@ -210,4 +210,19 @@ public void htmlBlockInterruptingList() {
210210 "</ul>\n " +
211211 "</script>\n " );
212212 }
213+
214+ @ Test
215+ public void emphasisAfterHardLineBreak () {
216+ assertRendering ("Hello \n " +
217+ "**Bar**\n " +
218+ "Foo\n " , "<p>Hello<br />\n " +
219+ "<strong>Bar</strong>\n " +
220+ "Foo</p>\n " );
221+
222+ assertRendering ("Hello \n " +
223+ "**Bar** \n " +
224+ "Foo\n " , "<p>Hello<br />\n " +
225+ "<strong>Bar</strong><br />\n " +
226+ "Foo</p>\n " );
227+ }
213228}
You can’t perform that action at this time.
0 commit comments