| Crates.io | august |
| lib.rs | august |
| version | 2.4.0 |
| created_at | 2018-12-21 09:29:16.22599+00 |
| updated_at | 2020-05-31 03:38:30.380816+00 |
| description | A crate & program for converting HTML to plain text. |
| homepage | https://gitlab.com/alantrick/august/ |
| repository | https://gitlab.com/alantrick/august/ |
| max_upload_size | |
| id | 103068 |
| size | 109,183 |
August is a Rust crate & program for converting HTML to plain text. It is specifically intended for rendering HTML emails as text; however, it can be used for other purposes like coverting HTML into text for some sort of full-text indexing or other processing.
Add this to your Cargo.toml:
[dependencies]
august = "^2.4"
and this to your code:
use august;
let input = "<p>Hello</p><i>Here's some HTML!</i>";
println!("{}", august::convert(input, 79));
println!("---");
println!("{}", august::convert_unstyled(input, 79));
The output now looks like this:
Hello
/Here's some HTML!/
---
Hello
Here's some HTML!
Cargo comes with a little command-line program august that reads
HTML from stdin and prints text to stdout. If you've enabled the
term-size feature, it uses the terminal width as the default width,
otherwise it uses 79. You can override this by passing -w WIDTH
as an argument.
Intital Python rewrite (https://alantrick.ca/writings/programming/python_to_rust).