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), in Python 3.14.

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
uv python pin 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.1.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.1-py3-none-any.whl (2.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: safehtml-1.0.1.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.1.tar.gz
Algorithm Hash digest
SHA256 a1d3b001977d48f9afdeaf2f0f05c80a93c597912b6cde9a189bf1bc58fa9981
MD5 e92e6bd45c541cbe850f206676f75969
BLAKE2b-256 c0606e428764a0d45d1e56ae8b809012ae73d6e17e20e0f3da85d2ba01a944a3

See more details on using hashes here.

File details

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

File metadata

  • Download URL: safehtml-1.0.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b75d868ccc738ec743493adf18164b1fd969f047314461e1c96eae24c4eda829
MD5 acc46dc3696cf00f928f896970f5243e
BLAKE2b-256 96efa224599b287f1c2207900eff5118aef5a7680720de61566b03f98740c298

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