Debian Codegraph @

PKG-INFO

raw
1 Metadata-Version: 2.4
2 Name: MarkupSafe
3 Version: 3.0.3
4 Summary: Safely add untrusted strings to HTML/XML markup.
5 Maintainer-email: Pallets <[email protected]>
6 License-Expression: BSD-3-Clause
7 Project-URL: Donate, https://palletsprojects.com/donate
8 Project-URL: Documentation, https://markupsafe.palletsprojects.com/
9 Project-URL: Changes, https://markupsafe.palletsprojects.com/page/changes/
10 Project-URL: Source, https://github.com/pallets/markupsafe/
11 Project-URL: Chat, https://discord.gg/pallets
12 Classifier: Development Status :: 5 - Production/Stable
13 Classifier: Environment :: Web Environment
14 Classifier: Intended Audience :: Developers
15 Classifier: Operating System :: OS Independent
16 Classifier: Programming Language :: Python
17 Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
18 Classifier: Topic :: Text Processing :: Markup :: HTML
19 Classifier: Typing :: Typed
20 Requires-Python: >=3.9
21 Description-Content-Type: text/markdown
22 License-File: LICENSE.txt
23 Dynamic: license-file
24
25 <div align="center"><img src="https://raw.githubusercontent.com/pallets/markupsafe/refs/heads/stable/docs/_static/markupsafe-name.svg" alt="" height="150"></div>
26
27 # MarkupSafe
28
29 MarkupSafe implements a text object that escapes characters so it is
30 safe to use in HTML and XML. Characters that have special meanings are
31 replaced so that they display as the actual characters. This mitigates
32 injection attacks, meaning untrusted user input can safely be displayed
33 on a page.
34
35
36 ## Examples
37
38 ```pycon
39 >>> from markupsafe import Markup, escape
40
41 >>> # escape replaces special characters and wraps in Markup
42 >>> escape("<script>alert(document.cookie);</script>")
43 Markup('&lt;script&gt;alert(document.cookie);&lt;/script&gt;')
44
45 >>> # wrap in Markup to mark text "safe" and prevent escaping
46 >>> Markup("<strong>Hello</strong>")
47 Markup('<strong>hello</strong>')
48
49 >>> escape(Markup("<strong>Hello</strong>"))
50 Markup('<strong>hello</strong>')
51
52 >>> # Markup is a str subclass
53 >>> # methods and operators escape their arguments
54 >>> template = Markup("Hello <em>{name}</em>")
55 >>> template.format(name='"World"')
56 Markup('Hello <em>&#34;World&#34;</em>')
57 ```
58
59 ## Donate
60
61 The Pallets organization develops and supports MarkupSafe and other
62 popular packages. In order to grow the community of contributors and
63 users, and allow the maintainers to devote more time to the projects,
64 [please donate today][].
65
66 [please donate today]: https://palletsprojects.com/donate
67
68 ## Contributing
69
70 See our [detailed contributing documentation][contrib] for many ways to
71 contribute, including reporting issues, requesting features, asking or answering
72 questions, and making PRs.
73
74 [contrib]: https://palletsprojects.com/contributing/