diff --git a/dist/showdown.js b/dist/showdown.js index 8be44f1..4638e20 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 1d42299..f6edb21 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 7be605f..f1a16ba 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 ca5421c..928dc3f 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 ce53303..48ba78f 100644 --- a/src/subParsers/lists.js +++ b/src/subParsers/lists.js @@ -70,6 +70,18 @@ showdown.subParser('lists', function (text, options, globals) { }); } + // ISSUE #312 + // This input: - - - a + // causes trouble to the parser, since it interprets it as: + // + // instead of: + // + // So, to prevent it, we will put a marker (~A)in the beginning of the line + // Kind of hackish/monkey patching, but seems more effective than overcomplicating the list parser + item = item.replace(/^([-*+]|\d\.)[ \t]+[\s\n]*/g, function (wm2) { + return '~A' + wm2; + }); + // m1 - Leading line or // Has a double return (multi paragraph) or // Has sublist @@ -86,6 +98,11 @@ showdown.subParser('lists', function (text, options, globals) { item = showdown.subParser('spanGamut')(item, options, globals); } } + + // now we need to remove the marker (~A) + item = item.replace('~A', ''); + + // we can finally wrap the line in list item tags item = '' + item + '\n'; return item; }); diff --git a/test/issues/#312.spaced-dashes-followed-by-char.html b/test/issues/#312.spaced-dashes-followed-by-char.html new file mode 100644 index 0000000..c36379b --- /dev/null +++ b/test/issues/#312.spaced-dashes-followed-by-char.html @@ -0,0 +1,15 @@ + +

a

+ +

a

+
    +
  1. 2. 3. 4. 5.
  2. +
+

a

+
    +
  1. 2. 3. 4. 5. a
  2. +
diff --git a/test/issues/#312.spaced-dashes-followed-by-char.md b/test/issues/#312.spaced-dashes-followed-by-char.md new file mode 100644 index 0000000..5aa1033 --- /dev/null +++ b/test/issues/#312.spaced-dashes-followed-by-char.md @@ -0,0 +1,13 @@ +- - - a + +a + ++ - * - - + a + +a + +1. 2. 3. 4. 5. + +a + +1. 2. 3. 4. 5. a diff --git a/test/issues/#312.spaced-dashes-followed-by-char2.html b/test/issues/#312.spaced-dashes-followed-by-char2.html new file mode 100644 index 0000000..43b3b06 --- /dev/null +++ b/test/issues/#312.spaced-dashes-followed-by-char2.html @@ -0,0 +1,8 @@ + +
    +
  1. 2. 3. 4. 5.

  2. +
  3. 2. 3. 4. 5. a

  4. +
diff --git a/test/issues/#312.spaced-dashes-followed-by-char2.md b/test/issues/#312.spaced-dashes-followed-by-char2.md new file mode 100644 index 0000000..d40889f --- /dev/null +++ b/test/issues/#312.spaced-dashes-followed-by-char2.md @@ -0,0 +1,7 @@ +- - - a + ++ - * - - + a + +1. 2. 3. 4. 5. + +1. 2. 3. 4. 5. a diff --git a/test/issues/#312.spaced-dashes-followed-by-char3.html b/test/issues/#312.spaced-dashes-followed-by-char3.html new file mode 100644 index 0000000..717d2f3 --- /dev/null +++ b/test/issues/#312.spaced-dashes-followed-by-char3.html @@ -0,0 +1,10 @@ + +

fooo

+ + diff --git a/test/issues/#312.spaced-dashes-followed-by-char3.md b/test/issues/#312.spaced-dashes-followed-by-char3.md new file mode 100644 index 0000000..b40ff47 --- /dev/null +++ b/test/issues/#312.spaced-dashes-followed-by-char3.md @@ -0,0 +1,10 @@ +- - +a + + +fooo + + +- - - aaaaa + + bbbbb