mirror of
https://github.com/showdownjs/showdown.git
synced 2024-03-22 13:30:55 +08:00
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:
parent
e18be38995
commit
54bf74472a
BIN
dist/showdown.js
vendored
BIN
dist/showdown.js
vendored
Binary file not shown.
BIN
dist/showdown.js.map
vendored
BIN
dist/showdown.js.map
vendored
Binary file not shown.
BIN
dist/showdown.min.js
vendored
BIN
dist/showdown.min.js
vendored
Binary file not shown.
BIN
dist/showdown.min.js.map
vendored
BIN
dist/showdown.min.js.map
vendored
Binary file not shown.
|
@ -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>';
|
||||
|
|
0
test/cases/strip-references.html
Normal file
0
test/cases/strip-references.html
Normal file
13
test/cases/strip-references.md
Normal file
13
test/cases/strip-references.md
Normal 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
|
Loading…
Reference in New Issue
Block a user