Update MD033/no-inline-html to handle escaped backticks (fixes #193).

This commit is contained in:
David Anson 2019-06-04 23:19:49 -07:00
parent 5a142da87c
commit 73e70b76f3
2 changed files with 12 additions and 1 deletions

View file

@ -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 ]);
}

View file

@ -11,3 +11,13 @@ but this time on multiple lines
```text
<p>Neither should this as it's also in a code block {MD046:11}</p>
```
## Elements in code spans
Text `<code>` text \` text
Text \` text `<code>` text
Text \` text \` text `<code>` text
Text \` text `<code>` text `<code>` text
Text \` text `<code>` text \` text `<code>` text
Text \`\` text `<code>` text
Text `<code>` text \` text `<code>` text