Handle un-closed HTML comments in a way that does not trigger MD047/single-trailing-newline (fixes #187).

This commit is contained in:
David Anson 2019-05-16 22:14:07 -07:00
parent 0b9b74ccfd
commit 61c92e5997
4 changed files with 9 additions and 2 deletions

View file

@ -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) &&

View file

@ -1329,7 +1329,8 @@ function clearHtmlCommentTextValid(test) {
"<!-- --><!-- -->",
"text<!-- -->text<!-- -->text",
"<!--",
" \\"
" \\",
""
];
const actual = helpers.clearHtmlCommentText(validComments.join("\n"));
const expected = validResult.join("\n");

View file

@ -0,0 +1,3 @@
# Heading
`<!--`

View file

@ -0,0 +1,3 @@
# Heading
<!--