Metadata-Version: 2.4
Name: resion
Version: 22.0.1
Summary: Minimal tree-based HTML parsing with basic selectors.
Author-email: hositel <hositel@gmail.com>
License-Expression: MIT
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: pafex
Provides-Extra: dev
Requires-Dist: pytest; extra == "dev"
Requires-Dist: pytest-cov; extra == "dev"
Dynamic: license-file

# resion

Minimal tree-based HTML parser built on the stdlib `html.parser`: an
editable `Node` tree, basic selectors (tag, `#id`, `.class`), readable-text
extraction and minification.

## Install

```bash
pip install resion
```

## Usage

```python
import resion as rs

doc = rs.parse('<h1 id="t">Title</h1><p class="lead">Hi</p>')

doc.find('#t').text_content()        # 'Title'
doc.find_all('p')                    # [Node p]
doc.find('.lead').get_attr('class')  # 'lead'
rs.extract_text(doc)                 # readable text, boilerplate removed
rs.minify('<div> a </div><!-- x -->')
```

The tree is editable:

```python
from resion import Node

doc.find('p').replace_with(Node('span'))
node = doc.find('#t')
node.set_attr('id', 'new').unwrap()
doc.to_html()
```

Settings are a `Config` or plain dict merged over defaults; a
`default.config` next to the package is auto-loaded at import (falling back
to built-in defaults when absent):

```python
from resion import Config, Engine, get_config, load_config

engine = Engine({'strict_mode': True})
engine = Engine(load_config('my.config'))
get_config().get('strict_mode', False)
```

Bytes input is decoded via BOM sniffing and `<meta charset>` detection;
oversized input and malformed HTML are rejected in strict mode with
`PafexError`.
