Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .github/workflows/CI.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# This file is autogenerated by maturin v1.8.3
# This file is autogenerated by maturin v1.9.4
# To update, run
#
# maturin generate-ci github -o .github/workflows/CI.yml --pytest
Expand Down Expand Up @@ -175,6 +175,10 @@ jobs:
target: ${{ matrix.platform.target }}
args: --release --out dist
sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
- uses: actions/setup-python@v5
with:
python-version: 3.13t
architecture: ${{ matrix.platform.target }}
- name: Build free-threaded wheels
uses: PyO3/maturin-action@v1
with:
Expand Down
124 changes: 65 additions & 59 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ name = "html2text_rs"
crate-type = ["cdylib"]

[dependencies]
pyo3 = { version = "0.24.1", features = ["extension-module", "abi3-py38", "generate-import-lib"] }
html2text = "0.14.3"
pyo3 = { version = "0.26.0", features = ["extension-module", "abi3-py38", "generate-import-lib"] }
html2text = "0.15.3"

[profile.release]
codegen-units = 1
Expand Down
10 changes: 3 additions & 7 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ fn text_markdown<'py>(html: &Bound<'py, PyString>, width: usize) -> PyResult<Str
let html_string = html.clone().unbind();
let html_cow = html_string.to_cow(py)?;
let text = py
.allow_threads(|| from_read(html_cow.as_bytes(), width))
.detach(|| from_read(html_cow.as_bytes(), width))
.expect("Error when extracting markdown text");
Ok(text)
}
Expand All @@ -27,9 +27,7 @@ fn text_plain<'py>(html: &Bound<'py, PyString>, width: usize) -> PyResult<String
let html_string = html.clone().unbind();
let html_cow = html_string.to_cow(py)?;
let text = py
.allow_threads(|| {
from_read_with_decorator(html_cow.as_bytes(), width, TrivialDecorator::new())
})
.detach(|| from_read_with_decorator(html_cow.as_bytes(), width, TrivialDecorator::new()))
.expect("Error when extracting plain text");
Ok(text)
}
Expand All @@ -43,9 +41,7 @@ fn text_rich<'py>(html: &Bound<'py, PyString>, width: usize) -> PyResult<String>
let html_string = html.clone().unbind();
let html_cow = html_string.to_cow(py)?;
let text = py
.allow_threads(|| {
from_read_with_decorator(html_cow.as_bytes(), width, RichDecorator::new())
})
.detach(|| from_read_with_decorator(html_cow.as_bytes(), width, RichDecorator::new()))
.expect("Error when extracting rich text");
Ok(text)
}
Expand Down
Loading