From fa40084994f966fda079643f528e0b6bcbdd2c99 Mon Sep 17 00:00:00 2001 From: David Anson Date: Thu, 6 Jun 2019 22:02:10 -0700 Subject: [PATCH] Make MD033/no-inline-html slightly more efficient. --- lib/md033.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/md033.js b/lib/md033.js index 2cfdc6b0..a36870b7 100644 --- a/lib/md033.js +++ b/lib/md033.js @@ -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 ]); + } } } }