From f81609d1bbfaccd470958e3242620ab6ed19d6be Mon Sep 17 00:00:00 2001 From: David Anson Date: Thu, 25 Jul 2019 21:40:27 -0700 Subject: [PATCH] Update MD033/no-inline-html to ignore elements with embedded forward slash (fixes #201). --- lib/md033.js | 2 +- test/inline_html.md | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/md033.js b/lib/md033.js index a36870b7..e138e512 100644 --- a/lib/md033.js +++ b/lib/md033.js @@ -6,7 +6,7 @@ const { addError, bareUrlRe, forEachLine, unescapeMarkdown } = require("../helpers"); const { lineMetadata } = require("./cache"); -const htmlElementRe = /<(([A-Za-z][A-Za-z0-9-]*)(?:[\s/][^>]*)?)>/g; +const htmlElementRe = /<(([A-Za-z][A-Za-z0-9-]*)(?:\s[^>]*)?)(?:\/>|>)/g; const linkDestinationRe = /]\(\s*$/; const inlineCodeRe = /^[^`]*(`+[^`]+`+[^`]+)*`+[^`]*$/; // See https://spec.commonmark.org/0.29/#autolinks diff --git a/test/inline_html.md b/test/inline_html.md index 70a98403..e166e6e4 100644 --- a/test/inline_html.md +++ b/test/inline_html.md @@ -21,3 +21,7 @@ Text \` text `` text `` text Text \` text `` text \` text `` text Text \`\` text `` text Text `` text \` text `` text + +## Slash in element name + +Text **\\another\directory\\** text