Skip to content

Instantly share code, notes, and snippets.

@inklesspen
Created October 31, 2014 20:03
Show Gist options
  • Save inklesspen/8d8416da94d04b9c1b85 to your computer and use it in GitHub Desktop.
Save inklesspen/8d8416da94d04b9c1b85 to your computer and use it in GitHub Desktop.
>>> markupsafe.escape(u"Hello {tag}there{end}").format(tag="<a href='...'>", end="</a>")
Markup('Hello &lt;a href=&#39;...&#39;&gt;there&lt;/a&gt;')
>>> markupsafe.escape(u"Hello {tag}there{end}").format(tag=markupsafe.Markup("<a href='...'>"), end=markupsafe.Markup("</a>"))
Markup("Hello <a href='...'>there</a>")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment