Skip to main content

Escape HTML with style using T-Strings!

Project description

SafeHTML

A simple package for safely rendering HTML using the new template string syntax (PEP 750), introduced in Python 3.14.0b1 and above.

Example

from safehtml import html

input = "Jacob <script>alert('xss')</script>"
print(html(t"<p>Hello {input}</p>"))

Output:

<p>Hello Jacob &lt;script&gt;alert(&#x27;xss&#x27;)&lt;/script&gt;</p>

Install

uv init --python 3.14.0rc1
uv add safehtml

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

safehtml-1.0.0.tar.gz (2.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

safehtml-1.0.0-py3-none-any.whl (2.7 kB view details)

Uploaded Python 3

File details

Details for the file safehtml-1.0.0.tar.gz.

File metadata

  • Download URL: safehtml-1.0.0.tar.gz
  • Upload date:
  • Size: 2.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.3

File hashes

Hashes for safehtml-1.0.0.tar.gz
Algorithm Hash digest
SHA256 dcf54e223ed9454ae090360e6379d2a6e470ad6f95c5888c1baf2ba930be23e7
MD5 77ae095f6e4fc1f258c2083b1c0f572e
BLAKE2b-256 b8264be422fdb7848f27f6335dbae1059a8d0a8690cba720ec7ee8d148708647

See more details on using hashes here.

File details

Details for the file safehtml-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: safehtml-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 2.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.3

File hashes

Hashes for safehtml-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a090a45bb16084df429e40e2861bb13965a41a03608b8927f36627bacf9d7ed3
MD5 dace07bd646c171e8a4f026f99bec78e
BLAKE2b-256 8626cee4fb7196bf7683ec91a6fa3683201fdd1cf602a7b5615023a8536207b1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page