1

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?

0

1 Answer 1

2

Rename the post-macro template to post-macro.html and Jinja will render HTML directly.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.