Rust
Rust
Convert HTML to plain-text
See more HTML-to-XML/Text Examples
Demonstrates how to convert HTML to plain-text.Chilkat Rust Downloads
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
let h2t = chilkat::HtmlToText::new();
// Set the HTML:
let html = "<html><body><p>This is a test.</p><blockquote>Here is text within a blockquote</blockquote></body></html>".to_string();
let plain_text = h2t.to_text(&html).unwrap_or_default();
println!("{}", plain_text);
// The output looks like this:
// This is a test.
//
// Here is text within a blockquote