Metadata-Version: 2.4
Name: fast-h2m
Version: 0.4.5
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
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
Classifier: Programming Language :: Python :: 3.14
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Classifier: Programming Language :: Rust
Classifier: Typing :: Typed
Requires-Dist: maturin ; extra == 'dev'
Requires-Dist: pytest ; extra == 'dev'
Provides-Extra: dev
Summary: Python bindings for fast_h2m, a high-performance HTML to Markdown converter written in Rust.
Keywords: html,markdown,converter,pyo3,rust
Home-Page: https://github.com/RustedBytes/fast_h2m
Author-email: Yehor Smoliakov <egorsmkv@gmail.com>
License-Expression: MIT
Requires-Python: >=3.9
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
Project-URL: Documentation, https://github.com/RustedBytes/fast-h2m#readme
Project-URL: Homepage, https://github.com/RustedBytes/fast-h2m
Project-URL: Issues, https://github.com/RustedBytes/fast-h2m/issues
Project-URL: Repository, https://github.com/RustedBytes/fast-h2m

# fast-h2m

Python bindings for `fast_h2m`, a high-performance HTML to Markdown converter.

```python
import fast_h2m

markdown = fast_h2m.convert_to_markdown("<h1>Hello</h1><p>World</p>")
result = fast_h2m.convert("<h1>Hello</h1>", {"include_document_structure": True})
```

For throughput-oriented conversion of common HTML, opt into the lean DOM path:

```python
markdown = fast_h2m.convert_to_markdown(
    html,
    {"tier_strategy": "fast_dom"},
)
```

`fast_dom` skips the richer metadata, structure, visitor, selector, and repair
machinery used by the full converter.

On supported Linux and Windows wheels, choose the parser backend at runtime:

```python
markdown = fast_h2m.convert_to_markdown(
    html,
    {"tier_strategy": "tier2", "parser_backend": "asm_tl"},
)
```

`rustedbytes_tl` remains the default. Selecting `asm_tl` in a build that does
not include or support it raises a configuration error.

For mdream-backed lean conversion:

```python
markdown = fast_h2m.convert_to_markdown(
    html,
    {"tier_strategy": "mdream"},
)
```

For chunked streaming conversion:

```python
stream = fast_h2m.MarkdownStreamProcessor()
markdown = ""
markdown += stream.process_chunk("<h1>Hello</h1>")
markdown += stream.process_chunk("<p>World</p>")
markdown += stream.finish()
```

The package targets Python 3.9+ and exposes the Rust converter through PyO3.
CPython wheels use the stable `abi3` ABI, while version-specific wheels are
published for PyPy 3.11 and 3.12.

When building locally with PyPy, disable the CPython-only `abi3` feature:

```sh
maturin build --release --no-default-features --features extension-module,asm-tl
```

