diff --git a/app/assets/javascripts/pretty-text/engines/discourse-markdown.js.es6 b/app/assets/javascripts/pretty-text/engines/discourse-markdown.js.es6 index fbc58934b60..7555bebdf3c 100644 --- a/app/assets/javascripts/pretty-text/engines/discourse-markdown.js.es6 +++ b/app/assets/javascripts/pretty-text/engines/discourse-markdown.js.es6 @@ -500,7 +500,7 @@ function invalidBoundary(args, prev) { if (args.wordBoundary && (!last.match(/\W$/))) { return true; } if (args.spaceBoundary && (!last.match(/\s$/))) { return true; } - if (args.spaceOrTagBoundary && (!last.match(/(\s|\>)$/))) { return true; } + if (args.spaceOrTagBoundary && (!last.match(/(\s|\>|\()$/))) { return true; } } function countLines(str) { diff --git a/test/javascripts/lib/pretty-text-test.js.es6 b/test/javascripts/lib/pretty-text-test.js.es6 index af6486b33a9..fb9c04f0ed9 100644 --- a/test/javascripts/lib/pretty-text-test.js.es6 +++ b/test/javascripts/lib/pretty-text-test.js.es6 @@ -159,10 +159,19 @@ test("Links", function() { "
", "it supports links within links"); + cooked("[http://google.com](http://discourse.org)", + "", + "it supports markdown links where the name and link match"); + + 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"); + cooked("A link inside parentheses (http://www.example.com)", + "A link inside parentheses (http://www.example.com)
", + "it auto-links a url within parentheses"); + cooked("[ul][1]\n\n[1]: http://eviltrout.com", "", "it can use `ul` as a link name");