1#[derive(Debug, Clone, PartialEq)]
5pub enum DocNode {
6 Document(Document),
7 Heading(Heading),
8 Paragraph(Paragraph),
9 List(List),
10 ListItem(ListItem),
11 Definition(Definition),
12 Verbatim(Verbatim),
13 Annotation(Annotation),
14 Inline(InlineContent),
15 Table(Table),
16 Image(Image),
17 Video(Video),
18 Audio(Audio),
19}
20
21#[derive(Debug, Clone, PartialEq)]
23pub struct Document {
24 pub children: Vec<DocNode>,
25}
26
27#[derive(Debug, Clone, PartialEq)]
29pub struct Heading {
30 pub level: usize,
31 pub content: Vec<InlineContent>,
32 pub children: Vec<DocNode>,
33}
34
35#[derive(Debug, Clone, PartialEq)]
37pub struct Paragraph {
38 pub content: Vec<InlineContent>,
39}
40
41#[derive(Debug, Clone, PartialEq)]
43pub struct List {
44 pub items: Vec<ListItem>,
45 pub ordered: bool,
46}
47
48#[derive(Debug, Clone, PartialEq)]
50pub struct ListItem {
51 pub content: Vec<InlineContent>,
52 pub children: Vec<DocNode>,
53}
54
55#[derive(Debug, Clone, PartialEq)]
57pub struct Definition {
58 pub term: Vec<InlineContent>,
59 pub description: Vec<DocNode>,
60}
61
62#[derive(Debug, Clone, PartialEq)]
64pub struct Verbatim {
65 pub language: Option<String>,
66 pub content: String,
67}
68
69#[derive(Debug, Clone, PartialEq)]
71pub struct Annotation {
72 pub label: String,
73 pub parameters: Vec<(String, String)>,
74 pub content: Vec<DocNode>,
75}
76
77#[derive(Debug, Clone, PartialEq)]
79pub struct Table {
80 pub rows: Vec<TableRow>,
81 pub header: Vec<TableRow>,
82 pub caption: Option<Vec<InlineContent>>,
83}
84
85#[derive(Debug, Clone, PartialEq)]
87pub struct TableRow {
88 pub cells: Vec<TableCell>,
89}
90
91#[derive(Debug, Clone, PartialEq)]
93pub struct TableCell {
94 pub content: Vec<DocNode>,
95 pub header: bool,
96 pub align: TableCellAlignment,
97}
98
99#[derive(Debug, Clone, Copy, PartialEq)]
101pub enum TableCellAlignment {
102 Left,
103 Center,
104 Right,
105 None,
106}
107
108#[derive(Debug, Clone, PartialEq)]
110pub enum InlineContent {
111 Text(String),
112 Bold(Vec<InlineContent>),
113 Italic(Vec<InlineContent>),
114 Code(String),
115 Math(String),
116 Reference(String),
117 Marker(String),
118 Image(Image),
119}
120
121#[derive(Debug, Clone, PartialEq)]
123pub struct Image {
124 pub src: String,
125 pub alt: String,
126 pub title: Option<String>,
127}
128
129#[derive(Debug, Clone, PartialEq)]
131pub struct Video {
132 pub src: String,
133 pub title: Option<String>,
134 pub poster: Option<String>,
135}
136
137#[derive(Debug, Clone, PartialEq)]
139pub struct Audio {
140 pub src: String,
141 pub title: Option<String>,
142}