mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-09-22 05:40:48 +02:00
Change behavior of un-terminated HTML comments to be treated as text (fixes #252).
This commit is contained in:
parent
b87094e33d
commit
4ff6f2f4b1
3 changed files with 17 additions and 5 deletions
|
@ -96,10 +96,10 @@ const htmlCommentEnd = "-->";
|
|||
module.exports.clearHtmlCommentText = function clearHtmlCommentText(text) {
|
||||
let i = 0;
|
||||
while ((i = text.indexOf(htmlCommentBegin, i)) !== -1) {
|
||||
let j = text.indexOf(htmlCommentEnd, i);
|
||||
const j = text.indexOf(htmlCommentEnd, i);
|
||||
if (j === -1) {
|
||||
j = text.length;
|
||||
text += "\\\n";
|
||||
// Un-terminated comments are treated as text
|
||||
break;
|
||||
}
|
||||
const comment = text.slice(i + htmlCommentBegin.length, j);
|
||||
if ((comment.length > 0) &&
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue