convert_html_md/
convert_html_md.rs1use rdocx::Document;
2
3fn main() {
4 let doc = Document::open("samples/feature_showcase.docx").expect("Failed to open document");
5
6 let html = doc.to_html();
7 std::fs::write("/tmp/feature_showcase.html", &html).expect("Failed to write HTML");
8 println!("HTML: {} bytes -> /tmp/feature_showcase.html", html.len());
9
10 let md = doc.to_markdown();
11 std::fs::write("/tmp/feature_showcase.md", &md).expect("Failed to write Markdown");
12 println!("Markdown: {} bytes -> /tmp/feature_showcase.md", md.len());
13
14 let mut simple = Document::new();
16 simple.add_paragraph("Hello, World!");
17 let html = simple.to_html();
18 println!("\n--- Simple HTML ---\n{html}");
19
20 let md = simple.to_markdown();
21 println!("--- Simple Markdown ---\n{md}");
22}