1#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
5pub enum HeadingStyle {
6 Underlined,
8 #[default]
10 Atx,
11 AtxClosed,
13}
14
15#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
17pub enum ListIndentType {
18 #[default]
19 Spaces,
20 Tabs,
21}
22
23#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
25pub enum WhitespaceMode {
26 #[default]
27 Normalized,
28 Strict,
29}
30
31#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
33pub enum NewlineStyle {
34 #[default]
36 Spaces,
37 Backslash,
39}
40
41#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
43pub enum CodeBlockStyle {
44 #[default]
46 Indented,
47 Backticks,
49 Tildes,
51}
52
53#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
55pub enum HighlightStyle {
56 #[default]
58 DoubleEqual,
59 Html,
61 Bold,
63 None,
65}
66
67#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
69pub enum PreprocessingPreset {
70 Minimal,
71 #[default]
72 Standard,
73 Aggressive,
74}
75
76#[derive(Debug, Clone)]
78pub struct ConversionOptions {
79 pub heading_style: HeadingStyle,
81
82 pub list_indent_type: ListIndentType,
84
85 pub list_indent_width: usize,
87
88 pub bullets: String,
90
91 pub strong_em_symbol: char,
93
94 pub escape_asterisks: bool,
96
97 pub escape_underscores: bool,
99
100 pub escape_misc: bool,
102
103 pub escape_ascii: bool,
105
106 pub code_language: String,
108
109 pub autolinks: bool,
111
112 pub default_title: bool,
114
115 pub br_in_tables: bool,
117
118 pub hocr_spatial_tables: bool,
120
121 pub highlight_style: HighlightStyle,
123
124 pub extract_metadata: bool,
126
127 pub whitespace_mode: WhitespaceMode,
129
130 pub strip_newlines: bool,
132
133 pub wrap: bool,
135
136 pub wrap_width: usize,
138
139 pub convert_as_inline: bool,
141
142 pub sub_symbol: String,
144
145 pub sup_symbol: String,
147
148 pub newline_style: NewlineStyle,
150
151 pub code_block_style: CodeBlockStyle,
153
154 pub keep_inline_images_in: Vec<String>,
156
157 pub preprocessing: PreprocessingOptions,
159
160 pub encoding: String,
162
163 pub debug: bool,
165
166 pub strip_tags: Vec<String>,
168
169 pub preserve_tags: Vec<String>,
172}
173
174impl Default for ConversionOptions {
175 fn default() -> Self {
176 Self {
177 heading_style: HeadingStyle::default(),
178 list_indent_type: ListIndentType::default(),
179 list_indent_width: 2,
180 bullets: "-".to_string(),
181 strong_em_symbol: '*',
182 escape_asterisks: false,
183 escape_underscores: false,
184 escape_misc: false,
185 escape_ascii: false,
186 code_language: String::new(),
187 autolinks: true,
188 default_title: false,
189 br_in_tables: false,
190 hocr_spatial_tables: true,
191 highlight_style: HighlightStyle::default(),
192 extract_metadata: true,
193 whitespace_mode: WhitespaceMode::default(),
194 strip_newlines: false,
195 wrap: false,
196 wrap_width: 80,
197 convert_as_inline: false,
198 sub_symbol: String::new(),
199 sup_symbol: String::new(),
200 newline_style: NewlineStyle::Spaces,
201 code_block_style: CodeBlockStyle::default(),
202 keep_inline_images_in: Vec::new(),
203 preprocessing: PreprocessingOptions::default(),
204 encoding: "utf-8".to_string(),
205 debug: false,
206 strip_tags: Vec::new(),
207 preserve_tags: Vec::new(),
208 }
209 }
210}
211
212#[derive(Debug, Clone)]
214pub struct PreprocessingOptions {
215 pub enabled: bool,
217
218 pub preset: PreprocessingPreset,
220
221 pub remove_navigation: bool,
223
224 pub remove_forms: bool,
226}
227
228impl Default for PreprocessingOptions {
229 fn default() -> Self {
230 Self {
231 enabled: true,
232 preset: PreprocessingPreset::default(),
233 remove_navigation: true,
234 remove_forms: true,
235 }
236 }
237}