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

Closes #291
This commit is contained in:
Estevao Soares dos Santos 2016-09-29 01:12:27 +01:00
parent f97e072bc4
commit 2b813cd3fb
39 changed files with 12 additions and 73 deletions

BIN
dist/showdown.js vendored

Binary file not shown.

BIN
dist/showdown.js.map vendored

Binary file not shown.

BIN
dist/showdown.min.js vendored

Binary file not shown.

Binary file not shown.

View File

@ -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;

View File

@ -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>

View File

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

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

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

View File

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

View File

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

View File

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

View File

@ -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>

View File

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

View File

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

View File

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

View File

@ -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>

View File

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

View File

@ -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 />

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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;

View File

@ -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>

View File

@ -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>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -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>

View File

@ -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>