1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
//! # Markkit
//!
//! Extract clean markdown from any format.
//!
//! Markkit is a Rust library for converting HTML, PDF, DOCX, spreadsheets,
//! and other document formats into clean, well-structured markdown.
//!
//! ## Quick Start
//!
//! ```rust,no_run
//! use markkit::{DocumentHint, Markkit};
//!
//! # async fn example() -> anyhow::Result<()> {
//! let markkit = Markkit::builder().build();
//!
//! // Extract markdown from HTML
//! let md = markkit.extract_html("<h1>Hello</h1><p>World</p>").await?;
//!
//! // Convert any supported document from bytes (format detected from the
//! // content type, then the file extension, then magic bytes).
//! let bytes = std::fs::read("report.docx")?;
//! let doc = markkit.extract_document_sync(&bytes, DocumentHint::file_name("report.docx"))?;
//! println!("{} ({}): {}", doc.title.unwrap_or_default(), doc.format, doc.markdown);
//!
//! // Extract from a URL (requires the `http_client` feature)
//! #[cfg(feature = "http_client")]
//! let md = markkit.extract_url("https://example.com").await?;
//! # Ok(())
//! # }
//! ```
//!
//! ## Features
//!
//! - **HTML** (`html`, default): Convert HTML to markdown with configurable rules
//! - **DOCX** (`docx`): Convert Word documents
//! - **Spreadsheet** (`spreadsheet`): Convert XLSX/XLSM, XLS and ODS workbooks to tables
//! - **PDF** (`pdf`): Planned; currently returns [`Error::UnsupportedFormat`]
//! - **URL fetching** (`http_client`, default): Fetch and extract from URLs via reqwest
//!
//! Embedders that do their own fetching can drop reqwest entirely:
//! `markkit = { version = "0.1", default-features = false, features = ["docx", "spreadsheet"] }`.
pub use MarkkitBuilder;
pub use Error;
pub use ;
pub use ;
pub use Document;
pub use MarkdownRenderer;
/// Result type alias for markkit operations.
pub type Result<T> = Result;