|
| 1 | +Metadata-Version: 2.1 |
| 2 | +Name: MarkupSafe |
| 3 | +Version: 2.1.5 |
| 4 | +Summary: Safely add untrusted strings to HTML/XML markup. |
| 5 | +Home-page: https://palletsprojects.com/p/markupsafe/ |
| 6 | +Maintainer: Pallets |
| 7 | +Maintainer-email: [email protected] |
| 8 | +License: BSD-3-Clause |
| 9 | +Project-URL: Donate, https://palletsprojects.com/donate |
| 10 | +Project-URL: Documentation, https://markupsafe.palletsprojects.com/ |
| 11 | +Project-URL: Changes, https://markupsafe.palletsprojects.com/changes/ |
| 12 | +Project-URL: Source Code, https://github.com/pallets/markupsafe/ |
| 13 | +Project-URL: Issue Tracker, https://github.com/pallets/markupsafe/issues/ |
| 14 | +Project-URL: Chat, https://discord.gg/pallets |
| 15 | +Classifier: Development Status :: 5 - Production/Stable |
| 16 | +Classifier: Environment :: Web Environment |
| 17 | +Classifier: Intended Audience :: Developers |
| 18 | +Classifier: License :: OSI Approved :: BSD License |
| 19 | +Classifier: Operating System :: OS Independent |
| 20 | +Classifier: Programming Language :: Python |
| 21 | +Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content |
| 22 | +Classifier: Topic :: Text Processing :: Markup :: HTML |
| 23 | +Requires-Python: >=3.7 |
| 24 | +Description-Content-Type: text/x-rst |
| 25 | +License-File: LICENSE.rst |
| 26 | + |
| 27 | +MarkupSafe |
| 28 | +========== |
| 29 | + |
| 30 | +MarkupSafe implements a text object that escapes characters so it is |
| 31 | +safe to use in HTML and XML. Characters that have special meanings are |
| 32 | +replaced so that they display as the actual characters. This mitigates |
| 33 | +injection attacks, meaning untrusted user input can safely be displayed |
| 34 | +on a page. |
| 35 | + |
| 36 | + |
| 37 | +Installing |
| 38 | +---------- |
| 39 | + |
| 40 | +Install and update using `pip`_: |
| 41 | + |
| 42 | +.. code-block:: text |
| 43 | + |
| 44 | + pip install -U MarkupSafe |
| 45 | + |
| 46 | +.. _pip: https://pip.pypa.io/en/stable/getting-started/ |
| 47 | + |
| 48 | + |
| 49 | +Examples |
| 50 | +-------- |
| 51 | + |
| 52 | +.. code-block:: pycon |
| 53 | + |
| 54 | + >>> from markupsafe import Markup, escape |
| 55 | + |
| 56 | + >>> # escape replaces special characters and wraps in Markup |
| 57 | + >>> escape("<script>alert(document.cookie);</script>") |
| 58 | + Markup('<script>alert(document.cookie);</script>') |
| 59 | + |
| 60 | + >>> # wrap in Markup to mark text "safe" and prevent escaping |
| 61 | + >>> Markup("<strong>Hello</strong>") |
| 62 | + Markup('<strong>hello</strong>') |
| 63 | + |
| 64 | + >>> escape(Markup("<strong>Hello</strong>")) |
| 65 | + Markup('<strong>hello</strong>') |
| 66 | + |
| 67 | + >>> # Markup is a str subclass |
| 68 | + >>> # methods and operators escape their arguments |
| 69 | + >>> template = Markup("Hello <em>{name}</em>") |
| 70 | + >>> template.format(name='"World"') |
| 71 | + Markup('Hello <em>"World"</em>') |
| 72 | + |
| 73 | + |
| 74 | +Donate |
| 75 | +------ |
| 76 | + |
| 77 | +The Pallets organization develops and supports MarkupSafe and other |
| 78 | +popular packages. In order to grow the community of contributors and |
| 79 | +users, and allow the maintainers to devote more time to the projects, |
| 80 | +`please donate today`_. |
| 81 | + |
| 82 | +.. _please donate today: https://palletsprojects.com/donate |
| 83 | + |
| 84 | + |
| 85 | +Links |
| 86 | +----- |
| 87 | + |
| 88 | +- Documentation: https://markupsafe.palletsprojects.com/ |
| 89 | +- Changes: https://markupsafe.palletsprojects.com/changes/ |
| 90 | +- PyPI Releases: https://pypi.org/project/MarkupSafe/ |
| 91 | +- Source Code: https://github.com/pallets/markupsafe/ |
| 92 | +- Issue Tracker: https://github.com/pallets/markupsafe/issues/ |
| 93 | +- Chat: https://discord.gg/pallets |
0 commit comments