4 ms·
Jinja, a Python template engine, does something like that. When you include a string in a template, it's automatically escaped, but you can disable that by wrap
by eurleif 15y ago
Jinja, a Python template engine, does something like that. When you include a string in a template, it's automatically escaped, but you can disable that by wrapping the string in a Markup object. You can also use the Markup class directly:
>>> foo = u'I <3 you.'
>>> bar = Markup(u'<h1>') + foo + Markup(u'</h1>')
>>> print bar
<h1>I <3 you.</h1>