Markdown does not render as html in template
Closed this issue · 0 comments
I am adding a very simple blog functionality to my app, where I need some users to get in the admin, write a markdown-based post in it, then saving it and showing in a view (no comments, no previous-next post, no search, no nothing, just user-created pages). I have replaced the zinnia/entry_detail.html
with a custom template, which has at some point
{{ entry.html_content | safe}}
Expected behavior
I have a post with markdown markup, like this:
*Lorem Ipsum* is simply dummy text of the printing and typesetting industry
when I see the html_content
in the console it is the corresponding html:
In [19]: print(entry.html_content)
<p><em>Lorem Ipsum</em> is simply dummy text of the printing and typesetting industry.</p>
I expect in a template to render the same.
Actual behavior
The text renders without the processed markdown, like this:
<p>*Lorem Ipsum* is simply dummy text of the printing and typesetting industry.</p>
Notice that the <p>
tags are correct, I am not setting them by hand (my template does not have <p>
surrounding the html_content
), but the text inside is not processed. Is this expected behavior?
Steps to reproduce the issue
- Setup a django project and install zinnia.
- In a local app, create the file
templates/zinnia/entry_detail.html
. - In
entry_detail.html
add{{ entry.html_content | safe }}
. - Get the rendered source html.
Specifications
- Zinnia version: 0.20
- Django version: 2.0.5
- Python version: 3.5.2
- Operating system: Ubuntu 18.04