diff --git a/dist/showdown.js b/dist/showdown.js index 5d9f5a5..eddb12a 100644 Binary files a/dist/showdown.js and b/dist/showdown.js differ diff --git a/dist/showdown.js.map b/dist/showdown.js.map index 6789922..228a005 100644 Binary files a/dist/showdown.js.map and b/dist/showdown.js.map differ diff --git a/dist/showdown.min.js b/dist/showdown.min.js index 0f692f5..8a5fe7c 100644 Binary files a/dist/showdown.min.js and b/dist/showdown.min.js differ diff --git a/dist/showdown.min.js.map b/dist/showdown.min.js.map index a48f2a3..21a5190 100644 Binary files a/dist/showdown.min.js.map and b/dist/showdown.min.js.map differ diff --git a/src/subParsers/lists.js b/src/subParsers/lists.js index 6bd24b0..ee4f30b 100644 --- a/src/subParsers/lists.js +++ b/src/subParsers/lists.js @@ -93,12 +93,16 @@ showdown.subParser('lists', function (text, options, globals) { item = showdown.subParser('lists')(item, options, globals); item = item.replace(/\n$/, ''); // chomp(item) item = showdown.subParser('hashHTMLBlocks')(item, options, globals); + // Colapse double linebreaks item = item.replace(/\n\n+/g, '\n\n'); + // replace double linebreaks with a placeholder + item = item.replace(/\n\n/g, '~B'); if (isParagraphed) { item = showdown.subParser('paragraphs')(item, options, globals); } else { item = showdown.subParser('spanGamut')(item, options, globals); } + item = item.replace(/~B/g, '\n\n'); } // now we need to remove the marker (~A) diff --git a/src/subParsers/spanGamut.js b/src/subParsers/spanGamut.js index bb0f194..3f02547 100644 --- a/src/subParsers/spanGamut.js +++ b/src/subParsers/spanGamut.js @@ -26,10 +26,10 @@ showdown.subParser('spanGamut', function (text, options, globals) { // Do hard breaks if (options.simpleLineBreaks) { // GFM style hard breaks - text = text.replace(/\b\n\b/g, '
\n'); + text = text.replace(/\n/g, '
\n'); } else { // Vanilla hard breaks - text = text.replace(/\b +\n\b/g, '
\n'); + text = text.replace(/ +\n/g, '
\n'); } text = globals.converter._dispatch('spanGamut.after', text, options, globals); diff --git a/test/features/#318.simpleLineBreaks-does-not-work-with-chinese-characters.html b/test/features/#318.simpleLineBreaks-does-not-work-with-chinese-characters.html new file mode 100644 index 0000000..0776072 --- /dev/null +++ b/test/features/#318.simpleLineBreaks-does-not-work-with-chinese-characters.html @@ -0,0 +1,4 @@ +

foo烫
+bar

+

foo
+bar

diff --git a/test/features/#318.simpleLineBreaks-does-not-work-with-chinese-characters.md b/test/features/#318.simpleLineBreaks-does-not-work-with-chinese-characters.md new file mode 100644 index 0000000..7000970 --- /dev/null +++ b/test/features/#318.simpleLineBreaks-does-not-work-with-chinese-characters.md @@ -0,0 +1,5 @@ +foo烫 +bar + +foo +bar diff --git a/test/features/#323.simpleLineBreaks-breaks-with-strong.html b/test/features/#323.simpleLineBreaks-breaks-with-strong.html new file mode 100644 index 0000000..12b9dda --- /dev/null +++ b/test/features/#323.simpleLineBreaks-breaks-with-strong.html @@ -0,0 +1,2 @@ +

Nom : aaaa
+Nom : aaa

diff --git a/test/features/#323.simpleLineBreaks-breaks-with-strong.md b/test/features/#323.simpleLineBreaks-breaks-with-strong.md new file mode 100644 index 0000000..be28047 --- /dev/null +++ b/test/features/#323.simpleLineBreaks-breaks-with-strong.md @@ -0,0 +1,2 @@ +**Nom :** aaaa +**Nom :** aaa \ No newline at end of file diff --git a/test/features/simpleLineBreaks2.html b/test/features/simpleLineBreaks2.html new file mode 100644 index 0000000..54235c0 --- /dev/null +++ b/test/features/simpleLineBreaks2.html @@ -0,0 +1,13 @@ +
    +
  1. One

  2. +
  3. Two
    + foo

    +

    bar
    + bazinga

    +

    nhecos

  4. +
  5. Three

    +
  6. +
+ \ No newline at end of file diff --git a/test/features/simpleLineBreaks2.md b/test/features/simpleLineBreaks2.md new file mode 100644 index 0000000..40bbcad --- /dev/null +++ b/test/features/simpleLineBreaks2.md @@ -0,0 +1,18 @@ + 1. One + 2. Two + foo + + bar + bazinga + + + + + nhecos + + 3. Three + + - foo + + - bar + \ No newline at end of file diff --git a/test/node/testsuite.features.js b/test/node/testsuite.features.js index 099f91b..d64dbc3 100644 --- a/test/node/testsuite.features.js +++ b/test/node/testsuite.features.js @@ -37,8 +37,14 @@ describe('makeHtml() features testsuite', function () { converter = new showdown.Converter({disableForced4SpacesIndentedSublists: true}); } else if (testsuite[i].name === '#206.treat-single-line-breaks-as-br') { converter = new showdown.Converter({simpleLineBreaks: true}); + } else if (testsuite[i].name === 'simpleLineBreaks2') { + converter = new showdown.Converter({simpleLineBreaks: true}); } else if (testsuite[i].name === '#316.new-simpleLineBreaks-option-breaks-lists') { converter = new showdown.Converter({simpleLineBreaks: true}); + } else if (testsuite[i].name === '#323.simpleLineBreaks-breaks-with-strong') { + converter = new showdown.Converter({simpleLineBreaks: true}); + } else if (testsuite[i].name === '#318.simpleLineBreaks-does-not-work-with-chinese-characters') { + converter = new showdown.Converter({simpleLineBreaks: true}); } else if (testsuite[i].name === 'excludeTrailingPunctuationFromURLs-option') { converter = new showdown.Converter({simplifiedAutoLink: true, excludeTrailingPunctuationFromURLs: true}); } else if (testsuite[i].name === 'requireSpaceBeforeHeadingText') {