1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
//! Markdown theme configuration struct.
//!
//! The [`MarkdownTheme`] struct defines the color scheme for different markdown
//! elements, supporting both light and dark mode variants through [`ColorMapping`].
use crateColorMapping;
use Deserialize;
/// Markdown theme configuration.
///
/// This struct holds color mappings for various markdown elements. Each field
/// is optional, allowing themes to only override specific elements while
/// inheriting defaults for others.
///
/// # Fields
///
/// * `name` - Optional theme name for identification
/// * `markdown_text` - Color for regular text
/// * `markdown_heading` - Color for headings (h1-h6)
/// * `markdown_code` - Color for inline code and code blocks
/// * `markdown_block_quote` - Color for block quotes
/// * `markdown_emph` - Color for emphasized (italic) text
/// * `markdown_strong` - Color for strong (bold) text
/// * `markdown_link` - Color for links
/// * `markdown_hr` - Color for horizontal rules
/// * `markdown_table` - Color for tables
///
/// # Example
///
/// ```rust,ignore
/// use ratatui_toolkit::markdown_widget::extensions::theme::{MarkdownTheme, load_theme_from_json};
///
/// let json = r#"{
/// "name": "my-theme",
/// "markdown_heading": { "dark": "blue", "light": "oceanBlue" }
/// }"#;
///
/// let theme = load_theme_from_json(json).unwrap();
/// assert_eq!(theme.name, Some("my-theme".to_string()));
/// ```