Skip to content

Commit f97e072

Browse files
committed
fix(double linebreaks): fix double linebreaks in html output
Closes #291
1 parent fe64a17 commit f97e072

93 files changed

Lines changed: 14 additions & 296 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

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: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -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\n<' + listType + '>' + processListItems(txt.slice(0, pos), !!trimTrailing) + '</' + listType + '>\n\n';
115+
result += '\n<' + listType + '>' + 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\n<' + listType + '>' + processListItems(txt, !!trimTrailing) + '</' + listType + '>\n\n';
124+
result += '\n<' + listType + '>' + processListItems(txt, !!trimTrailing) + '</' + listType + '>\n';
125125
}
126126
})(list);
127127
for (var i = 0; i < subLists.length; ++i) {
128128

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

134134
return result;

src/subParsers/paragraphs.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ showdown.subParser('paragraphs', function (text, options, globals) {
5858
}
5959
grafsOut[i] = grafsOutIt;
6060
}
61-
text = grafsOut.join('\n\n');
61+
text = grafsOut.join('\n');
6262
// Strip leading and trailing lines:
6363
text = text.replace(/^\n+/g, '');
6464
text = text.replace(/\n+$/g, '');

test/cases/blockquote-followed-by-code.html

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,9 @@
22
<p>a blockquote
33
with a 4 space indented line (not code)</p>
44
</blockquote>
5-
65
<p>sep</p>
7-
86
<blockquote>
97
<p>a blockquote</p>
108
</blockquote>
11-
129
<pre><code>with some code after
1310
</code></pre>
Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
<pre><code>&gt; this is a pseudo blockquote
22
&gt; inside a code block
33
</code></pre>
4-
54
<p>foo</p>
6-
75
<pre><code>&gt; this is another bq
86
inside code
97
</code></pre>
Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
11
<blockquote>
22
<h2 id="thisisaheader">This is a header.</h2>
3-
43
<ol>
54
<li>This is the first list item.</li>
65

76
<li>This is the second list item.</li>
87
</ol>
9-
108
<p>Here's some example code:</p>
11-
129
<pre><code>return shell_exec("echo $input | $markdown_script");
1310
</code></pre>
1411
</blockquote>

test/cases/blockquote.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
<blockquote>
22
<p>This is a multi line blockquote test</p>
3-
43
<p>With more than one line.</p>
54
</blockquote>

0 commit comments

Comments
 (0)