Make MD033/no-inline-html slightly more efficient.

This commit is contained in:
David Anson 2019-06-06 22:02:10 -07:00
parent 73e70b76f3
commit fa40084994

View file

@ -30,11 +30,13 @@ module.exports = {
!tag.endsWith("\\>") && !bareUrlRe.test(content) &&
!emailAddressRe.test(content)) {
const prefix = line.substring(0, match.index);
if (!linkDestinationRe.test(prefix) && !inlineCodeRe.test(prefix) &&
!unescapeMarkdown(prefix + "<", "_").endsWith("_") &&
(unescapeMarkdown(prefix + "`", "_").match(/`/g).length % 2)) {
addError(onError, lineIndex + 1, "Element: " + element,
null, [ match.index + 1, tag.length ]);
if (!linkDestinationRe.test(prefix) && !inlineCodeRe.test(prefix)) {
const unescaped = unescapeMarkdown(prefix + "<", "_");
if (!unescaped.endsWith("_") &&
((unescaped + "`").match(/`/g).length % 2)) {
addError(onError, lineIndex + 1, "Element: " + element,
null, [ match.index + 1, tag.length ]);
}
}
}
}