1use serde::Serialize;
2
3#[derive(Serialize, Clone)]
4#[serde(tag = "type")]
5pub enum Block {
6 ElmListItem(ElmListItem),
7 ElmBulletedList(ElmBulletedList),
8 ElmNumberedList(ElmNumberedList),
9 ElmBookmark(ElmBookmark),
10 ElmCodeBlock(ElmCodeBlock),
11 ElmDivider(ElmDivider),
12 ElmCallout(ElmCallout),
13 ElmColumnList(ElmColumnList),
14 ElmColumn(ElmColumn),
15 ElmFile(ElmFile),
16 ElmHeading1(ElmHeading1),
17 ElmHeading2(ElmHeading2),
18 ElmHeading3(ElmHeading3),
19 ElmImage(ElmImage),
20 ElmKatex(ElmKatex),
21 ElmParagraph(ElmParagraph),
22 ElmBlockQuote(ElmBlockQuote),
23 ElmCheckbox(ElmCheckbox),
24 ElmToggle(ElmToggle),
25 ElmTable(ElmTable),
26 ElmTableHeader(ElmTableHeader),
27 ElmTableBody(ElmTableBody),
28 ElmTableRow(ElmTableRow),
29 ElmTableCell(ElmTableCell),
30 ElmInlineText(ElmInlineText),
31 ElmInlineIcon(ElmInlineIcon),
32}
33
34#[derive(Serialize, Clone)]
36pub struct ElmListItem {
37 pub id: String,
38 pub children: Vec<Block>,
39}
40
41#[derive(Serialize, Clone)]
42pub struct ElmBulletedList {
43 pub id: String,
44 pub children: Vec<Block>,
45}
46
47#[derive(Serialize, Clone)]
48pub struct ElmNumberedList {
49 pub id: String,
50 pub children: Vec<Block>,
51}
52
53#[derive(Serialize, Clone)]
55pub struct ElmBookmark {
56 pub id: String,
57 pub props: ElmBookmarkProps,
58}
59
60#[derive(Serialize, Clone, Default)]
61pub struct ElmBookmarkProps {
62 pub title: Option<String>,
63 pub description: Option<String>,
64 pub image: Option<String>,
65 pub url: String,
66 pub margin: String,
67}
68
69#[derive(Serialize, Clone)]
71pub struct ElmCodeBlock {
72 pub id: String,
73 pub props: ElmCodeBlockProps,
74}
75
76#[derive(Serialize, Clone)]
77pub struct ElmCodeBlockProps {
78 pub code: String,
79 pub language: String,
80 pub caption: String,
81 pub margin: String,
82}
83
84#[derive(Serialize, Clone)]
86pub struct ElmDivider {
87 pub id: String,
88 pub props: ElmDividerProps,
89}
90
91#[derive(Serialize, Clone)]
92pub struct ElmDividerProps {
93 pub margin: String,
94}
95
96#[derive(Serialize, Clone)]
98pub struct ElmCallout {
99 pub id: String,
100 pub props: ElmCalloutProps,
101 pub children: Vec<Block>,
102}
103
104#[derive(Serialize, Clone)]
105pub struct ElmCalloutProps {
106 pub r#type: String,
107}
108
109#[derive(Serialize, Clone)]
111pub struct ElmColumnList {
112 pub id: String,
113 pub children: Vec<Block>,
114}
115
116#[derive(Serialize, Clone)]
118pub struct ElmColumn {
119 pub id: String,
120 pub children: Vec<Block>,
121}
122
123#[derive(Serialize, Clone)]
125pub struct ElmKatex {
126 pub id: String,
127 pub props: ElmKatexProps,
128}
129
130#[derive(Serialize, Clone)]
131pub struct ElmKatexProps {
132 pub expression: String,
133 pub block: bool,
134}
135
136#[derive(Serialize, Clone)]
138pub struct ElmFile {
139 pub id: String,
140 pub props: ElmFileProps,
141}
142
143#[derive(Serialize, Clone)]
144pub struct ElmFileProps {
145 #[serde(skip_serializing_if = "Option::is_none")]
146 pub name: Option<String>,
147 pub src: String,
148 pub margin: String,
149}
150
151#[derive(Serialize, Clone)]
153pub struct ElmHeading1 {
154 pub id: String,
155 pub props: ElmHeadingProps,
156}
157
158#[derive(Serialize, Clone)]
159pub struct ElmHeading2 {
160 pub id: String,
161 pub props: ElmHeadingProps,
162}
163
164#[derive(Serialize, Clone)]
165pub struct ElmHeading3 {
166 pub id: String,
167 pub props: ElmHeadingProps,
168}
169
170#[derive(Serialize, Clone)]
171pub struct ElmHeadingProps {
172 pub text: String,
173}
174
175#[derive(Serialize, Clone)]
177pub struct ElmImage {
178 pub id: String,
179 pub props: ElmImageProps,
180}
181
182#[derive(Serialize, Clone)]
183pub struct ElmImageProps {
184 pub src: String,
185
186 #[serde(skip_serializing_if = "Option::is_none")]
187 pub alt: Option<String>,
188
189 #[serde(rename = "enableModal")]
190 pub enable_modal: bool,
191
192 pub margin: String,
193}
194
195#[derive(Serialize, Clone)]
197pub struct ElmParagraph {
198 pub id: String,
199 pub children: Vec<Block>,
200}
201
202#[derive(Serialize, Clone)]
204pub struct ElmBlockQuote {
205 pub id: String,
206 pub children: Vec<Block>,
207}
208
209#[derive(Serialize, Clone)]
211pub struct ElmCheckbox {
212 pub id: String,
213 pub props: ElmCheckboxProps,
214}
215
216#[derive(Serialize, Clone)]
217pub struct ElmCheckboxProps {
218 pub label: String,
219}
220
221#[derive(Serialize, Clone)]
223pub struct ElmToggle {
224 pub id: String,
225 pub props: ElmToggleProps,
226 pub children: Vec<Block>,
227}
228
229#[derive(Serialize, Clone)]
230pub struct ElmToggleProps {
231 pub summary: String,
232 pub margin: String,
233}
234
235#[derive(Serialize, Clone)]
237pub struct ElmTable {
238 pub children: Vec<Block>,
239}
240
241#[derive(Serialize, Clone)]
242pub struct ElmTableHeader {
243 pub children: Vec<Block>,
244}
245
246#[derive(Serialize, Clone)]
247pub struct ElmTableBody {
248 pub children: Vec<Block>,
249}
250
251#[derive(Serialize, Clone)]
252pub struct ElmTableRow {
253 pub children: Vec<Block>,
254}
255
256#[derive(Serialize, Clone)]
257pub struct ElmTableCell {
258 pub props: ElmTableCellProps,
259}
260
261#[derive(Serialize, Clone)]
262pub struct ElmTableCellProps {
263 pub text: String,
264 #[serde(rename = "hasHeader")]
265 pub has_header: bool,
266}
267
268#[derive(Serialize, Clone)]
270pub struct ElmInlineText {
271 pub props: ElmInlineTextProps,
272}
273
274#[derive(Serialize, Clone)]
275pub struct ElmInlineTextProps {
276 pub text: String,
277
278 #[serde(skip_serializing_if = "std::ops::Not::not")]
279 pub bold: bool,
280
281 #[serde(skip_serializing_if = "std::ops::Not::not")]
282 pub italic: bool,
283
284 #[serde(skip_serializing_if = "std::ops::Not::not")]
285 pub underline: bool,
286
287 #[serde(skip_serializing_if = "std::ops::Not::not")]
288 pub strikethrough: bool,
289
290 #[serde(skip_serializing_if = "std::ops::Not::not")]
291 pub code: bool,
292
293 #[serde(skip_serializing_if = "Option::is_none")]
294 pub color: Option<String>,
295}
296
297#[derive(Serialize, Clone)]
299pub struct ElmInlineIcon {
300 pub id: String,
301 pub props: ElmInlineIconProps,
302}
303
304#[derive(Serialize, Clone)]
305pub struct ElmInlineIconProps {
306 pub src: String,
307 pub alt: String,
308}