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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
/// Markdown conversion functionality for Office documents and presentations.
///
/// This module provides high-performance conversion of Word documents and PowerPoint
/// presentations to Markdown format. It supports both legacy (OLE2) and modern (OOXML)
/// formats with a unified API.
///
/// # Features
///
/// - **Format-agnostic**: Works with both .doc/.docx and .ppt/.pptx files
/// - **Style preservation**: Converts bold, italic, and other text formatting
/// - **Table conversion**: Smart handling of tables (Markdown or HTML)
/// - **High performance**: Memory-efficient with minimal allocations
/// - **Configurable**: Extensive options for customizing output
///
/// # Quick Start
///
/// ```rust,no_run
/// use litchi::{Document, markdown::ToMarkdown};
///
/// # fn main() -> Result<(), litchi::Error> {
/// // Convert a document to markdown
/// let doc = Document::open("report.docx")?;
/// let markdown = doc.to_markdown()?;
/// println!("{}", markdown);
///
/// // Or with custom options
/// use litchi::markdown::MarkdownOptions;
/// let options = MarkdownOptions::new()
/// .with_styles(true)
/// .with_metadata(false)
/// .with_html_tables(false);
/// let markdown = doc.to_markdown_with_options(&options)?;
/// # Ok(())
/// # }
/// ```
///
/// # Architecture
///
/// The module is organized around:
/// - [`ToMarkdown`] trait: Core trait for types that can be converted to Markdown
/// - [`MarkdownOptions`]: Configuration for conversion behavior
/// - [`config`]: Configuration types and enums
/// - [`writer`]: Low-level writer for efficient output generation
/// - [`document`]: Document-specific implementations
/// - [`presentation`]: Presentation-specific implementations
///
/// # Performance Considerations
///
/// This implementation is designed for high performance:
/// - Uses borrowing instead of cloning where possible
/// - Reuses buffers in parsing loops
/// - Uses pre-allocated buffers with appropriate capacity
/// - No unsafe code
///
/// # Examples
///
/// ## Basic Document Conversion
///
/// ```rust,no_run
/// use litchi::{Document, markdown::ToMarkdown};
///
/// # fn main() -> Result<(), litchi::Error> {
/// let doc = Document::open("document.docx")?;
/// let markdown = doc.to_markdown()?;
/// println!("{}", markdown);
/// # Ok(())
/// # }
/// ```
///
/// ## With Custom Options
///
/// ```rust,no_run
/// use litchi::{Document, markdown::{ToMarkdown, MarkdownOptions, TableStyle}};
///
/// # fn main() -> Result<(), litchi::Error> {
/// let doc = Document::open("document.docx")?;
///
/// let options = MarkdownOptions::new()
/// .with_styles(true) // Include bold, italic, etc.
/// .with_metadata(true) // Include document metadata
/// .with_table_style(TableStyle::Markdown); // Use markdown tables
///
/// let markdown = doc.to_markdown_with_options(&options)?;
/// # Ok(())
/// # }
/// ```
///
/// ## Presentation Conversion
///
/// ```rust,no_run
/// use litchi::{Presentation, markdown::ToMarkdown};
///
/// # fn main() -> Result<(), litchi::Error> {
/// let pres = Presentation::open("slides.pptx")?;
/// let markdown = pres.to_markdown()?;
/// // Slides are separated by horizontal rules (---)
/// println!("{}", markdown);
/// # Ok(())
/// # }
/// ```
// Module declarations
// Re-export public API
pub use ;
pub use ToMarkdown;