Markdown is URL encoding my images links in Templates
Everything is working fine after installation, I am also using https://github.com/timmyomahony/django-pagedown for Admin.
When I insert the images with URL links and do not use {{ article.description }} instead of {{ article.description|markdown }} I can see the URL just fine like this:
"http://www.example.com/image.jpg" in templates.
In the Admin:
![image title][1]
[1]: http://www.example.com/image.jpg
But as soon as I add template tag "markdown" - {{ article.description|markdown }}
HTML output is <img src="http%3A%2F%2Fwww.example.com%2Fimage.jpg"> and the image cannot be loaded. I have tried it on my 2 projects if I am wrong in some way but the same result.
Any updates on this? I am having the same issue..
This can help, I am not sure if it is proper solution but it works.
MARKDOWN_DEUX_STYLES = { "default": { "extras": { "code-friendly": None, }, "safe_mode": False, }, }
Set "safe_mode" to False and in the template you can do
{% for item in items %}
{{ item.description | markdown | safe }}
{% endfor %}
@rentgeeen Hey thanks so much for responding that helped a lot, how did you find that out btw?
Look here
https://github.com/trentm/django-markdown-deux#markdown_deux_styles-setting
And notice the 2nd example: "Here is how you might add styles of your own, and preserve the default style"
I played with that code - there is safe_mode: False
But would like to know proper answer + last response here was like 2 years ago so I am not sure if it is maintained still.
(Merry Christmas :) )
I would also want this fixed. Using 'safe_mode': False is not a good enough solution as it allows users to use whatever HTML they want. It's a huge security vulnerability for user generated content.