1#[derive(Debug, Clone, Copy, PartialEq, Eq)]
5pub enum HeadingStyle {
6 Underlined,
8 Atx,
10 AtxClosed,
12}
13
14impl Default for HeadingStyle {
15 fn default() -> Self {
16 Self::Atx
17 }
18}
19
20#[derive(Debug, Clone, Copy, PartialEq, Eq)]
22pub enum ListIndentType {
23 Spaces,
24 Tabs,
25}
26
27impl Default for ListIndentType {
28 fn default() -> Self {
29 Self::Spaces
30 }
31}
32
33#[derive(Debug, Clone, Copy, PartialEq, Eq)]
35pub enum WhitespaceMode {
36 Normalized,
37 Strict,
38}
39
40impl Default for WhitespaceMode {
41 fn default() -> Self {
42 Self::Normalized
43 }
44}
45
46#[derive(Debug, Clone, Copy, PartialEq, Eq)]
48pub enum NewlineStyle {
49 Spaces,
51 Backslash,
53}
54
55impl Default for NewlineStyle {
56 fn default() -> Self {
57 Self::Spaces
58 }
59}
60
61#[derive(Debug, Clone, Copy, PartialEq, Eq)]
63pub enum CodeBlockStyle {
64 Indented,
66 Backticks,
68 Tildes,
70}
71
72impl Default for CodeBlockStyle {
73 fn default() -> Self {
74 Self::Indented
75 }
76}
77
78#[derive(Debug, Clone, Copy, PartialEq, Eq)]
80pub enum HighlightStyle {
81 DoubleEqual,
83 Html,
85 Bold,
87 None,
89}
90
91impl Default for HighlightStyle {
92 fn default() -> Self {
93 Self::DoubleEqual
94 }
95}
96
97#[derive(Debug, Clone, Copy, PartialEq, Eq)]
99pub enum PreprocessingPreset {
100 Minimal,
101 Standard,
102 Aggressive,
103}
104
105impl Default for PreprocessingPreset {
106 fn default() -> Self {
107 Self::Standard
108 }
109}
110
111#[derive(Debug, Clone)]
113pub struct ConversionOptions {
114 pub heading_style: HeadingStyle,
116
117 pub list_indent_type: ListIndentType,
119
120 pub list_indent_width: usize,
122
123 pub bullets: String,
125
126 pub strong_em_symbol: char,
128
129 pub escape_asterisks: bool,
131
132 pub escape_underscores: bool,
134
135 pub escape_misc: bool,
137
138 pub escape_ascii: bool,
140
141 pub code_language: String,
143
144 pub autolinks: bool,
146
147 pub default_title: bool,
149
150 pub br_in_tables: bool,
152
153 pub hocr_spatial_tables: bool,
155
156 pub highlight_style: HighlightStyle,
158
159 pub extract_metadata: bool,
161
162 pub whitespace_mode: WhitespaceMode,
164
165 pub strip_newlines: bool,
167
168 pub wrap: bool,
170
171 pub wrap_width: usize,
173
174 pub convert_as_inline: bool,
176
177 pub sub_symbol: String,
179
180 pub sup_symbol: String,
182
183 pub newline_style: NewlineStyle,
185
186 pub code_block_style: CodeBlockStyle,
188
189 pub keep_inline_images_in: Vec<String>,
191
192 pub preprocessing: PreprocessingOptions,
194
195 pub encoding: String,
197
198 pub debug: bool,
200
201 pub strip_tags: Vec<String>,
203}
204
205impl Default for ConversionOptions {
206 fn default() -> Self {
207 Self {
208 heading_style: HeadingStyle::default(),
209 list_indent_type: ListIndentType::default(),
210 list_indent_width: 2,
211 bullets: "-".to_string(),
212 strong_em_symbol: '*',
213 escape_asterisks: false,
214 escape_underscores: false,
215 escape_misc: false,
216 escape_ascii: false,
217 code_language: String::new(),
218 autolinks: true,
219 default_title: false,
220 br_in_tables: false,
221 hocr_spatial_tables: true,
222 highlight_style: HighlightStyle::default(),
223 extract_metadata: true,
224 whitespace_mode: WhitespaceMode::default(),
225 strip_newlines: false,
226 wrap: false,
227 wrap_width: 80,
228 convert_as_inline: false,
229 sub_symbol: String::new(),
230 sup_symbol: String::new(),
231 newline_style: NewlineStyle::Spaces,
232 code_block_style: CodeBlockStyle::default(),
233 keep_inline_images_in: Vec::new(),
234 preprocessing: PreprocessingOptions::default(),
235 encoding: "utf-8".to_string(),
236 debug: false,
237 strip_tags: Vec::new(),
238 }
239 }
240}
241
242#[derive(Debug, Clone)]
244pub struct PreprocessingOptions {
245 pub enabled: bool,
247
248 pub preset: PreprocessingPreset,
250
251 pub remove_navigation: bool,
253
254 pub remove_forms: bool,
256}
257
258impl Default for PreprocessingOptions {
259 fn default() -> Self {
260 Self {
261 enabled: false,
262 preset: PreprocessingPreset::default(),
263 remove_navigation: true,
264 remove_forms: true,
265 }
266 }
267}