Răsfoiți Sursa

fix(lists linebreaks): fix lists linebreaks in html output

Closes #291
Estevao Soares dos Santos 8 ani în urmă
părinte
comite
2b813cd3fb
39 a modificat fișierele cu 16 adăugiri și 77 ștergeri
  1. 4 4
      dist/showdown.js
  2. 0 0
      dist/showdown.js.map
  3. 0 0
      dist/showdown.min.js
  4. 0 0
      dist/showdown.min.js.map
  5. 4 4
      src/subParsers/lists.js
  6. 0 1
      test/cases/blockquote-nested-markdown.html
  7. 0 1
      test/cases/doubline-list.html
  8. 0 2
      test/cases/list-followed-by-blockquote.html
  9. 0 2
      test/cases/list-followed-by-ghcode.html
  10. 0 1
      test/cases/multi-paragraph-list.html
  11. 0 1
      test/cases/multiline-unordered-list.html
  12. 0 2
      test/cases/ordered-list-same-number.html
  13. 0 2
      test/cases/ordered-list-wrong-numbers.html
  14. 0 2
      test/cases/ordered-list.html
  15. 0 4
      test/cases/paragraphed-list-with-sublists.html
  16. 0 2
      test/cases/unordered-list-asterisk.html
  17. 0 2
      test/cases/unordered-list-minus.html
  18. 0 2
      test/cases/unordered-list-plus.html
  19. 0 3
      test/features/#164.4.tasklists.html
  20. 0 1
      test/features/#259.es6-template-strings-indentation-issues.html
  21. 0 2
      test/ghost/underscore.html
  22. 0 3
      test/issues/#142.odd-behaviour-for-multiple-consecutive-lists.html
  23. 6 7
      test/issues/#183.gh-code-blocks-within-lists-do-not-render-properly.html
  24. 0 4
      test/issues/#196.entity-in-code-block-in-nested-list.html
  25. 2 3
      test/issues/#288.code-blocks-containing-xml-comments-are-not-converted-correctly-when-nested-in-list-items.html
  26. 0 1
      test/karlcow/list-multiparagraphs-tab.html
  27. 0 1
      test/karlcow/list-multiparagraphs.html
  28. 0 1
      test/karlcow/ordered-list-inner-par-list.html
  29. 0 2
      test/karlcow/ordered-list-items-random-number.html
  30. 0 2
      test/karlcow/ordered-list-items.html
  31. 0 2
      test/karlcow/unordered-list-items-asterisk.html
  32. 0 2
      test/karlcow/unordered-list-items-dashsign.html
  33. 0 2
      test/karlcow/unordered-list-items-leading-1space.html
  34. 0 2
      test/karlcow/unordered-list-items-leading-2spaces.html
  35. 0 2
      test/karlcow/unordered-list-items-leading-3spaces.html
  36. 0 2
      test/karlcow/unordered-list-items-plussign.html
  37. 0 1
      test/karlcow/unordered-list-paragraphs.html
  38. 0 1
      test/karlcow/unordered-list-unindented-content.html
  39. 0 1
      test/karlcow/unordered-list-with-indented-content.html

+ 4 - 4
dist/showdown.js

@@ -1987,7 +1987,7 @@ showdown.subParser('lists', function (text, options, globals) {
           item = showdown.subParser('spanGamut')(item, options, globals);
         }
       }
-      item =  '\n<li' + bulletStyle + '>' + item + '</li>\n';
+      item =  '<li' + bulletStyle + '>' + item + '</li>\n';
       return item;
     });
 
