diff --git a/src/lib/markbind/src/lib/markdown-it/markdown-it-escape-special-tags.js b/src/lib/markbind/src/lib/markdown-it/markdown-it-escape-special-tags.js index d0b31c2a9b..9b82e4d7d5 100644 --- a/src/lib/markbind/src/lib/markdown-it/markdown-it-escape-special-tags.js +++ b/src/lib/markbind/src/lib/markdown-it/markdown-it-escape-special-tags.js @@ -10,7 +10,7 @@ function escape_plugin(md, tagsToIgnore) { const HTML_OPEN_CLOSE_TAG_RE = require('markdown-it/lib/common/html_re').HTML_OPEN_CLOSE_TAG_RE; const specialTagsRegex = Array.from(tagsToIgnore) - .concat(['script|pre|style']) + .concat(['script|pre|style|variable']) .join('|'); const startingSpecialTagRegex = new RegExp(`^<(${specialTagsRegex})(?=(\\s|>|$))`, 'i'); const endingSpecialTagRegex = new RegExp(`<\\/(${specialTagsRegex})>`, 'i'); diff --git a/src/lib/markbind/src/patches/htmlparser2.js b/src/lib/markbind/src/patches/htmlparser2.js index 53ba30a04d..526e3b7db2 100644 --- a/src/lib/markbind/src/patches/htmlparser2.js +++ b/src/lib/markbind/src/patches/htmlparser2.js @@ -110,6 +110,12 @@ var i = 0, NO_MATCH = -2, HAS_MATCHED = -3; +const DEFAULT_SPECIAL_TAGS = [ + 'script', + 'style', + 'variable', +]; + function whitespace(c) { return c === " " || c === "\n" || c === "\t" || c === "\f" || c === "\r"; } @@ -149,10 +155,7 @@ Tokenizer.prototype._stateText = function(c) { }; -Tokenizer.prototype.specialTagNames = [ - 'script', - 'style', -]; +Tokenizer.prototype.specialTagNames = [...DEFAULT_SPECIAL_TAGS]; /** * Checks whether the token matches one of the first characters of the special tags, @@ -485,7 +488,7 @@ Tokenizer.prototype._parse = function(){ * Injects the tagsToIgnore into the Tokenizer's specialTagNames. */ function injectIgnoreTags(tagsToIgnore) { - Tokenizer.prototype.specialTagNames = ['script', 'style', ...tagsToIgnore]; + Tokenizer.prototype.specialTagNames = [...DEFAULT_SPECIAL_TAGS, ...tagsToIgnore]; } module.exports = injectIgnoreTags;