markdown_ai_cite_remove/
config.rs

1/// Configuration options for citation removal
2#[derive(Debug, Clone)]
3pub struct RemoverConfig {
4    /// Remove inline citations like [1][2]
5    pub remove_inline_citations: bool,
6
7    /// Remove reference link lists at bottom
8    pub remove_reference_links: bool,
9
10    /// Remove reference section headers (## References)
11    pub remove_reference_headers: bool,
12
13    /// Remove full bibliographic entries
14    pub remove_reference_entries: bool,
15
16    /// Normalize whitespace after removal
17    pub normalize_whitespace: bool,
18
19    /// Remove blank lines left by removed sections
20    pub remove_blank_lines: bool,
21
22    /// Trim trailing whitespace from lines
23    pub trim_lines: bool,
24}
25
26impl Default for RemoverConfig {
27    fn default() -> Self {
28        Self {
29            remove_inline_citations: true,
30            remove_reference_links: true,
31            remove_reference_headers: true,
32            remove_reference_entries: true,
33            normalize_whitespace: true,
34            remove_blank_lines: true,
35            trim_lines: true,
36        }
37    }
38}
39
40impl RemoverConfig {
41    /// Create a new configuration with all features enabled
42    pub fn new() -> Self {
43        Self::default()
44    }
45
46    /// Create a configuration that only removes inline citations
47    pub fn inline_only() -> Self {
48        Self {
49            remove_inline_citations: true,
50            remove_reference_links: false,
51            remove_reference_headers: false,
52            remove_reference_entries: false,
53            normalize_whitespace: true,
54            remove_blank_lines: false,
55            trim_lines: true,
56        }
57    }
58
59    /// Create a configuration that only removes reference sections
60    pub fn references_only() -> Self {
61        Self {
62            remove_inline_citations: false,
63            remove_reference_links: true,
64            remove_reference_headers: true,
65            remove_reference_entries: true,
66            normalize_whitespace: true,
67            remove_blank_lines: true,
68            trim_lines: true,
69        }
70    }
71}
72
73/// Mode for handling different citation styles
74#[derive(Debug, Clone, Copy, PartialEq, Eq)]
75pub enum RemovalMode {
76    /// Remove all citation types
77    All,
78    /// Remove only inline citations, keep reference lists
79    InlineOnly,
80    /// Remove only reference lists, keep inline citations
81    ReferencesOnly,
82}