Skip to content

Commit

Permalink
Changes for release 0.7.0.
Browse files Browse the repository at this point in the history
  • Loading branch information
jugglerchris committed Dec 14, 2023
1 parent ce7b6d5 commit bc7636e
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 1 deletion.
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,19 @@ Possible log types:
- `[fixed]` for any bug fixes.
- `[security]` to invite users to upgrade in case of vulnerabilities.

### 0.7.0

- [changed] Remove some noisy stderr output when encoutering control chars
(thanks sftse)
- [added] A builder-based config API.
- [changed] Updated MSRV to 1.60
- [fixed] Fixed #88: panic when a width of zero passed in (thanks bingen13)
- [fixed] Fixed #90: Fixed a divide-by-zero panic with colspan=0 (thanks mtorromeo)
- [added] Add very basic CSS colour support (under the css feature flag)
- [changed] Overhauled error handling. Internally (and in the lower level
API) errors (mainly "TooNarrow") are passed around with `Result`. Fixed
some panics and infinite loops. (Thanks WIZeaz for fuzzing)

### 0.6.0

- [changed] Improve layout of tables thanks to sftse:
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "html2text"
version = "0.6.0"
version = "0.7.0"
authors = ["Chris Emerson <[email protected]>"]
description = "Render HTML as plain text."
repository = "https://github.com/jugglerchris/rust-html2text/"
Expand Down
32 changes: 32 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,13 @@ The project aims to do a reasonable job of rendering reasonable HTML in a
terminal or other places where HTML needs to be converted to text (for
example the text/plain fallback in HTML e-mails).

With features (see below) some CSS/colour support is available.

## Examples

The simple functions like `from_read()` return formatted text (in various
formats including plain text).

```rust
use html2text::from_read;
let html = b"
Expand All @@ -32,6 +37,29 @@ assert_eq!(from_read(&html[..], 20),
");
```

A lower level API gives a bit more control. This give the same result (except for
returning errors as Result instead of panicking):

```rust
use html2text::config;

let html = b"
<ul>
<li>Item one</li>
<li>Item two</li>
<li>Item three</li>
</ul>";

assert_eq!(
config::plain()
.string_from_read(html, 20),
Ok("\
* Item one
* Item two
* Item three
");
```

A couple of simple demonstration programs are included as examples:

### html2text
Expand All @@ -56,3 +84,7 @@ $ cargo run --example html2term foo.html

Note that this example takes the HTML file as a parameter so that it can
read keys from stdin.

## Cargo Features


0 comments on commit bc7636e

Please sign in to comment.