diff --git a/test/javascripts/lib/markdown-test.js.es6 b/test/javascripts/lib/markdown-test.js.es6 index 8b513b870..981d4eceb 100644 --- a/test/javascripts/lib/markdown-test.js.es6 +++ b/test/javascripts/lib/markdown-test.js.es6 @@ -138,6 +138,10 @@ test("Links", function() { cooked("[http://google.com ... wat](http://discourse.org)", "

http://google.com ... wat

", "it supports linkins within links"); + + cooked("[Link](http://www.example.com) (with an outer \"description\")", + "

Link (with an outer \"description\")

", + "it doesn't consume closing parens as part of the url") }); test("simple quotes", function() { diff --git a/vendor/assets/javascripts/better_markdown.js b/vendor/assets/javascripts/better_markdown.js index 4eee2c612..5c56a8bde 100644 --- a/vendor/assets/javascripts/better_markdown.js +++ b/vendor/assets/javascripts/better_markdown.js @@ -1310,7 +1310,7 @@ // back based on if there a matching ones in the url // ([here](/url/(test)) // The parens have to be balanced - var m = text.match( /^\s*\([ \t]*([^"']*)(?:[ \t]+(["'])(.*?)\2)?[ \t]*\)/ ); + var m = text.match( /^\s*\([ \t]*([^"'\s]*)(?:[ \t]+(["'])(.*?)\2)?[ \t]*\)/ ); if ( m ) { var url = m[1].replace(/\s+$/, ''); consumed += m[0].length;