Go to file
openharmony_ci c44ef7f939
!15 2.1.5 升级
Merge pull request !15 from liangliang6768/master
2024-06-11 09:28:54 +00:00
__init__.py 2.1.5 升级 2024-06-11 01:22:58 +00:00
_native.py Update markupsafe form 2.0.1 to 2.1.1 2023-03-23 07:59:14 +00:00
_speedups.c Update markupsafe form 2.0.1 to 2.1.1 2023-03-23 07:59:14 +00:00
_speedups.pyi This commit is a pick commit from 1.1.1 to 2.0.1 2022-04-25 16:26:37 +08:00
.editorconfig Update markupsafe form 2.0.1 to 2.1.1 2023-03-23 07:59:14 +00:00
.gitattributes update OpenHarmony 2.0 Canary 2021-06-02 02:31:37 +08:00
.gitignore update OpenHarmony 2.0 Canary 2021-06-02 02:31:37 +08:00
.pre-commit-config.yaml 2.1.5 升级 2024-06-11 01:22:58 +00:00
.readthedocs.yaml Update markupsafe form 2.0.1 to 2.1.1 2023-03-23 07:59:14 +00:00
bundle.json update bundle.json. 2023-12-14 06:28:24 +00:00
CHANGES.rst 2.1.5 升级 2024-06-11 01:22:58 +00:00
CONTRIBUTING.rst Update markupsafe form 2.0.1 to 2.1.1 2023-03-23 07:59:14 +00:00
LICENSE.rst update OpenHarmony 2.0 Canary 2021-06-02 02:31:37 +08:00
MANIFEST.in This commit is a pick commit from 1.1.1 to 2.0.1 2022-04-25 16:26:37 +08:00
NOTICE update OpenHarmony 2.0 Canary 2021-06-02 02:31:37 +08:00
OAT.xml This commit is a pick commit from 1.1.1 to 2.0.1 2022-04-25 16:26:37 +08:00
PKG-INFO new 2024-06-11 02:26:51 +00:00
py.typed This commit is a pick commit from 1.1.1 to 2.0.1 2022-04-25 16:26:37 +08:00
README.modification new 2024-06-11 02:26:51 +00:00
README.OpenSource new 2024-06-11 02:26:51 +00:00
README.rst 2.1.5 升级 2024-06-11 01:22:58 +00:00
tox.ini 2.1.5 升级 2024-06-11 01:22:58 +00:00

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/getting-started/


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
-----

-   Documentation: https://markupsafe.palletsprojects.com/
-   Changes: https://markupsafe.palletsprojects.com/changes/
-   PyPI Releases: https://pypi.org/project/MarkupSafe/
-   Source Code: https://github.com/pallets/markupsafe/
-   Issue Tracker: https://github.com/pallets/markupsafe/issues/
-   Chat: https://discord.gg/pallets