1#[derive(Debug, Clone, PartialEq, Eq)]
3pub struct NodeAlert {
4 pub alert_type: AlertType,
6
7 pub title: Option<String>,
9
10 pub multiline: bool,
12
13 pub fence_length: usize,
15
16 pub fence_offset: usize,
18}
19
20#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
22pub enum AlertType {
23 #[default]
25 Note,
26
27 Tip,
29
30 Important,
32
33 Warning,
35
36 Caution,
38}
39
40impl AlertType {
41 pub(crate) fn default_title(&self) -> String {
43 match *self {
44 AlertType::Note => String::from("Note"),
45 AlertType::Tip => String::from("Tip"),
46 AlertType::Important => String::from("Important"),
47 AlertType::Warning => String::from("Warning"),
48 AlertType::Caution => String::from("Caution"),
49 }
50 }
51
52 pub(crate) fn css_class(&self) -> String {
54 match *self {
55 AlertType::Note => String::from("markdown-alert-note"),
56 AlertType::Tip => String::from("markdown-alert-tip"),
57 AlertType::Important => String::from("markdown-alert-important"),
58 AlertType::Warning => String::from("markdown-alert-warning"),
59 AlertType::Caution => String::from("markdown-alert-caution"),
60 }
61 }
62}