Reputation: 615
I have the following template called post-macro
, but when I call the macro in the page.html
template, it inserts a string, with quotes, containing the HTML, rather than directly inserting the HTML.
post-macro
:
{% macro postmacro(post) %}
// html here
{% endmacro %}
page.html
:
{% from "post-macro" import postmacro with context %}
{{ postmacro(post) }}
It renders the page like this. Notice the double quotes around the output.
"
html here
"
What do I need to change to get the HTML directly rather than in quotes?
Upvotes: 1
Views: 1661
Reputation: 615
Rename the post-macro
template to post-macro.html
and Jinja will render HTML directly.
Upvotes: 2