diff --git a/lib/marked.js b/lib/marked.js index 3590ae2655..90b54129cd 100644 --- a/lib/marked.js +++ b/lib/marked.js @@ -445,9 +445,9 @@ Lexer.prototype.token = function(src, top, bq) { var inline = { escape: /^\\([\\`*{}\[\]()#+\-.!_>])/, - autolink: /^<([^ >]+(@|:\/)[^ >]+)>/, + autolink: /^<([^ <>]+(@|:\/)[^ <>]+)>/, url: noop, - tag: /^|^<\/?\w+(?:"[^"]*"|'[^']*'|[^'">])*?>/, + tag: /^|^<\/?\w+(?:"[^"]*"|'[^']*'|[^<'">])*?>/, link: /^!?\[(inside)\]\(href\)/, reflink: /^!?\[(inside)\]\s*\[([^\]]*)\]/, nolink: /^!?\[((?:\[[^\]]*\]|[^\[\]])*)\]/, diff --git a/test/tests/auto_links.html b/test/tests/auto_links.html index f8df9852c7..898fed622d 100644 --- a/test/tests/auto_links.html +++ b/test/tests/auto_links.html @@ -1,18 +1,30 @@

Link: http://example.com/.

-

With an ampersand: http://example.com/?foo=1&bar=2

+

With an ampersand: http://example1.com/?foo=1&bar=2

-

Blockquoted: http://example.com/

+

Blockquoted: http://example3.com/

-

Auto-links should not occur here: <http://example.com/>

+

Auto-links should not occur here: <http://example4.com/>

-
or here: <http://example.com/>
+
or here: <http://example5.com/>
 
+ +

Open angle bracket with link:

+ +

<http://example6.com

+ +

With space: < http://example7.com

+ +

With content: <1 http://example8.com

+ +

hello world +http://example9.com +

diff --git a/test/tests/auto_links.text b/test/tests/auto_links.text index f85767b48a..7a017f00ae 100644 --- a/test/tests/auto_links.text +++ b/test/tests/auto_links.text @@ -1,13 +1,24 @@ Link: . -With an ampersand: +With an ampersand: * In a list? -* +* * It should. -> Blockquoted: +> Blockquoted: -Auto-links should not occur here: `` +Auto-links should not occur here: `` - or here: + or here: + +Open angle bracket with link: + +< + +With space: < + +With content: <1 + +hello world + diff --git a/test/tests/mangle_xss.sanatize.nomangle.html b/test/tests/mangle_xss.sanatize.nomangle.html index 9f87f09a43..83a7b355d6 100644 --- a/test/tests/mangle_xss.sanatize.nomangle.html +++ b/test/tests/mangle_xss.sanatize.nomangle.html @@ -1,3 +1,3 @@ -

<svg/onload="alert(1)"//@x

+

<svg/onload="alert(1)"//@x

bar"onclick="alert('XSS')"@foo