Pre-release
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 | |
|---|---|---|---|
| htmst-1.0a9.tar.gz | 7.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| htmst-1.0a9-py3-none-any.whl | Python 3 | none | any | Details |
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
|