Skip to content

Commit

Permalink
allow colons in tag names and attributes. Decrease group depth in regex
Browse files Browse the repository at this point in the history
  • Loading branch information
Feder1co5oave committed Mar 4, 2018
1 parent 652ba97 commit b2611c1
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/marked.js
Original file line number Diff line number Diff line change
Expand Up @@ -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]*?\?>|^<![a-zA-Z]+\s[\s\S]*?>|^<!\[CDATA\[[\s\S]*?\]\]>/,
tag: /^comment|^<\/[a-zA-Z][\w:-]*\s*>|^<[a-zA-Z][\w:-]*(?:attribute)*?\s*\/?>|^<\?[\s\S]*?\?>|^<![a-zA-Z]+\s[\s\S]*?>|^<!\[CDATA\[[\s\S]*?\]\]>/,
link: /^!?\[(inside)\]\(href\)/,
reflink: /^!?\[(inside)\]\s*\[([^\]]*)\]/,
nolink: /^!?\[((?:\[[^\]]*\]|\\[\[\]]|[^\[\]])*)\]/,
Expand All @@ -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 = /(?:\[[^\]]*\]|\\[\[\]]|[^\[\]]|\](?=[^\[]*\]))*/;
Expand Down

0 comments on commit b2611c1

Please sign in to comment.