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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
use blaeck::prelude::*;
pub fn build_ui() -> Element {
Element::node::<Box>(
BoxProps {
flex_direction: FlexDirection::Column,
padding: 1.0,
border_style: BorderStyle::Round,
..Default::default()
},
vec![
// Title
Element::node::<Text>(
TextProps {
content: "Markdown Component".into(),
bold: true,
color: Some(Color::Cyan),
..Default::default()
},
vec![],
),
Element::text(""),
// Headers
Element::node::<Text>(
TextProps {
content: "Headers:".into(),
dim: true,
..Default::default()
},
vec![],
),
Element::node::<Markdown>(
MarkdownProps::new("# Heading 1\n## Heading 2\n### Heading 3"),
vec![],
),
Element::text(""),
// Inline formatting
Element::node::<Text>(
TextProps {
content: "Inline formatting:".into(),
dim: true,
..Default::default()
},
vec![],
),
Element::node::<Markdown>(
MarkdownProps::new("This has **bold**, *italic*, and ~~strikethrough~~ text."),
vec![],
),
Element::text(""),
// Code
Element::node::<Text>(
TextProps {
content: "Code spans:".into(),
dim: true,
..Default::default()
},
vec![],
),
Element::node::<Markdown>(
MarkdownProps::new("Use `println!` or `eprintln!` for output."),
vec![],
),
Element::text(""),
// Code blocks
Element::node::<Text>(
TextProps {
content: "Code blocks:".into(),
dim: true,
..Default::default()
},
vec![],
),
Element::node::<Markdown>(
MarkdownProps::new("```rust\nfn main() {\n println!(\"Hello!\");\n}\n```"),
vec![],
),
Element::text(""),
// Lists
Element::node::<Text>(
TextProps {
content: "Bulleted list:".into(),
dim: true,
..Default::default()
},
vec![],
),
Element::node::<Markdown>(
MarkdownProps::new("- First item\n- Second item\n- Third item"),
vec![],
),
Element::text(""),
Element::node::<Text>(
TextProps {
content: "Numbered list:".into(),
dim: true,
..Default::default()
},
vec![],
),
Element::node::<Markdown>(
MarkdownProps::new("1. Step one\n2. Step two\n3. Step three"),
vec![],
),
Element::text(""),
// Blockquote
Element::node::<Text>(
TextProps {
content: "Blockquote:".into(),
dim: true,
..Default::default()
},
vec![],
),
Element::node::<Markdown>(
MarkdownProps::new("> This is a blockquote.\n> It can span multiple lines."),
vec![],
),
Element::text(""),
// Links
Element::node::<Text>(
TextProps {
content: "Links (OSC 8 hyperlinks in supported terminals):".into(),
dim: true,
..Default::default()
},
vec![],
),
Element::node::<Markdown>(
MarkdownProps::new("Check out [Rust](https://www.rust-lang.org) and [Anthropic](https://www.anthropic.com)!"),
vec![],
),
Element::text(""),
// Horizontal rule
Element::node::<Text>(
TextProps {
content: "Horizontal rule:".into(),
dim: true,
..Default::default()
},
vec![],
),
Element::node::<Markdown>(
MarkdownProps::new("Above the line\n\n---\n\nBelow the line"),
vec![],
),
Element::text(""),
// Custom colors
Element::node::<Divider>(
DividerProps::new()
.width(50)
.line_style(DividerStyle::Dashed)
.color(Color::DarkGray),
vec![],
),
Element::node::<Text>(
TextProps {
content: "Custom colors (green headers, magenta code):".into(),
dim: true,
..Default::default()
},
vec![],
),
Element::node::<Markdown>(
MarkdownProps::new("# Custom Header\n\nWith `custom` code styling.")
.header_color(Color::Green)
.code_color(Color::Magenta),
vec![],
),
Element::text(""),
// Combined example
Element::node::<Text>(
TextProps {
content: "Combined example:".into(),
dim: true,
..Default::default()
},
vec![],
),
Element::node::<Markdown>(
MarkdownProps::new(r#"## Getting Started
1. Install the **dependencies**
2. Run `cargo build`
3. Check the *documentation*
> Remember: Code quality matters!
---
Happy coding!"#),
vec![],
),
],
)
}