@@ -2022,7 +2022,7 @@ showdown.subParser('lists', function (text, options, globals) {
         var pos = txt.search(counterRxg);
         if (pos !== -1) {
           // slice
-          result += '\n<' + listType + '>' + processListItems(txt.slice(0, pos), !!trimTrailing) + '</' + listType + '>\n';
+          result += '\n<' + listType + '>\n' + processListItems(txt.slice(0, pos), !!trimTrailing) + '</' + listType + '>\n';
 
           // invert counterType and listType
           listType = (listType === 'ul') ? 'ol' : 'ul';
@@ -2031,14 +2031,14 @@ showdown.subParser('lists', function (text, options, globals) {
           //recurse
           parseCL(txt.slice(pos));
         } else {
-          result += '\n<' + listType + '>' + processListItems(txt, !!trimTrailing) + '</' + listType + '>\n';
+          result += '\n<' + listType + '>\n' + processListItems(txt, !!trimTrailing) + '</' + listType + '>\n';
         }
       })(list);
       for (var i = 0; i < subLists.length; ++i) {
 
       }
     } else {
-      result = '\n<' + listType + '>' + processListItems(list, !!trimTrailing) + '</' + listType + '>\n';
+      result = '\n<' + listType + '>\n' + processListItems(list, !!trimTrailing) + '</' + listType + '>\n';
     }
 
     return result;

Fișier diff suprimat deoarece este prea mare
+ 0 - 0
dist/showdown.js.map


Fișier diff suprimat deoarece este prea mare
+ 0 - 0
dist/showdown.min.js


Fișier diff suprimat deoarece este prea mare
+ 0 - 0
dist/showdown.min.js.map


+ 4 - 4
src/subParsers/lists.js

@@ -77,7 +77,7 @@ showdown.subParser('lists', function (text, options, globals) {
           item = showdown.subParser('spanGamut')(item, options, globals);
         }
       }
-      item =  '\n<li' + bulletStyle + '>' + item + '</li>\n';
+      item =  '<li' + bulletStyle + '>' + item + '</li>\n';
       return item;
     });
 
