1

Using flask, I'm passing in a list of dictionaries to one of the pages. One of the variables contains html text (ex:var x = <h1>hello</h1>). How would I get it to display as

hello

rather than just print out "<h1>hello</h1>"? Here's my code so far (post.description has the html variable; It's equal to <h1>hello</h1>):

<!DOCTYPE html>
<html>
    <head>

    </head>
    <body>
    {% for post in posts %}
        <p>{{post.title}}<p>

        {{post.description}}
        
    {% endfor %}
    </body>

</html>

1 Answer 1

1

You can use safe to render the HTML code with Jinja.
Example: {{ post.description | safe }}

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.