pubmed_formatter/pmc/markdown/
config.rs

1/// Metadata-related configuration options
2#[derive(Debug, Clone)]
3pub struct MetadataOptions {
4    /// Include metadata section at the top
5    pub include_metadata: bool,
6    /// Use YAML frontmatter for metadata instead of bold markdown format
7    pub use_yaml_frontmatter: bool,
8    /// Include author ORCID links
9    pub include_orcid_links: bool,
10    /// Include DOI and PMID links
11    pub include_identifier_links: bool,
12}
13
14impl Default for MetadataOptions {
15    fn default() -> Self {
16        Self {
17            include_metadata: true,
18            use_yaml_frontmatter: false,
19            include_orcid_links: true,
20            include_identifier_links: true,
21        }
22    }
23}
24
25/// Figure and table display options
26#[derive(Debug, Clone)]
27pub struct FigureOptions {
28    /// Include figure and table captions
29    pub include_figure_captions: bool,
30    /// Include local figure file paths in markdown images
31    pub include_local_figures: bool,
32}
33
34impl Default for FigureOptions {
35    fn default() -> Self {
36        Self {
37            include_figure_captions: true,
38            include_local_figures: false,
39        }
40    }
41}
42
43/// Configuration options for Markdown conversion
44#[derive(Debug, Clone)]
45pub struct MarkdownConfig {
46    /// Metadata display options
47    pub metadata: MetadataOptions,
48    /// Figure and table display options
49    pub figures: FigureOptions,
50    /// Include table of contents
51    pub include_toc: bool,
52    /// Heading style preference
53    pub heading_style: HeadingStyle,
54    /// Reference formatting style
55    pub reference_style: ReferenceStyle,
56    /// Maximum heading level (1-6)
57    pub max_heading_level: u8,
58}
59
60/// Heading style options
61#[derive(Debug, Clone, PartialEq)]
62pub enum HeadingStyle {
63    /// ATX style headers (# ## ###)
64    ATX,
65    /// Setext style headers (underlined)
66    Setext,
67}
68
69/// Reference formatting style
70#[derive(Debug, Clone, PartialEq)]
71pub enum ReferenceStyle {
72    /// Numbered references \[1\], \[2\], etc.
73    Numbered,
74    /// Author-year style (Smith, 2023)
75    AuthorYear,
76    /// Full citation format
77    FullCitation,
78}
79
80impl Default for MarkdownConfig {
81    fn default() -> Self {
82        Self {
83            metadata: MetadataOptions::default(),
84            figures: FigureOptions::default(),
85            include_toc: false,
86            heading_style: HeadingStyle::ATX,
87            reference_style: ReferenceStyle::Numbered,
88            max_heading_level: 6,
89        }
90    }
91}