From 61c92e59972c2cea1781526a59ee7b7ebe5ca48d Mon Sep 17 00:00:00 2001 From: David Anson Date: Thu, 16 May 2019 22:14:07 -0700 Subject: [PATCH] Handle un-closed HTML comments in a way that does not trigger MD047/single-trailing-newline (fixes #187). --- helpers/helpers.js | 2 +- test/markdownlint-test.js | 3 ++- test/unclosed-html-comment-in-code-span.md | 3 +++ test/unclosed-html-comment.md | 3 +++ 4 files changed, 9 insertions(+), 2 deletions(-) create mode 100644 test/unclosed-html-comment-in-code-span.md create mode 100644 test/unclosed-html-comment.md diff --git a/helpers/helpers.js b/helpers/helpers.js index f6a7e17a..d4a02bf1 100644 --- a/helpers/helpers.js +++ b/helpers/helpers.js @@ -76,7 +76,7 @@ module.exports.clearHtmlCommentText = function clearHtmlCommentText(text) { let j = text.indexOf(htmlCommentEnd, i); if (j === -1) { j = text.length; - text += "\\"; + text += "\\\n"; } const comment = text.slice(i + htmlCommentBegin.length, j); if ((comment.length > 0) && diff --git a/test/markdownlint-test.js b/test/markdownlint-test.js index 16066f45..525723ae 100644 --- a/test/markdownlint-test.js +++ b/test/markdownlint-test.js @@ -1329,7 +1329,8 @@ function clearHtmlCommentTextValid(test) { "", "texttexttext", "