Name | Date | Size | #Lines | LOC | ||
---|---|---|---|---|---|---|
.. | 03-May-2022 | - | ||||
src/ | H | 30-Mar-2022 | - | 1,223 | 1,011 | |
CHANGES.rst | H A D | 30-Mar-2022 | 1.8 KiB | 98 | 57 | |
LICENSE.rst | H A D | 30-Mar-2022 | 1.4 KiB | 29 | 23 | |
MANIFEST.in | H A D | 30-Mar-2022 | 140 | 9 | 8 | |
PKG-INFO | H A D | 30-Mar-2022 | 4 KiB | 102 | 80 | |
README.rst | H A D | 30-Mar-2022 | 2.1 KiB | 70 | 49 | |
setup.cfg | H A D | 30-Mar-2022 | 401 | 28 | 21 | |
setup.py | H A D | 30-Mar-2022 | 4.1 KiB | 126 | 106 | |
tox.ini | H A D | 30-Mar-2022 | 886 | 45 | 39 |
README.rst
1MarkupSafe 2========== 3 4MarkupSafe implements a text object that escapes characters so it is 5safe to use in HTML and XML. Characters that have special meanings are 6replaced so that they display as the actual characters. This mitigates 7injection attacks, meaning untrusted user input can safely be displayed 8on a page. 9 10 11Installing 12---------- 13 14Install and update using `pip`_: 15 16.. code-block:: text 17 18 pip install -U MarkupSafe 19 20.. _pip: https://pip.pypa.io/en/stable/quickstart/ 21 22 23Examples 24-------- 25 26.. code-block:: pycon 27 28 >>> from markupsafe import Markup, escape 29 >>> # escape replaces special characters and wraps in Markup 30 >>> escape('<script>alert(document.cookie);</script>') 31 Markup(u'<script>alert(document.cookie);</script>') 32 >>> # wrap in Markup to mark text "safe" and prevent escaping 33 >>> Markup('<strong>Hello</strong>') 34 Markup('<strong>hello</strong>') 35 >>> escape(Markup('<strong>Hello</strong>')) 36 Markup('<strong>hello</strong>') 37 >>> # Markup is a text subclass (str on Python 3, unicode on Python 2) 38 >>> # methods and operators escape their arguments 39 >>> template = Markup("Hello <em>%s</em>") 40 >>> template % '"World"' 41 Markup('Hello <em>"World"</em>') 42 43 44Donate 45------ 46 47The Pallets organization develops and supports MarkupSafe and other 48libraries that use it. In order to grow the community of contributors 49and users, and allow the maintainers to devote more time to the 50projects, `please donate today`_. 51 52.. _please donate today: https://palletsprojects.com/donate 53 54 55Links 56----- 57 58* Website: https://palletsprojects.com/p/markupsafe/ 59* Documentation: https://markupsafe.palletsprojects.com/ 60* License: `BSD-3-Clause <https://github.com/pallets/markupsafe/blob/master/LICENSE.rst>`_ 61* Releases: https://pypi.org/project/MarkupSafe/ 62* Code: https://github.com/pallets/markupsafe 63* Issue tracker: https://github.com/pallets/markupsafe/issues 64* Test status: 65 66 * Linux, Mac: https://travis-ci.org/pallets/markupsafe 67 * Windows: https://ci.appveyor.com/project/pallets/markupsafe 68 69* Test coverage: https://codecov.io/gh/pallets/markupsafe 70