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 ElmBlockImage(ElmBlockImage),
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 ElmInlineLink(ElmInlineLink),
32 ElmInlineIcon(ElmInlineIcon),
33}
34
35#[derive(Serialize, Clone)]
37pub struct ElmListItem {
38 pub id: String,
39
40 #[serde(skip_serializing_if = "Vec::is_empty")]
41 pub children: Vec<Block>,
42}
43
44#[derive(Serialize, Clone)]
45pub struct ElmBulletedList {
46 pub id: String,
47
48 #[serde(skip_serializing_if = "Vec::is_empty")]
49 pub children: Vec<Block>,
50}
51
52#[derive(Serialize, Clone)]
53pub struct ElmNumberedList {
54 pub id: String,
55
56 #[serde(skip_serializing_if = "Vec::is_empty")]
57 pub children: Vec<Block>,
58}
59
60#[derive(Serialize, Clone)]
62pub struct ElmBookmark {
63 pub id: String,
64 pub props: ElmBookmarkProps,
65}
66
67#[derive(Serialize, Clone, Default)]
68pub struct ElmBookmarkProps {
69 pub title: Option<String>,
70 pub description: Option<String>,
71 pub image: Option<String>,
72 pub url: String,
73 pub margin: String,
74}
75
76#[derive(Serialize, Clone)]
78pub struct ElmCodeBlock {
79 pub id: String,
80 pub props: ElmCodeBlockProps,
81}
82
83#[derive(Serialize, Clone)]
84pub struct ElmCodeBlockProps {
85 pub code: String,
86 pub language: String,
87 pub caption: String,
88 pub margin: String,
89}
90
91#[derive(Serialize, Clone)]
93pub struct ElmDivider {
94 pub id: String,
95 pub props: ElmDividerProps,
96}
97
98#[derive(Serialize, Clone)]
99pub struct ElmDividerProps {
100 pub margin: String,
101}
102
103#[derive(Serialize, Clone)]
105pub struct ElmCallout {
106 pub id: String,
107 pub props: ElmCalloutProps,
108
109 #[serde(skip_serializing_if = "Vec::is_empty")]
110 pub children: Vec<Block>,
111}
112
113#[derive(Serialize, Clone)]
114pub struct ElmCalloutProps {
115 pub r#type: String,
116}
117
118#[derive(Serialize, Clone)]
120pub struct ElmColumnList {
121 pub id: String,
122
123 #[serde(skip_serializing_if = "Vec::is_empty")]
124 pub children: Vec<Block>,
125}
126
127#[derive(Serialize, Clone)]
129pub struct ElmColumn {
130 pub id: String,
131
132 #[serde(skip_serializing_if = "Vec::is_empty")]
133 pub children: Vec<Block>,
134}
135
136#[derive(Serialize, Clone)]
138pub struct ElmKatex {
139 pub props: ElmKatexProps,
140}
141
142#[derive(Serialize, Clone)]
143pub struct ElmKatexProps {
144 pub expression: String,
145 pub block: bool,
146}
147
148#[derive(Serialize, Clone)]
150pub struct ElmFile {
151 pub id: String,
152 pub props: ElmFileProps,
153}
154
155#[derive(Serialize, Clone)]
156pub struct ElmFileProps {
157 #[serde(skip_serializing_if = "Option::is_none")]
158 pub name: Option<String>,
159 pub src: String,
160 pub margin: String,
161}
162
163#[derive(Serialize, Clone)]
165pub struct ElmHeading1 {
166 pub id: String,
167 pub props: ElmHeadingProps,
168}
169
170#[derive(Serialize, Clone)]
171pub struct ElmHeading2 {
172 pub id: String,
173 pub props: ElmHeadingProps,
174}
175
176#[derive(Serialize, Clone)]
177pub struct ElmHeading3 {
178 pub id: String,
179 pub props: ElmHeadingProps,
180}
181
182#[derive(Serialize, Clone)]
183pub struct ElmHeadingProps {
184 pub text: String,
185}
186
187#[derive(Serialize, Clone)]
189pub struct ElmBlockImage {
190 pub id: String,
191 pub props: ElmBlockImageProps,
192}
193
194#[derive(Serialize, Clone)]
195pub struct ElmBlockImageProps {
196 pub src: String,
197
198 #[serde(skip_serializing_if = "Option::is_none")]
199 pub alt: Option<String>,
200
201 #[serde(rename = "enableModal")]
202 pub enable_modal: bool,
203}
204
205#[derive(Serialize, Clone)]
207pub struct ElmParagraph {
208 pub id: String,
209
210 #[serde(skip_serializing_if = "Vec::is_empty")]
211 pub children: Vec<Block>,
212}
213
214#[derive(Serialize, Clone)]
216pub struct ElmBlockQuote {
217 pub id: String,
218
219 #[serde(skip_serializing_if = "Vec::is_empty")]
220 pub children: Vec<Block>,
221}
222
223#[derive(Serialize, Clone)]
225pub struct ElmCheckbox {
226 pub id: String,
227 pub props: ElmCheckboxProps,
228}
229
230#[derive(Serialize, Clone)]
231pub struct ElmCheckboxProps {
232 pub label: String,
233}
234
235#[derive(Serialize, Clone)]
237pub struct ElmToggle {
238 pub id: String,
239 pub props: ElmToggleProps,
240
241 #[serde(skip_serializing_if = "Vec::is_empty")]
242 pub children: Vec<Block>,
243}
244
245#[derive(Serialize, Clone)]
246pub struct ElmToggleProps {
247 pub summary: String,
248 pub margin: String,
249}
250
251#[derive(Serialize, Clone)]
253pub struct ElmTable {
254 #[serde(skip_serializing_if = "Vec::is_empty")]
255 pub children: Vec<Block>,
256}
257
258#[derive(Serialize, Clone)]
259pub struct ElmTableHeader {
260 #[serde(skip_serializing_if = "Vec::is_empty")]
261 pub children: Vec<Block>,
262}
263
264#[derive(Serialize, Clone)]
265pub struct ElmTableBody {
266 #[serde(skip_serializing_if = "Vec::is_empty")]
267 pub children: Vec<Block>,
268}
269
270#[derive(Serialize, Clone)]
271pub struct ElmTableRow {
272 #[serde(skip_serializing_if = "Vec::is_empty")]
273 pub children: Vec<Block>,
274}
275
276#[derive(Serialize, Clone)]
277pub struct ElmTableCell {
278 pub props: ElmTableCellProps,
279}
280
281#[derive(Serialize, Clone)]
282pub struct ElmTableCellProps {
283 pub text: String,
284 #[serde(rename = "hasHeader")]
285 pub has_header: bool,
286}
287
288#[derive(Serialize, Clone)]
290pub struct ElmInlineText {
291 pub props: ElmInlineTextProps,
292}
293
294#[derive(Serialize, Clone)]
295pub struct ElmInlineTextProps {
296 pub text: String,
297
298 #[serde(skip_serializing_if = "std::ops::Not::not")]
299 pub bold: bool,
300
301 #[serde(skip_serializing_if = "std::ops::Not::not")]
302 pub italic: bool,
303
304 #[serde(skip_serializing_if = "std::ops::Not::not")]
305 pub underline: bool,
306
307 #[serde(skip_serializing_if = "std::ops::Not::not")]
308 pub strikethrough: bool,
309
310 #[serde(skip_serializing_if = "std::ops::Not::not")]
311 pub code: bool,
312
313 #[serde(skip_serializing_if = "Option::is_none")]
314 pub color: Option<String>,
315}
316
317#[derive(Serialize, Clone)]
319pub struct ElmInlineLink {
320 pub props: ElmInlineLinkProps,
321}
322
323#[derive(Serialize, Clone)]
324pub struct ElmInlineLinkProps {
325 pub text: String,
326 pub href: String,
327
328 #[serde(skip_serializing_if = "Option::is_none")]
329 pub favicon: Option<String>,
330}
331
332#[derive(Serialize, Clone)]
334pub struct ElmInlineIcon {
335 pub id: String,
336 pub props: ElmInlineIconProps,
337}
338
339#[derive(Serialize, Clone)]
340pub struct ElmInlineIconProps {
341 pub src: String,
342 pub alt: String,
343}