whi
whi

Reputation: 2750

how to display multiple line text by pyramid

i'm using pyramid to display a multiline text. such as:

txt="""
abc
def
"""

html render(such as jinja2) does not have paragraph tag so i add paragraph tag to txt, but finally, it render with escape

<p> abc </p> ...

so how to correctly display the multiline?

Upvotes: 0

Views: 242

Answers (3)

Nemoden
Nemoden

Reputation: 9056

Working with automatic escaping in jinja2 is easy - you eather apply |safe filter inside a template or your variable passed to the template should be of type Markup

Upvotes: 1

tsurantino
tsurantino

Reputation: 1027

It's ambiguous whether you have autoescaping set to true or not, but if that is the case, then when rendering, make sure you add " | safe".

ie: {{post.render | safe }}

More information on escaping can be found here: http://jinja.pocoo.org/docs/templates/#html-escaping

Upvotes: 3

Brandt Solovij
Brandt Solovij

Reputation: 2134

\r\n or \n does not suffice ? if i understand your question you are simply trying to add linebreaks. Use those special character sequences per your OS

Upvotes: 0

Related Questions