Skip to content

Commit 2b813cd

Browse files
committed
fix(lists linebreaks): fix lists linebreaks in html output
Closes #291
1 parent f97e072 commit 2b813cd

39 files changed

Lines changed: 19 additions & 80 deletions

dist/showdown.js

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/showdown.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/showdown.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/showdown.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/subParsers/lists.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ showdown.subParser('lists', function (text, options, globals) {
7777
item = showdown.subParser('spanGamut')(item, options, globals);
7878
}
7979
}
80-
item = '\n<li' + bulletStyle + '>' + item + '</li>\n';
80+
item = '<li' + bulletStyle + '>' + item + '</li>\n';
8181
return item;
8282
});
8383

@@ -112,7 +112,7 @@ showdown.subParser('lists', function (text, options, globals) {
112112
var pos = txt.search(counterRxg);
113113
if (pos !== -1) {
114114
// slice
115-
result += '\n<' + listType + '>' + processListItems(txt.slice(0, pos), !!trimTrailing) + '</' + listType + '>\n';
115+
result += '\n<' + listType + '>\n' + processListItems(txt.slice(0, pos), !!trimTrailing) + '</' + listType + '>\n';
116116

117117
// invert counterType and listType
118118
listType = (listType === 'ul') ? 'ol' : 'ul';
@@ -121,14 +121,14 @@ showdown.subParser('lists', function (text, options, globals) {
121121
//recurse
122122
parseCL(txt.slice(pos));
123123
} else {
124-
result += '\n<' + listType + '>' + processListItems(txt, !!trimTrailing) + '</' + listType + '>\n';
124+
result += '\n<' + listType + '>\n' + processListItems(txt, !!trimTrailing) + '</' + listType + '>\n';
125125
}
126126
})(list);
127127
for (var i = 0; i < subLists.length; ++i) {
128128

129129
}
130130
} else {
131-
result = '\n<' + listType + '>' + processListItems(list, !!trimTrailing) + '</' + listType + '>\n';
131+
result = '\n<' + listType + '>\n' + processListItems(list, !!trimTrailing) + '</' + listType + '>\n';
132132
}
133133

134134
return result;

test/cases/blockquote-nested-markdown.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
<h2 id="thisisaheader">This is a header.</h2>
33
<ol>
44
<li>This is the first list item.</li>
5-
65
<li>This is the second list item.</li>
76
</ol>
87
<p>Here's some example code:</p>

test/cases/doubline-list.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
<ul>
22
<li><p>Bird</p></li>
3-
43
<li><p>Magic</p></li>
54
</ul>
Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
<h1 id="sometitle">some title</h1>
22
<ol>
33
<li>list item 1</li>
4-
54
<li>list item 2</li>
65
</ol>
76
<blockquote>
87
<p>some text in a blockquote</p>
98
</blockquote>
109
<ul>
1110
<li>another list item 1</li>
12-
1311
<li>another list item 2</li>
1412
</ul>
Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
<h1 id="sometitle">some title</h1>
22
<ol>
33
<li>list item 1</li>
4-
54
<li>list item 2</li>
65
</ol>
76
<pre><code>some code
@@ -10,6 +9,5 @@ <h1 id="sometitle">some title</h1>
109
</code></pre>
1110
<ul>
1211
<li>another list item 1</li>
13-
1412
<li>another list item 2</li>
1513
</ul>
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
<ol>
22
<li><p>This is a major bullet point.</p>
33
<p>That contains multiple paragraphs.</p></li>
4-
54
<li><p>And another line</p></li>
65
</ol>

0 commit comments

Comments
 (0)