From 73e70b76f3a338d3434a8e6cad0a16c095263651 Mon Sep 17 00:00:00 2001 From: David Anson Date: Tue, 4 Jun 2019 23:19:49 -0700 Subject: [PATCH] Update MD033/no-inline-html to handle escaped backticks (fixes #193). --- lib/md033.js | 3 ++- test/inline_html.md | 10 ++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/lib/md033.js b/lib/md033.js index 6bfa0516..2cfdc6b0 100644 --- a/lib/md033.js +++ b/lib/md033.js @@ -31,7 +31,8 @@ module.exports = { !emailAddressRe.test(content)) { const prefix = line.substring(0, match.index); if (!linkDestinationRe.test(prefix) && !inlineCodeRe.test(prefix) && - !unescapeMarkdown(prefix + "<", "_").endsWith("_")) { + !unescapeMarkdown(prefix + "<", "_").endsWith("_") && + (unescapeMarkdown(prefix + "`", "_").match(/`/g).length % 2)) { addError(onError, lineIndex + 1, "Element: " + element, null, [ match.index + 1, tag.length ]); } diff --git a/test/inline_html.md b/test/inline_html.md index 90ddd406..70a98403 100644 --- a/test/inline_html.md +++ b/test/inline_html.md @@ -11,3 +11,13 @@ but this time on multiple lines ```text

Neither should this as it's also in a code block {MD046:11}

``` + +## Elements in code spans + +Text `` text \` text +Text \` text `` text +Text \` text \` text `` text +Text \` text `` text `` text +Text \` text `` text \` text `` text +Text \`\` text `` text +Text `` text \` text `` text