@@ -112,7 +112,7 @@ showdown.subParser('lists', function (text, options, globals) {
         var pos = txt.search(counterRxg);
         if (pos !== -1) {
           // slice
-          result += '\n<' + listType + '>' + processListItems(txt.slice(0, pos), !!trimTrailing) + '</' + listType + '>\n';
+          result += '\n<' + listType + '>\n' + processListItems(txt.slice(0, pos), !!trimTrailing) + '</' + listType + '>\n';
 
           // invert counterType and listType
           listType = (listType === 'ul') ? 'ol' : 'ul';
@@ -121,14 +121,14 @@ showdown.subParser('lists', function (text, options, globals) {
           //recurse
           parseCL(txt.slice(pos));
         } else {
-          result += '\n<' + listType + '>' + processListItems(txt, !!trimTrailing) + '</' + listType + '>\n';
+          result += '\n<' + listType + '>\n' + processListItems(txt, !!trimTrailing) + '</' + listType + '>\n';
         }
       })(list);
       for (var i = 0; i < subLists.length; ++i) {
 
       }
     } else {
-      result = '\n<' + listType + '>' + processListItems(list, !!trimTrailing) + '</' + listType + '>\n';
+      result = '\n<' + listType + '>\n' + processListItems(list, !!trimTrailing) + '</' + listType + '>\n';
     }
 
     return result;

+ 0 - 1
test/cases/blockquote-nested-markdown.html

@@ -2,7 +2,6 @@
   <h2 id="thisisaheader">This is a header.</h2>
   <ol>
     <li>This is the first list item.</li>
-
     <li>This is the second list item.</li>
   </ol>
   <p>Here's some example code:</p>

+ 0 - 1
test/cases/doubline-list.html

@@ -1,5 +1,4 @@
 <ul>
   <li><p>Bird</p></li>
-
   <li><p>Magic</p></li>
 </ul>

+ 0 - 2
test/cases/list-followed-by-blockquote.html

@@ -1,7 +1,6 @@
 <h1 id="sometitle">some title</h1>
 <ol>
     <li>list item 1</li>
-
     <li>list item 2</li>
 </ol>
 <blockquote>
@@ -9,6 +8,5 @@
 </blockquote>
 <ul>
     <li>another list item 1</li>
-
     <li>another list item 2</li>
 </ul>

+ 0 - 2
test/cases/list-followed-by-ghcode.html

@@ -1,7 +1,6 @@
 <h1 id="sometitle">some title</h1>
 <ol>
     <li>list item 1</li>
-
     <li>list item 2</li>
 </ol>
 <pre><code>some code
@@ -10,6 +9,5 @@
 </code></pre>
 <ul>
     <li>another list item 1</li>
-
     <li>another list item 2</li>
 </ul>

+ 0 - 1
test/cases/multi-paragraph-list.html

@@ -1,6 +1,5 @@
 <ol>
   <li><p>This is a major bullet point.</p>
     <p>That contains multiple paragraphs.</p></li>
-
   <li><p>And another line</p></li>
 </ol>

+ 0 - 1
test/cases/multiline-unordered-list.html

@@ -1,6 +1,5 @@
 <ul>
   <li>This line spans
     more than one line and is lazy</li>
-
   <li>Similar to this line</li>
 </ul>

+ 0 - 2
test/cases/ordered-list-same-number.html

@@ -1,7 +1,5 @@
 <ol>
   <li>Red</li>
-
   <li>Green</li>
-
   <li>Blue</li>
 </ol>

+ 0 - 2
test/cases/ordered-list-wrong-numbers.html

@@ -1,7 +1,5 @@
 <ol>
   <li>Red</li>
-
   <li>Green</li>
-
   <li>Blue</li>
 </ol>

+ 0 - 2
test/cases/ordered-list.html

@@ -1,7 +1,5 @@
 <ol>
   <li>Red</li>
-
   <li>Green</li>
-
   <li>Blue</li>
 </ol>

+ 0 - 4
test/cases/paragraphed-list-with-sublists.html

@@ -2,14 +2,10 @@
   <li><p>foo</p>
     <ul>
       <li><p>bazinga</p></li>
-
       <li><p>yeah</p></li></ul></li>
-
   <li><p>bar</p>
     <ol>
       <li><p>damn</p></li>
-
       <li><p>so many paragraphs</p></li></ol></li>
-
   <li><p>baz</p></li>
 </ul>

+ 0 - 2
test/cases/unordered-list-asterisk.html

@@ -1,7 +1,5 @@
 <ul>
   <li>Red</li>
-
   <li>Green</li>
-
   <li>Blue</li>
 </ul>

+ 0 - 2
test/cases/unordered-list-minus.html

@@ -1,7 +1,5 @@
 <ul>
   <li>Red</li>
-
   <li>Green</li>
-
   <li>Blue</li>
 </ul>

+ 0 - 2
test/cases/unordered-list-plus.html

@@ -1,7 +1,5 @@
 <ul>
   <li>Red</li>
-
   <li>Green</li>
-
   <li>Blue</li>
 </ul>

+ 0 - 3
test/features/#164.4.tasklists.html

@@ -1,11 +1,8 @@
 <h1 id="mythings">my things</h1>
 <ul>
     <li>foo</li>
-
     <li class="task-list-item" style="list-style-type: none;"><input type="checkbox" disabled style="margin: 0px 0.35em 0.25em -1.6em; vertical-align: middle;"> bar</li>
-
     <li class="task-list-item" style="list-style-type: none;"><input type="checkbox" disabled style="margin: 0px 0.35em 0.25em -1.6em; vertical-align: middle;"> baz</li>
-
     <li class="task-list-item" style="list-style-type: none;"><input type="checkbox" disabled style="margin: 0px 0.35em 0.25em -1.6em; vertical-align: middle;" checked> bazinga</li>
 </ul>
 <p>otherthings</p>

+ 0 - 1
test/features/#259.es6-template-strings-indentation-issues.html

@@ -2,6 +2,5 @@
 <p>you can use markdown for card documentation</p>
 <ul>
     <li>foo</li>
-
     <li>bar</li>
 </ul>

+ 0 - 2
test/ghost/underscore.html

@@ -23,7 +23,6 @@
 <h3 id="foo_bar_bazfoo_bar_baz_bar_foo_foo_barbaz_bar_baz_foo-1">foo_bar_baz foo_bar_baz_bar_foo <em>foo_bar baz_bar</em> baz_foo</h3>
 <ol>
 <li>foo_bar_baz foo_bar_baz_bar_foo <em>foo_bar baz_bar</em> baz_foo</li>
-
 <li>foo_bar_baz foo_bar_baz_bar_foo <em>foo_bar baz_bar</em> baz_foo</li>
 </ol>
 <blockquote>
@@ -31,7 +30,6 @@
 </blockquote>
 <ul>
 <li>foo_bar_baz foo_bar_baz_bar_foo <em>foo_bar baz_bar</em> baz_foo</li>
-
 <li>foo_bar_baz foo_bar_baz_bar_foo <em>foo_bar baz_bar</em> baz_foo</li>
 </ul>
 <hr />

+ 0 - 3
test/issues/#142.odd-behaviour-for-multiple-consecutive-lists.html

@@ -1,15 +1,12 @@
 <ul>
     <li>Item 1</li>
-
     <li>Item 2</li>
 </ul>
 <ol>
     <li>Item 1</li>
-
     <li>Item 2</li>
 </ol>
 <ul>
     <li>Item 1</li>
-
     <li>Item 2</li>
 </ul>

+ 6 - 7
test/issues/#183.gh-code-blocks-within-lists-do-not-render-properly.html

@@ -1,13 +1,12 @@
 <ol>
-    <li><p>Hi, I am a thing</p>
-        <pre><code class="sh language-sh">$ git clone thing.git
+<li><p>Hi, I am a thing</p>
+<pre><code class="sh language-sh">$ git clone thing.git
 
 dfgdfg
-        </code></pre></li>
-
-    <li><p>I am another thing!</p>
-        <pre><code class="sh language-sh">$ git clone other-thing.git
+</code></pre></li>
+<li><p>I am another thing!</p>
+<pre><code class="sh language-sh">$ git clone other-thing.git
 
 foobar
-        </code></pre></li>
+</code></pre></li>
 </ol>

+ 0 - 4
test/issues/#196.entity-in-code-block-in-nested-list.html

@@ -1,21 +1,17 @@
 <p>Test pre in a list</p>
 <ul>
     <li>&amp; &lt;</li>
-
     <li><code>&amp; &lt;</code>
 
         <ul>
             <li>&amp; &lt;</li>
-
             <li><code>&amp; &lt;</code>
 
                 <ul>
                     <li>&amp; &lt;</li>
-
                     <li><code>&amp; &lt;</code>
 
                         <ul>
                             <li>&amp; &lt;</li>
-
                             <li><code>&amp; &lt;</code></li></ul></li></ul></li></ul></li>
 </ul>

+ 2 - 3
test/issues/#288.code-blocks-containing-xml-comments-are-not-converted-correctly-when-nested-in-list-items.html

@@ -1,5 +1,5 @@
 <ul>
-   <li><p>list item 1</p>
+<li><p>list item 1</p>
 <pre><code>&lt;parent&gt;
 &lt;child&gt;child1&lt;/child&gt;
 &lt;!-- This is a comment --&gt;
@@ -7,8 +7,7 @@
 &lt;child&gt;some text &lt;!-- a comment --&gt;&lt;/child&gt;
 &lt;/parent&gt;
 </code></pre></li>
-
-   <li><p>list item 2</p></li>
+<li><p>list item 2</p></li>
 </ul>
 <pre><code>&lt;parent&gt;
 &lt;child&gt;child1&lt;/child&gt;

+ 0 - 1
test/karlcow/list-multiparagraphs-tab.html

@@ -5,6 +5,5 @@ mi posuere lectus.</p>
 <p>Vestibulum enim wisi, viverra nec, fringilla in, laoreet
 vitae, risus. Donec sit amet nisl. Aliquam semper ipsum
 sit amet velit.</p></li>
-
 <li><p>Suspendisse id sem consectetuer libero luctus adipiscing.</p></li>
 </ul>

+ 0 - 1
test/karlcow/list-multiparagraphs.html

@@ -5,6 +5,5 @@ mi posuere lectus.</p>
 <p>Vestibulum enim wisi, viverra nec, fringilla in, laoreet
 vitae, risus. Donec sit amet nisl. Aliquam semper ipsum
 sit amet velit.</p></li>
-
 <li><p>Suspendisse id sem consectetuer libero luctus adipiscing.</p></li>
 </ul>

+ 0 - 1
test/karlcow/ordered-list-inner-par-list.html

@@ -2,6 +2,5 @@
   <li><p>1</p>
     <ul>
       <li>inner par list</li></ul></li>
-
   <li><p>2</p></li>
 </ol>

+ 0 - 2
test/karlcow/ordered-list-items-random-number.html

@@ -1,7 +1,5 @@
 <ol>
     <li>list item 1</li>
-
     <li>list item 2</li>
-
     <li>list item 3</li>
 </ol>

+ 0 - 2
test/karlcow/ordered-list-items.html

@@ -1,7 +1,5 @@
 <ol>
     <li>list item 1</li>
-
     <li>list item 2</li>
-
     <li>list item 3</li>
 </ol>

+ 0 - 2
test/karlcow/unordered-list-items-asterisk.html

@@ -1,7 +1,5 @@
 <ul>
     <li>list item 1</li>
-
     <li>list item 2</li>
-
     <li>list item 3</li>
 </ul>

+ 0 - 2
test/karlcow/unordered-list-items-dashsign.html

@@ -1,7 +1,5 @@
 <ul>
     <li>list item 1</li>
-
     <li>list item 2</li>
-
     <li>list item 3</li>
 </ul>

+ 0 - 2
test/karlcow/unordered-list-items-leading-1space.html

@@ -1,7 +1,5 @@
 <ul>
     <li>list item 1</li>
-
     <li>list item 2</li>
-
     <li>list item 3</li>
 </ul>

+ 0 - 2
test/karlcow/unordered-list-items-leading-2spaces.html

@@ -1,7 +1,5 @@
 <ul>
     <li>list item 1</li>
-
     <li>list item 2</li>
-
     <li>list item 3</li>
 </ul>

+ 0 - 2
test/karlcow/unordered-list-items-leading-3spaces.html

@@ -1,7 +1,5 @@
 <ul>
     <li>list item 1</li>
-
     <li>list item 2</li>
-
     <li>list item 3</li>
 </ul>

+ 0 - 2
test/karlcow/unordered-list-items-plussign.html

@@ -1,7 +1,5 @@
 <ul>
     <li>list item 1</li>
-
     <li>list item 2</li>
-
     <li>list item 3</li>
 </ul>

+ 0 - 1
test/karlcow/unordered-list-paragraphs.html

@@ -1,5 +1,4 @@
 <ul>
 <li><p>list item in paragraph</p></li>
-
 <li><p>another list item in paragraph</p></li>
 </ul>

+ 0 - 1
test/karlcow/unordered-list-unindented-content.html

@@ -1,5 +1,4 @@
 <ul>
 <li>This a very long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long paragraph in a list.</li>
-
 <li>and yet another long long long long long long long long long long long long long long long long long long long long long long line.</li>
 </ul>

+ 0 - 1
test/karlcow/unordered-list-with-indented-content.html

@@ -2,7 +2,6 @@
 <li>This is a list item
 with the content on
 multiline and indented.</li>
-
 <li>And this another list item
 with the same principle.</li>
 </ul>

Unele fișiere nu au fost afișate deoarece prea multe fișiere au fost modificate în acest diff