lepture/mistune

Ampersand characters in image source are escaped (v2.0.4)

acidtv opened this issue · 2 comments

Example:

import mistune                                                          
content = "![description](https://foo.com/?a=1&b=2)"                    
markdown = mistune.create_markdown(escape=False)                        
markdown(content)
# '<p><img src="https://foo.com/?a=1&amp;b=2" alt="description" /></p>\n' 

This causes problems loading the image in some cases.

I think this is caused by escape_url using html.escape. According to the docs (https://docs.python.org/3/library/html.html) html.escape escapes ampersands, and I don't think that should happen for urls.

My bad, this was a bug in our custom mistune renderer.

Thanks for checking!