mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-09-22 05:40:48 +02:00
Handle un-closed HTML comments in a way that does not trigger MD047/single-trailing-newline (fixes #187).
This commit is contained in:
parent
0b9b74ccfd
commit
61c92e5997
4 changed files with 9 additions and 2 deletions
|
@ -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) &&
|
||||
|
|
|
@ -1329,7 +1329,8 @@ function clearHtmlCommentTextValid(test) {
|
|||
"<!-- --><!-- -->",
|
||||
"text<!-- -->text<!-- -->text",
|
||||
"<!--",
|
||||
" \\"
|
||||
" \\",
|
||||
""
|
||||
];
|
||||
const actual = helpers.clearHtmlCommentText(validComments.join("\n"));
|
||||
const expected = validResult.join("\n");
|
||||
|
|
3
test/unclosed-html-comment-in-code-span.md
Normal file
3
test/unclosed-html-comment-in-code-span.md
Normal file
|
@ -0,0 +1,3 @@
|
|||
# Heading
|
||||
|
||||
`<!--`
|
3
test/unclosed-html-comment.md
Normal file
3
test/unclosed-html-comment.md
Normal file
|
@ -0,0 +1,3 @@
|
|||
# Heading
|
||||
|
||||
<!--
|
Loading…
Add table
Add a link
Reference in a new issue