diff --git a/dist/showdown.js b/dist/showdown.js index bdd07a8..347c643 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 b9c2fd7..6d6808f 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 ea2f7b5..8dfa6b0 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 3f1838a..b1c38ab 100644 Binary files a/dist/showdown.min.js.map and b/dist/showdown.min.js.map differ diff --git a/src/subParsers/makehtml/underline.js b/src/subParsers/makehtml/underline.js index ad7f654..a3d4414 100644 --- a/src/subParsers/makehtml/underline.js +++ b/src/subParsers/makehtml/underline.js @@ -8,11 +8,17 @@ showdown.subParser('makehtml.underline', function (text, options, globals) { text = globals.converter._dispatch('makehtml.underline.before', text, options, globals).getText(); if (options.literalMidWordUnderscores) { - text = text.replace(/\b_?__(\S[\s\S]*)___?\b/g, function (wm, txt) { + text = text.replace(/\b___(\S[\s\S]*?)___\b/g, function (wm, txt) { + return '' + txt + ''; + }); + text = text.replace(/\b__(\S[\s\S]*?)__\b/g, function (wm, txt) { return '' + txt + ''; }); } else { - text = text.replace(/_?__(\S[\s\S]*?)___?/g, function (wm, m) { + text = text.replace(/___(\S[\s\S]*?)___/g, function (wm, m) { + return (/\S$/.test(m)) ? '' + m + '' : wm; + }); + text = text.replace(/__(\S[\s\S]*?)__/g, function (wm, m) { return (/\S$/.test(m)) ? '' + m + '' : wm; }); } diff --git a/test/functional/makehtml/cases/features/underline/simple.html b/test/functional/makehtml/cases/features/underline/simple.html index 51756cf..1f8e5ae 100644 --- a/test/functional/makehtml/cases/features/underline/simple.html +++ b/test/functional/makehtml/cases/features/underline/simple.html @@ -2,3 +2,4 @@
an underlined sentence
three underscores are fine
_single_ underscores are left alone
+multiple underlines in a paragraph
\ No newline at end of file diff --git a/test/functional/makehtml/cases/features/underline/simple.md b/test/functional/makehtml/cases/features/underline/simple.md index cc96921..510be1f 100644 --- a/test/functional/makehtml/cases/features/underline/simple.md +++ b/test/functional/makehtml/cases/features/underline/simple.md @@ -5,3 +5,5 @@ __an underlined sentence__ ___three underscores are fine___ _single_ underscores are left alone + +__multiple__ underlines in a __paragraph__ \ No newline at end of file