diff --git a/dist/showdown.js b/dist/showdown.js index 8f9cdba..0abb867 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 7196acc..8de4142 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 1b74f56..1574546 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 5df08ac..adf5ea4 100644 Binary files a/dist/showdown.min.js.map and b/dist/showdown.min.js.map differ diff --git a/src/subParsers/hashHTMLBlocks.js b/src/subParsers/hashHTMLBlocks.js index 9020e56..b136bc9 100644 --- a/src/subParsers/hashHTMLBlocks.js +++ b/src/subParsers/hashHTMLBlocks.js @@ -52,12 +52,13 @@ showdown.subParser('hashHTMLBlocks', function (text, options, globals) { } // HR SPECIAL CASE - text = text.replace(/(\n[ ]{0,3}(<(hr)\b([^<>])*?\/?>)[ \t]*(?=\n{2,}))/g, + text = text.replace(/(\n {0,3}(<(hr)\b([^<>])*?\/?>)[ \t]*(?=\n{2,}))/g, showdown.subParser('hashElement')(text, options, globals)); - // Special case for standalone HTML comments: - text = text.replace(/()/g, - showdown.subParser('hashElement')(text, options, globals)); + // Special case for standalone HTML comments + text = showdown.helper.replaceRecursiveRegExp(text, function (txt) { + return '\n\n~K' + (globals.gHtmlBlocks.push(txt) - 1) + 'K\n\n'; + }, '^(?: |\\t){0,3}', 'gm'); // PHP and ASP-style processor instructions ( and <%...%>) text = text.replace(/(?:\n\n)([ ]{0,3}(?:<([?%])[^\r]*?\2>)[ \t]*(?=\n{2,}))/g, diff --git a/test/cases/html-comments.html b/test/cases/html-comments.html new file mode 100644 index 0000000..865f2e5 --- /dev/null +++ b/test/cases/html-comments.html @@ -0,0 +1,14 @@ + + + + +

words words

+ + + +

words

+ + + +
<!-- comment -->
+
diff --git a/test/cases/html-comments.md b/test/cases/html-comments.md new file mode 100644 index 0000000..08c7e1d --- /dev/null +++ b/test/cases/html-comments.md @@ -0,0 +1,11 @@ + + + + +words words + + words + + + + diff --git a/test/cases/html-inside-listed-code.html b/test/cases/html-inside-listed-code.html new file mode 100644 index 0000000..3a1e09b --- /dev/null +++ b/test/cases/html-inside-listed-code.html @@ -0,0 +1,9 @@ + \ No newline at end of file diff --git a/test/cases/html-inside-listed-code.md b/test/cases/html-inside-listed-code.md new file mode 100644 index 0000000..5034d5e --- /dev/null +++ b/test/cases/html-inside-listed-code.md @@ -0,0 +1,8 @@ + - list item 1 + + ```html + google +
+
some div
+
+ ``` diff --git a/test/cases/line-starts-with-html.html b/test/cases/line-starts-with-html.html new file mode 100644 index 0000000..a8af6b2 --- /dev/null +++ b/test/cases/line-starts-with-html.html @@ -0,0 +1,3 @@ +

some text words

+ +


words

diff --git a/test/cases/line-starts-with-html.md b/test/cases/line-starts-with-html.md new file mode 100644 index 0000000..20e6cba --- /dev/null +++ b/test/cases/line-starts-with-html.md @@ -0,0 +1,3 @@ +some text words + +
words \ No newline at end of file diff --git a/test/issues/#288.code-blocks-containing-xml-comments-are-not-converted-correctly-when-nested-in-list-items.html b/test/issues/#288.code-blocks-containing-xml-comments-are-not-converted-correctly-when-nested-in-list-items.html new file mode 100644 index 0000000..5855544 --- /dev/null +++ b/test/issues/#288.code-blocks-containing-xml-comments-are-not-converted-correctly-when-nested-in-list-items.html @@ -0,0 +1,21 @@ + + +
<parent>
+<child>child1</child>
+<!-- This is a comment -->
+<child>child2</child>
+<child>some text <!-- a comment --></child>
+</parent>
+
diff --git a/test/issues/#288.code-blocks-containing-xml-comments-are-not-converted-correctly-when-nested-in-list-items.md b/test/issues/#288.code-blocks-containing-xml-comments-are-not-converted-correctly-when-nested-in-list-items.md new file mode 100644 index 0000000..8f918a5 --- /dev/null +++ b/test/issues/#288.code-blocks-containing-xml-comments-are-not-converted-correctly-when-nested-in-list-items.md @@ -0,0 +1,21 @@ +* list item 1 + + ``` + + child1 + + child2 + some text + + ``` + +* list item 2 + +``` + +child1 + +child2 +some text + +```