diff --git a/src/showdown.js b/src/showdown.js index 3e37dab..28d715e 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