Hide the content of inline configuration HTML comments from the linting process to avoid false positives.

This commit is contained in:
David Anson 2022-06-04 22:59:19 -07:00
parent 535aa1a2ee
commit bbec8c5c1e
7 changed files with 80 additions and 40 deletions

View file

@ -161,16 +161,10 @@ module.exports.clearHtmlCommentText = function clearHtmlCommentText(text) {
!content.endsWith("-") && !content.includes("--"));
// If a valid block/inline comment...
if (isValid) {
const inlineCommentIndex = text
.slice(i, j + htmlCommentEnd.length)
.search(inlineCommentStartRe);
// If not a markdownlint inline directive...
if (inlineCommentIndex !== 0) {
text =
text.slice(0, i + htmlCommentBegin.length) +
content.replace(/[^\r\n]/g, ".") +
text.slice(j);
}
text =
text.slice(0, i + htmlCommentBegin.length) +
content.replace(/[^\r\n]/g, ".") +
text.slice(j);
}
}
}