Crate rtf_to_html

Crate rtf_to_html 

Source
Expand description

RTF to HTML conversion library

Converts RTF documents to clean, semantic HTML. Built on top of the rtf-parser crate.

§Example

use rtf_to_html::rtf_to_html;

let rtf = br#"{\rtf1\ansi\deff0 Hello World}"#;
let html = rtf_to_html(rtf).unwrap();
assert!(html.contains("Hello World"));

§Features

  • Converts RTF to semantic HTML (<strong>, <em>, <u>)
  • Paragraph structure preserved with <p> tags
  • XSS-safe output (HTML entities escaped)
  • Plain text extraction (strips all formatting)

Enums§

RtfError
Errors that can occur during RTF conversion

Functions§

rtf_to_html
Convert RTF content to HTML
rtf_to_plain_text
Extract plain text from RTF (strips all formatting)