summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/clarktown/renderers/link_and_image.clj2
-rw-r--r--test/clarktown/renderers/link_and_image_test.clj5
2 files changed, 5 insertions, 2 deletions
diff --git a/src/clarktown/renderers/link_and_image.clj b/src/clarktown/renderers/link_and_image.clj
index 7e06db5..05dccac 100644
--- a/src/clarktown/renderers/link_and_image.clj
+++ b/src/clarktown/renderers/link_and_image.clj
@@ -13,7 +13,7 @@
"Renders all occurring links and images."
[block _ _]
(loop [block block
- matches (-> (re-seq #"\!?\[([a-zA-Z0-9\-\_\.\,\']+( [a-zA-Z0-9\-\_\.\,\']+)*)\]\((.*?)\)" block)
+ matches (-> (re-seq #"\!?\[([a-zA-Z0-9\-\_\.\,\']*( [a-zA-Z0-9\-\_\.\,\']+)*)\]\((.*?)\)" block)
distinct)]
(if (empty? matches)
block
diff --git a/test/clarktown/renderers/link_and_image_test.clj b/test/clarktown/renderers/link_and_image_test.clj
index d17e070..e336057 100644
--- a/test/clarktown/renderers/link_and_image_test.clj
+++ b/test/clarktown/renderers/link_and_image_test.clj
@@ -20,4 +20,7 @@
(testing "Creating an image"
(is (= (link-and-image/render "![This is an image](https://example.com)" nil nil)
- "<img src=\"https://example.com\" alt=\"This is an image\">")))) \ No newline at end of file
+ "<img src=\"https://example.com\" alt=\"This is an image\">"))
+
+ (is (= (link-and-image/render "![](https://example.com)" nil nil)
+ "<img src=\"https://example.com\" alt=\"\">"))))