Skip to main content

parse-html5

Source-preserving HTML5 parsing and safe typed HTML rendering. Python 3.14+, with no runtime dependencies.

python -m pip install parse-html5
from parse_html5 import parse, parse_fragment, render

document = parse('<main><h1>Hello &amp; welcome</h1><br></main>')
assert document.children[0].name == "main"
assert document.children[0].source.startswith("<main>")
assert "&amp;" not in render(document)  # Text is escaped as needed

fragment = parse_fragment('<p>one</p><p>two</p>')
assert len(fragment.children) == 2
assert render(fragment) == "<p>one</p><p>two</p>"

The public AST uses immutable dataclasses for documents, fragments, elements, text, comments, doctypes, processing instructions and attributes. Each node can retain its exact source slice and code-point source span. HTML entities are decoded through the stdlib entity table.

Rendering escapes element text and attribute values by default. It omits event-handler attributes and unsafe executable URL schemes. The renderer does not claim to be a full HTML sanitizer; callers that accept untrusted HTML should apply application-specific policy.

Void elements and raw-text elements are recognized. Optional HTML end tags receive common correction behavior, including paragraph, list-item, table, definition-list and option closures.

Development and distribution qualification:

uv sync --locked
uv run --frozen python -m pytest
uv run --frozen python scripts/check_distribution.py --output-dir /tmp/parse-html5-candidate

Metadata

Release files for parse-html5 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for parse-html5 0.1.0
File Size Uploaded Provenance Actions
parse_html5-0.1.0.tar.gz 12.5 kB With provenance Details for parse_html5-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for parse-html5 0.1.0
File Interpreter ABI Platform Actions
parse_html5-0.1.0-py3-none-any.whl Python 3 none any Details for parse_html5-0.1.0-py3-none-any.whl

Total release size: 21.0 kB

Release files / parse_html5-0.1.0.tar.gz

Download URL parse_html5-0.1.0.tar.gz
Size 12.5 kB
Tags Source
SHA-256 checksum
How to use checksums
7cc3ab3e20b25a9a32393d9d787aec782559c1868d213c48b9181e5ac9dee042
BLAKE2b-256 checksum
How to use checksums
4e254b3d940aa974f3ed89e066491011a5f4a6e4a689827538c16e5231ce148a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 22, 2026.

Transparency log

Release files / parse_html5-0.1.0-py3-none-any.whl

Download URL parse_html5-0.1.0-py3-none-any.whl
Size 8.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c7167fe3405179827029aa758d89b7cfc2a870496e843fbe72db73b75bb6d679
BLAKE2b-256 checksum
How to use checksums
5abe42c2f968237917a6991dee7a854063a6c3f1934f331e2f9c9b53edb5a99e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 22, 2026.

Transparency log

Security for parse-html5 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for parse_html5-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 22, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page