FIX: Auto-link URLs that are inside parentheses
This commit is contained in:
parent
4d58a00387
commit
9bbab6e64e
|
@ -500,7 +500,7 @@ function invalidBoundary(args, prev) {
|
||||||
|
|
||||||
if (args.wordBoundary && (!last.match(/\W$/))) { return true; }
|
if (args.wordBoundary && (!last.match(/\W$/))) { return true; }
|
||||||
if (args.spaceBoundary && (!last.match(/\s$/))) { 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) {
|
function countLines(str) {
|
||||||
|
|
|
@ -159,10 +159,19 @@ test("Links", function() {
|
||||||
"<p><a href=\"http://discourse.org\">http://google.com ... wat</a></p>",
|
"<p><a href=\"http://discourse.org\">http://google.com ... wat</a></p>",
|
||||||
"it supports links within links");
|
"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\")",
|
cooked("[Link](http://www.example.com) (with an outer \"description\")",
|
||||||
"<p><a href=\"http://www.example.com\">Link</a> (with an outer \"description\")</p>",
|
"<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");
|
"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",
|
cooked("[ul][1]\n\n[1]: http://eviltrout.com",
|
||||||
"<p><a href=\"http://eviltrout.com\">ul</a></p>",
|
"<p><a href=\"http://eviltrout.com\">ul</a></p>",
|
||||||
"it can use `ul` as a link name");
|
"it can use `ul` as a link name");
|
||||||
|
|
Loading…
Reference in New Issue