From b2611c1b0503c7d52313a86fc3c7106f26a4e415 Mon Sep 17 00:00:00 2001 From: Federico Soave Date: Fri, 23 Feb 2018 20:07:39 +0100 Subject: [PATCH] allow colons in tag names and attributes. Decrease group depth in regex --- lib/marked.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/marked.js b/lib/marked.js index 3196e563f4..99a94226d4 100644 --- a/lib/marked.js +++ b/lib/marked.js @@ -463,7 +463,7 @@ var inline = { escape: /^\\([\\`*{}\[\]()#+\-.!_>])/, autolink: /^<(scheme:[^\s\x00-\x1f<>]*|email)>/, url: noop, - tag: /^comment|^<\/[a-zA-Z][\w\-]*\s*>|^<[a-zA-Z][\w\-]*(?:\s+[\w:-]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s"'=<>`]+))?)*?\s*\/?>|^<\?[\s\S]*?\?>|^|^/, + tag: /^comment|^<\/[a-zA-Z][\w:-]*\s*>|^<[a-zA-Z][\w:-]*(?:attribute)*?\s*\/?>|^<\?[\s\S]*?\?>|^|^/, link: /^!?\[(inside)\]\(href\)/, reflink: /^!?\[(inside)\]\s*\[([^\]]*)\]/, nolink: /^!?\[((?:\[[^\]]*\]|\\[\[\]]|[^\[\]])*)\]/, @@ -483,8 +483,11 @@ inline.autolink = edit(inline.autolink) .replace('email', inline._email) .getRegex(); +inline._attribute = /\s+[\w:-]+(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/; + inline.tag = edit(inline.tag) .replace('comment', block._comment) + .replace('attribute', inline._attribute) .getRegex(); inline._inside = /(?:\[[^\]]*\]|\\[\[\]]|[^\[\]]|\](?=[^\[]*\]))*/;