@@ -38,7 +38,7 @@ public void testHeaders() {
3838 String markdown = "# Header\n \n ##Section\n \n Some text!" ;
3939 String html = new Markdown (false ).transform (markdown );
4040
41- assertEquals ("<h1 id='header'>Header</h1><h2 id='section'>Section</h2><p>Some text!</p>" , removeNewLines (html ));
41+ assertEquals ("<h1 id='header'>Header</h1><h2 id='section'>Section</h2><p>Some text!</p>" , normalize (html ));
4242
4343 }
4444
@@ -48,7 +48,7 @@ public void testBlockquote() {
4848 String markdown = "> Some quote" ;
4949 String html = new Markdown (false ).transform (markdown );
5050
51- assertEquals ("<blockquote><p>Some quote</p></blockquote>" , removeNewLines (html ));
51+ assertEquals ("<blockquote><p>Some quote</p></blockquote>" , normalize (html ));
5252
5353 }
5454
@@ -58,7 +58,7 @@ public void testLists() {
5858 String markdown = "* One\n * Two" ;
5959 String html = new Markdown (false ).transform (markdown );
6060
61- assertEquals ("<ul><li>One</li><li>Two</li></ul>" , removeNewLines (html ));
61+ assertEquals ("<ul><li>One</li><li>Two</li></ul>" , normalize (html ));
6262
6363 }
6464
@@ -68,7 +68,7 @@ public void testCode() {
6868 String markdown = " private int n = 0;" ;
6969 String html = new Markdown (false ).transform (markdown );
7070
71- assertEquals ("<pre><code>private int n = 0;</code></pre>" , removeNewLines (html ));
71+ assertEquals ("<pre><code>private int n = 0;</code></pre>" , normalize (html ));
7272
7373 }
7474
@@ -85,8 +85,8 @@ public void testFullHtmlDocument() {
8585
8686 }
8787
88- private static String removeNewLines (String s ) {
89- return s .replaceAll ("\n " , "" );
88+ private static String normalize (String s ) {
89+ return s .replaceAll ("\n " , "" ). replaceAll ( "[ \t ]+" , " " ). trim () ;
9090 }
9191
9292}
0 commit comments