diff --git a/src/commonmark-rules.js b/src/commonmark-rules.js index 77a4c529..8aa16170 100644 --- a/src/commonmark-rules.js +++ b/src/commonmark-rules.js @@ -153,6 +153,7 @@ rules.inlineLink = { replacement: function (content, node) { var href = node.getAttribute('href') + if (href) href = href.replace(/([()])/g, '\\$1') var title = cleanAttribute(node.getAttribute('title')) if (title) title = ' "' + title + '"' return '[' + content + '](' + href + title + ')' diff --git a/test/index.html b/test/index.html index 26fa586c..f1bac8d9 100644 --- a/test/index.html +++ b/test/index.html @@ -217,6 +217,11 @@ link") +
+
An anchor
+
[An anchor](http://example.com?\(query\))
+
+
Anchor without a title
Anchor without a title