METADATA 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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 <contact@palletsprojects.com>
  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. <div align="center"><img src="https://raw.githubusercontent.com/pallets/markupsafe/refs/heads/stable/docs/_static/markupsafe-name.svg" alt="" height="150"></div>
  25. # MarkupSafe
  26. MarkupSafe implements a text object that escapes characters so it is
  27. safe to use in HTML and XML. Characters that have special meanings are
  28. replaced so that they display as the actual characters. This mitigates
  29. injection attacks, meaning untrusted user input can safely be displayed
  30. on a page.
  31. ## Examples
  32. ```pycon
  33. >>> from markupsafe import Markup, escape
  34. >>> # escape replaces special characters and wraps in Markup
  35. >>> escape("<script>alert(document.cookie);</script>")
  36. Markup('&lt;script&gt;alert(document.cookie);&lt;/script&gt;')
  37. >>> # wrap in Markup to mark text "safe" and prevent escaping
  38. >>> Markup("<strong>Hello</strong>")
  39. Markup('<strong>hello</strong>')
  40. >>> escape(Markup("<strong>Hello</strong>"))
  41. Markup('<strong>hello</strong>')
  42. >>> # Markup is a str subclass
  43. >>> # methods and operators escape their arguments
  44. >>> template = Markup("Hello <em>{name}</em>")
  45. >>> template.format(name='"World"')
  46. Markup('Hello <em>&#34;World&#34;</em>')
  47. ```
  48. ## Donate
  49. The Pallets organization develops and supports MarkupSafe and other
  50. popular packages. In order to grow the community of contributors and
  51. users, and allow the maintainers to devote more time to the projects,
  52. [please donate today][].
  53. [please donate today]: https://palletsprojects.com/donate
  54. ## Contributing
  55. See our [detailed contributing documentation][contrib] for many ways to
  56. contribute, including reporting issues, requesting features, asking or answering
  57. questions, and making PRs.
  58. [contrib]: https://palletsprojects.com/contributing/