FIX: Auto-link URLs that are inside parentheses

This commit is contained in:
David McClure 2016-10-29 17:30:36 -07:00
parent 4d58a00387
commit 9bbab6e64e
2 changed files with 10 additions and 1 deletions

View File

@ -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) {

View File

@ -159,10 +159,19 @@ test("Links", function() {
"<p><a href=\"http://discourse.org\">http://google.com ... wat</a></p>",
"it supports links within links");
cooked("[http://google.com](http://discourse.org)",
"<p><a href=\"http://discourse.org\">http://google.com</a></p>",
"it supports markdown links where the name and link match");
cooked("[Link](http://www.example.com) (with an outer \"description\")",
"<p><a href=\"http://www.example.com\">Link</a> (with an outer \"description\")</p>",
"it doesn't consume closing parens as part of the url");
cooked("A link inside parentheses (http://www.example.com)",
"<p>A link inside parentheses (<a href=\"http://www.example.com\">http://www.example.com</a>)</p>",
"it auto-links a url within parentheses");
cooked("[ul][1]\n\n[1]: http://eviltrout.com",
"<p><a href=\"http://eviltrout.com\">ul</a></p>",
"it can use `ul` as a link name");