mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-12-17 22:40:13 +01:00
Update clearHtmlCommentText helper to match HTML specification better; "--" within a comment does not make it invalid (fixes #361).
This commit is contained in:
parent
df4aa9f4e8
commit
838afe0a00
4 changed files with 37 additions and 21 deletions
|
|
@ -128,11 +128,13 @@ module.exports.clearHtmlCommentText = function clearHtmlCommentText(text) {
|
|||
}
|
||||
var comment = text.slice(i + htmlCommentBegin.length, j);
|
||||
if ((comment.length > 0) &&
|
||||
(comment[0] !== ">") &&
|
||||
(comment[comment.length - 1] !== "-") &&
|
||||
!comment.includes("--") &&
|
||||
(text.slice(i, j + htmlCommentEnd.length)
|
||||
.search(inlineCommentRe) === -1)) {
|
||||
!comment.startsWith(">") &&
|
||||
!comment.startsWith("->") &&
|
||||
!comment.endsWith("<!-") &&
|
||||
!comment.includes("<!--") &&
|
||||
// !comment.includes("-->") &&
|
||||
!comment.includes("--!>") &&
|
||||
(text.slice(i, j + htmlCommentEnd.length).search(inlineCommentRe) === -1)) {
|
||||
var blanks = comment
|
||||
.replace(/[^\r\n]/g, " ")
|
||||
.replace(/ ([\r\n])/g, "\\$1");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue