Skip to main content

extract

Function extract 

Source
pub fn extract(content: &str) -> Extracted
Expand description

Extract plain text from content, auto-detecting the format.

Examines the content to determine whether it is HTML or plain text, then applies the appropriate extraction strategy. Plain text and markdown pass through unchanged.

For PDF extraction, use the pdf module (requires the pdf feature).

ยงExamples

let result = deformat::extract("<html><body><p>Hello</p></body></html>");
assert!(result.text.contains("Hello"));
assert_eq!(result.format, deformat::Format::Html);