From 541b3eccb1cd8d850696ae537ce8d23d2355e9af Mon Sep 17 00:00:00 2001 From: Titus Date: Thu, 9 Aug 2012 20:06:58 -0600 Subject: [PATCH] Fixed #26 -- Urls which contained matched parenthesis are now supported --- src/showdown.js | 2 +- test/cases/url-with-parenthesis.html | 2 ++ test/cases/url-with-parenthesis.md | 2 ++ 3 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 test/cases/url-with-parenthesis.html create mode 100644 test/cases/url-with-parenthesis.md diff --git a/src/showdown.js b/src/showdown.js index 869d753..73f4e68 100644 --- a/src/showdown.js +++ b/src/showdown.js @@ -483,7 +483,7 @@ var _DoAnchors = function(text) { ) /g,writeAnchorTag); */ - text = text.replace(/(\[((?:\[[^\]]*\]|[^\[\]])*)\]\([ \t]*()?[ \t]*((['"])(.*?)\6[ \t]*)?\))/g,writeAnchorTag); + text = text.replace(/(\[((?:\[[^\]]*\]|[^\[\]])*)\]\([ \t]*()?[ \t]*((['"])(.*?)\6[ \t]*)?\))/g,writeAnchorTag); // // Last, handle reference-style shortcuts: [link text] diff --git a/test/cases/url-with-parenthesis.html b/test/cases/url-with-parenthesis.html new file mode 100644 index 0000000..d42cee8 --- /dev/null +++ b/test/cases/url-with-parenthesis.html @@ -0,0 +1,2 @@ + +

There's an episode of Star Trek: The Next Generation

\ No newline at end of file diff --git a/test/cases/url-with-parenthesis.md b/test/cases/url-with-parenthesis.md new file mode 100644 index 0000000..f271d26 --- /dev/null +++ b/test/cases/url-with-parenthesis.md @@ -0,0 +1,2 @@ + +There's an [episode](http://en.memory-alpha.org/wiki/Darmok_(episode)) of Star Trek: The Next Generation \ No newline at end of file