fix(paragraphs): fix empty lines generating empty paragraphs

Empty lines should not be parsed as paragraphs. This was happening
in determined circumstances.
For instance, when stripping reference style links, `\n\n` was left being,
creating an undesired empty paragraph. This commit fixes the issue.

Closes #334
This commit is contained in:
Estevao Soares dos Santos 2017-01-30 20:43:56 +00:00
parent e18be38995
commit 54bf74472a
7 changed files with 17 additions and 1 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

@ -18,7 +18,10 @@ showdown.subParser('paragraphs', function (text, options, globals) {
// if this is an HTML marker, copy it
if (str.search(/¨(K|G)(\d+)\1/g) >= 0) {
grafsOut.push(str);
} else {
// test for presence of characters to prevent empty lines being parsed
// as paragraphs (resulting in undesired extra empty paragraphs)
} else if (str.search(/\S/) >= 0) {
str = showdown.subParser('spanGamut')(str, options, globals);
str = str.replace(/^([ \t]*)/g, '<p>');
str += '</p>';

View File

View File

@ -0,0 +1,13 @@
[1]: http://www.google.co.uk
[http://www.google.co.uk]: http://www.google.co.uk
[1]: http://dsurl.stuff/something.jpg
[1]:http://www.google.co.uk
[1]:http://www.google.co.uk