diff options
-rw-r--r-- | markdown/inlinepatterns.py | 4 | ||||
-rw-r--r-- | tests/misc/attributes-image-ref.html | 1 | ||||
-rw-r--r-- | tests/misc/attributes-image-ref.txt | 4 |
3 files changed, 9 insertions, 0 deletions
diff --git a/markdown/inlinepatterns.py b/markdown/inlinepatterns.py index d0f4490..a1b264c 100644 --- a/markdown/inlinepatterns.py +++ b/markdown/inlinepatterns.py @@ -432,6 +432,10 @@ class ImageReferencePattern(ReferencePattern): el.set("src", self.sanitize_url(href)) if title: el.set("title", title) + + if self.markdown.enable_attributes: + text = handleAttributes(text, el) + el.set("alt", self.unescape(text)) return el diff --git a/tests/misc/attributes-image-ref.html b/tests/misc/attributes-image-ref.html new file mode 100644 index 0000000..6974420 --- /dev/null +++ b/tests/misc/attributes-image-ref.html @@ -0,0 +1 @@ +<p><img alt="img" id="foo" src="http://example.com/i.jpg" /></p>
\ No newline at end of file diff --git a/tests/misc/attributes-image-ref.txt b/tests/misc/attributes-image-ref.txt new file mode 100644 index 0000000..a216971 --- /dev/null +++ b/tests/misc/attributes-image-ref.txt @@ -0,0 +1,4 @@ +![img{@id=foo}][img] + + [img]: http://example.com/i.jpg + |