All Projects → pallets → Markupsafe

pallets / Markupsafe

Licence: bsd-3-clause
Safely add untrusted strings to HTML/XML markup.

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Markupsafe

essential-templating
A set of templating libraries.
Stars: ✭ 21 (-94.28%)
Mutual labels:  template-engine
Docpad
Empower your website frontends with layouts, meta-data, pre-processors (markdown, jade, coffeescript, etc.), partials, skeletons, file watching, querying, and an amazing plugin system. DocPad will streamline your web development process allowing you to craft powerful static sites quicker than ever before.
Stars: ✭ 3,035 (+726.98%)
Mutual labels:  template-engine
Mikado
Mikado is the webs fastest template library for building user interfaces.
Stars: ✭ 323 (-11.99%)
Mutual labels:  template-engine
view-twig
Yii View Twig Renderer
Stars: ✭ 24 (-93.46%)
Mutual labels:  template-engine
Cookie
A Template-based File Generator. Like cookiecutter but works with file templates instead of project templates.
Stars: ✭ 261 (-28.88%)
Mutual labels:  template-engine
Http Rpc
Lightweight REST for Java
Stars: ✭ 298 (-18.8%)
Mutual labels:  template-engine
thera
A template engine for Scala
Stars: ✭ 49 (-86.65%)
Mutual labels:  template-engine
Jetbrick Template 2x
Template Engine for Java
Stars: ✭ 351 (-4.36%)
Mutual labels:  template-engine
Doxyrest
A compiler from Doxygen XML to reStructuredText -- hence, the name. It parses XML databases generated by Doxygen and produces reStructuredText for the Python documentation generator Sphinx.
Stars: ✭ 265 (-27.79%)
Mutual labels:  template-engine
Slime
Minimalistic HTML templates for Elixir, inspired by Slim.
Stars: ✭ 315 (-14.17%)
Mutual labels:  template-engine
bart
A compile time templating language for Rust inspired by Mustache
Stars: ✭ 29 (-92.1%)
Mutual labels:  template-engine
Jinja2cpp
Jinja2 C++ (and for C++) almost full-conformance template engine implementation
Stars: ✭ 257 (-29.97%)
Mutual labels:  template-engine
Email Templates
📫 Create, preview, and send custom email templates for Node.js. Highly configurable and supports automatic inline CSS, stylesheets, embedded images and fonts, and much more!
Stars: ✭ 3,291 (+796.73%)
Mutual labels:  template-engine
bh-php
PHP port of https://github.com/bem/bh. It's cool thing but better use this:
Stars: ✭ 33 (-91.01%)
Mutual labels:  template-engine
Pug
Pug template engine for PHP
Stars: ✭ 341 (-7.08%)
Mutual labels:  template-engine
Contemplate
Contemplate: Fast, extendable object-oriented and light-weight Template Engine for PHP, Python, Node.js, Browser and XPCOM/SDK JavaScript
Stars: ✭ 15 (-95.91%)
Mutual labels:  template-engine
Microwebsrv2
The last Micro Web Server for IoTs (MicroPython) or large servers (CPython), that supports WebSockets, routes, template engine and with really optimized architecture (mem allocations, async I/Os). Ready for ESP32, STM32 on Pyboard, Pycom's chipsets (WiPy, LoPy, ...). Robust, efficient and documented!
Stars: ✭ 295 (-19.62%)
Mutual labels:  template-engine
Squirrelly
Semi-embedded JS template engine that supports helpers, filters, partials, and template inheritance. 4KB minzipped, written in TypeScript ⛺
Stars: ✭ 359 (-2.18%)
Mutual labels:  template-engine
Thymeleaf Spring
Thymeleaf integration module for Spring
Stars: ✭ 349 (-4.9%)
Mutual labels:  template-engine
Rivets
Lightweight and powerful data binding.
Stars: ✭ 3,221 (+777.66%)
Mutual labels:  template-engine

MarkupSafe

MarkupSafe implements a text object that escapes characters so it is safe to use in HTML and XML. Characters that have special meanings are replaced so that they display as the actual characters. This mitigates injection attacks, meaning untrusted user input can safely be displayed on a page.

Installing

Install and update using pip_:

.. code-block:: text

pip install -U MarkupSafe

.. _pip: https://pip.pypa.io/en/stable/quickstart/

Examples

.. code-block:: pycon

>>> from markupsafe import Markup, escape

>>> # escape replaces special characters and wraps in Markup
>>> escape("<script>alert(document.cookie);</script>")
Markup('&lt;script&gt;alert(document.cookie);&lt;/script&gt;')

>>> # wrap in Markup to mark text "safe" and prevent escaping
>>> Markup("<strong>Hello</strong>")
Markup('<strong>hello</strong>')

>>> escape(Markup("<strong>Hello</strong>"))
Markup('<strong>hello</strong>')

>>> # Markup is a str subclass
>>> # methods and operators escape their arguments
>>> template = Markup("Hello <em>{name}</em>")
>>> template.format(name='"World"')
Markup('Hello <em>&#34;World&#34;</em>')

Donate

The Pallets organization develops and supports MarkupSafe and other popular packages. In order to grow the community of contributors and users, and allow the maintainers to devote more time to the projects, please donate today_.

.. _please donate today: https://palletsprojects.com/donate

Links

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].