|
| 1 | +pub struct Options { |
| 2 | + /// Marker to use for bullets of items in unordered lists ('*', '+', or '-', default: '*'). |
| 3 | + pub bullet: char, |
| 4 | + // Marker to use in certain cases where the primary bullet doesn’t work |
| 5 | + // ('*', '+', or '-', default: '-' when bullet is '*', '*' otherwise). |
| 6 | + pub bullet_other: char, |
| 7 | + /// Marker to use for bullets of items in ordered lists ('.' or ')', default: '.'). |
| 8 | + pub bullet_ordered: char, |
| 9 | + /// Marker to use for emphasis ('*' or '_', default: '*'). |
| 10 | + pub emphasis: char, |
| 11 | + // Marker to use for fenced code ('`' or '~', default: '`'). |
| 12 | + pub fence: char, |
| 13 | + /// Whether to use fenced code always (bool, default: true). The default is to use fenced code |
| 14 | + /// if there is a language defined, if the code is empty, or if it starts or ends in blank lines. |
| 15 | + pub fences: bool, |
| 16 | + // How to indent the content of list items (default: 'IndentOptions::One'). |
| 17 | + pub list_item_indent: IndentOptions, |
| 18 | + /// Marker to use for titles ('"' or "'", default: '"'). |
| 19 | + pub quote: char, |
| 20 | + /// Marker to use for thematic breaks ('*', '-', or '_', default: '*'). |
| 21 | + pub rule: char, |
| 22 | + // Marker to use for strong ('*' or '_', default: '*'). |
| 23 | + pub strong: char, |
| 24 | + // Whether to increment the counter of ordered lists items (bool, default: true). |
| 25 | + pub increment_list_marker: bool, |
| 26 | + /// Whether to add the same number of number signs (#) at the end of an ATX heading as the |
| 27 | + /// opening sequence (bool, default: false). |
| 28 | + pub close_atx: bool, |
| 29 | + /// Whether to always use resource links (bool, default: false). The default is to use autolinks |
| 30 | + /// (<https://example.com>) when possible and resource links ([text](url)) otherwise. |
| 31 | + pub resource_link: bool, |
| 32 | + /// Whether to add spaces between markers in thematic breaks (bool, default: false). |
| 33 | + pub rule_spaces: bool, |
| 34 | + /// Whether to use setext headings when possible (bool, default: false). The default is to always |
| 35 | + /// use ATX headings (# heading) instead of setext headings (heading\n=======). Setext headings |
| 36 | + /// cannot be used for empty headings or headings with a rank of three or more. |
| 37 | + pub setext: bool, |
| 38 | + /// Whether to join definitions without a blank line (bool, default: false). |
| 39 | + pub tight_definitions: bool, |
| 40 | + // Number of markers to use for thematic breaks (u32, default: 3, min: 3). |
| 41 | + pub rule_repetition: u32, |
| 42 | +} |
| 43 | + |
| 44 | +#[derive(Copy, Clone)] |
| 45 | +pub enum IndentOptions { |
| 46 | + // Depends on the item and its parent list uses 'One' if the item and list are tight and 'Tab' |
| 47 | + // otherwise. |
| 48 | + Mixed, |
| 49 | + // The size of the bullet plus one space. |
| 50 | + One, |
| 51 | + /// Tab stop. |
| 52 | + Tab, |
| 53 | +} |
| 54 | + |
| 55 | +impl Default for Options { |
| 56 | + fn default() -> Self { |
| 57 | + Self { |
| 58 | + bullet: '*', |
| 59 | + bullet_other: '-', |
| 60 | + bullet_ordered: '.', |
| 61 | + emphasis: '*', |
| 62 | + fence: '`', |
| 63 | + fences: true, |
| 64 | + increment_list_marker: true, |
| 65 | + rule_repetition: 3, |
| 66 | + list_item_indent: IndentOptions::One, |
| 67 | + quote: '"', |
| 68 | + rule: '*', |
| 69 | + strong: '*', |
| 70 | + close_atx: false, |
| 71 | + rule_spaces: false, |
| 72 | + resource_link: false, |
| 73 | + setext: false, |
| 74 | + tight_definitions: false, |
| 75 | + } |
| 76 | + } |
| 77 | +} |
0 commit comments