This release is a pre-release and may not be stable for production use.
htmst
htmst is a python library for parsing html into AST with positions.
Installation
uv add htmst
or
pip install htmst
Usage
from htmst import HtmlAst
html = """<span foo="bar">hi</span>"""
ast = HtmlAst(html)
print(ast.root.children[0].tag) # span
print(ast.root.children[0].start.row) # 0
print(ast.root.children[0].start.col) # 0
print(ast.root.children[0].end.row) # 0
print(ast.root.children[0].end.col) # 25
print(ast.root.children[0].attrs[0].name) # foo
print(ast.root.children[0].attrs[0].value) # bar
print(ast.root.children[0].attrs[0].start.row) # 0
print(ast.root.children[0].attrs[0].start.col) # 6
print(ast.root.children[0].attrs[0].end.row) # 0
print(ast.root.children[0].attrs[0].end.col) # 15
Nodes
DoubleTagNode: represents double tagsSingleTagNode: represents single tagsAttrNode: represents attributesTextNode: represents textsCommentNode: represents commentsDoctypeNode: represents doctypes
Each node has a start and end position.
Contributing
Contributions are welcome! Please read the contributing guidelines for more information.
License
This project is licensed under the MIT License.
Metadata
Release files for htmst 1.0a9
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| htmst-1.0a9.tar.gz | 7.1 kB | Without provenance | Details for htmst-1.0a9.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| htmst-1.0a9-py3-none-any.whl | Python 3 | none | any | Details for htmst-1.0a9-py3-none-any.whl |
Total release size: 13.0 kB
Release files / htmst-1.0a9.tar.gz
| Download URL | htmst-1.0a9.tar.gz |
|---|---|
| Size | 7.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a3c86f722b0e54969298e5b575897c616878075d0e22a1adf519a0769aedb1c2
|
|
BLAKE2b-256 checksum How to use checksums |
d7d9bb3759c655792b62e834cfed207f301cf1f0886ac0f55099ae72f6e7588c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.0.1 CPython/3.12.8
|
Release files / htmst-1.0a9-py3-none-any.whl
| Download URL | htmst-1.0a9-py3-none-any.whl |
|---|---|
| Size | 5.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6f2e58c0b1379ede495de1f3e3dc3c197a68af35b3f7dd9d3047ab46f181897d
|
|
BLAKE2b-256 checksum How to use checksums |
10a7170fff1df013443f4376139943f88539d106eaa05716fbbb5b9dc6c0a1cd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.0.1 CPython/3.12.8
|
Security for htmst 1.0a9
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
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.