1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 | import { Parent as UnistParent, Literal as UnistLiteral, Node } from 'unist';
|
11 |
|
12 | export type AlignType = 'left' | 'right' | 'center' | null;
|
13 |
|
14 | export type ReferenceType = 'shortcut' | 'collapsed' | 'full';
|
15 |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 |
|
28 |
|
29 |
|
30 |
|
31 | export interface BlockContentMap {
|
32 | paragraph: Paragraph;
|
33 | heading: Heading;
|
34 | thematicBreak: ThematicBreak;
|
35 | blockquote: Blockquote;
|
36 | list: List;
|
37 | table: Table;
|
38 | html: HTML;
|
39 | code: Code;
|
40 | }
|
41 |
|
42 |
|
43 |
|
44 |
|
45 |
|
46 |
|
47 |
|
48 |
|
49 |
|
50 |
|
51 |
|
52 |
|
53 |
|
54 |
|
55 | export interface FrontmatterContentMap {
|
56 | yaml: YAML;
|
57 | }
|
58 |
|
59 |
|
60 |
|
61 |
|
62 |
|
63 |
|
64 |
|
65 |
|
66 |
|
67 |
|
68 |
|
69 |
|
70 |
|
71 | export interface DefinitionContentMap {
|
72 | definition: Definition;
|
73 | footnoteDefinition: FootnoteDefinition;
|
74 | }
|
75 |
|
76 |
|
77 |
|
78 |
|
79 |
|
80 |
|
81 |
|
82 |
|
83 |
|
84 |
|
85 |
|
86 |
|
87 |
|
88 |
|
89 | export interface StaticPhrasingContentMap {
|
90 | text: Text;
|
91 | emphasis: Emphasis;
|
92 | strong: Strong;
|
93 | delete: Delete;
|
94 | html: HTML;
|
95 | inlineCode: InlineCode;
|
96 | break: Break;
|
97 | image: Image;
|
98 | imageReference: ImageReference;
|
99 | footnote: Footnote;
|
100 | footnoteReference: FootnoteReference;
|
101 | }
|
102 |
|
103 |
|
104 |
|
105 |
|
106 |
|
107 |
|
108 |
|
109 |
|
110 |
|
111 |
|
112 |
|
113 |
|
114 |
|
115 |
|
116 | export interface PhrasingContentMap extends StaticPhrasingContentMap {
|
117 | link: Link;
|
118 | linkReference: LinkReference;
|
119 | }
|
120 |
|
121 |
|
122 |
|
123 |
|
124 |
|
125 |
|
126 |
|
127 |
|
128 |
|
129 |
|
130 |
|
131 |
|
132 |
|
133 | export interface ListContentMap {
|
134 | listItem: ListItem;
|
135 | }
|
136 |
|
137 |
|
138 |
|
139 |
|
140 |
|
141 |
|
142 |
|
143 |
|
144 |
|
145 |
|
146 |
|
147 |
|
148 |
|
149 | export interface TableContentMap {
|
150 | tableRow: TableRow;
|
151 | }
|
152 |
|
153 |
|
154 |
|
155 |
|
156 |
|
157 |
|
158 |
|
159 |
|
160 |
|
161 |
|
162 |
|
163 |
|
164 |
|
165 | export interface RowContentMap {
|
166 | tableCell: TableCell;
|
167 | }
|
168 |
|
169 | export type Content = TopLevelContent | ListContent | TableContent | RowContent | PhrasingContent;
|
170 |
|
171 | export type TopLevelContent = BlockContent | FrontmatterContent | DefinitionContent;
|
172 |
|
173 | export type BlockContent = BlockContentMap[keyof BlockContentMap];
|
174 |
|
175 | export type FrontmatterContent = FrontmatterContentMap[keyof FrontmatterContentMap];
|
176 |
|
177 | export type DefinitionContent = DefinitionContentMap[keyof DefinitionContentMap];
|
178 |
|
179 | export type ListContent = ListContentMap[keyof ListContentMap];
|
180 |
|
181 | export type TableContent = TableContentMap[keyof TableContentMap];
|
182 |
|
183 | export type RowContent = RowContentMap[keyof RowContentMap];
|
184 |
|
185 | export type PhrasingContent = PhrasingContentMap[keyof PhrasingContentMap];
|
186 |
|
187 | export type StaticPhrasingContent = StaticPhrasingContentMap[keyof StaticPhrasingContentMap];
|
188 |
|
189 | export interface Parent extends UnistParent {
|
190 | children: Content[];
|
191 | }
|
192 |
|
193 | export interface Literal extends UnistLiteral {
|
194 | value: string;
|
195 | }
|
196 |
|
197 | export interface Root extends Parent {
|
198 | type: 'root';
|
199 | }
|
200 |
|
201 | export interface Paragraph extends Parent {
|
202 | type: 'paragraph';
|
203 | children: PhrasingContent[];
|
204 | }
|
205 |
|
206 | export interface Heading extends Parent {
|
207 | type: 'heading';
|
208 | depth: 1 | 2 | 3 | 4 | 5 | 6;
|
209 | children: PhrasingContent[];
|
210 | }
|
211 |
|
212 | export interface ThematicBreak extends Node {
|
213 | type: 'thematicBreak';
|
214 | }
|
215 |
|
216 | export interface Blockquote extends Parent {
|
217 | type: 'blockquote';
|
218 | children: Array<BlockContent | DefinitionContent>;
|
219 | }
|
220 |
|
221 | export interface List extends Parent {
|
222 | type: 'list';
|
223 | ordered?: boolean | null | undefined;
|
224 | start?: number | null | undefined;
|
225 | spread?: boolean | null | undefined;
|
226 | children: ListContent[];
|
227 | }
|
228 |
|
229 | export interface ListItem extends Parent {
|
230 | type: 'listItem';
|
231 | checked?: boolean | null | undefined;
|
232 | spread?: boolean | null | undefined;
|
233 | children: Array<BlockContent | DefinitionContent>;
|
234 | }
|
235 |
|
236 | export interface Table extends Parent {
|
237 | type: 'table';
|
238 | align?: AlignType[] | null | undefined;
|
239 | children: TableContent[];
|
240 | }
|
241 |
|
242 | export interface TableRow extends Parent {
|
243 | type: 'tableRow';
|
244 | children: RowContent[];
|
245 | }
|
246 |
|
247 | export interface TableCell extends Parent {
|
248 | type: 'tableCell';
|
249 | children: PhrasingContent[];
|
250 | }
|
251 |
|
252 | export interface HTML extends Literal {
|
253 | type: 'html';
|
254 | }
|
255 |
|
256 | export interface Code extends Literal {
|
257 | type: 'code';
|
258 | lang?: string | null | undefined;
|
259 | meta?: string | null | undefined;
|
260 | }
|
261 |
|
262 | export interface YAML extends Literal {
|
263 | type: 'yaml';
|
264 | }
|
265 |
|
266 | export interface Definition extends Node, Association, Resource {
|
267 | type: 'definition';
|
268 | }
|
269 |
|
270 | export interface FootnoteDefinition extends Parent, Association {
|
271 | type: 'footnoteDefinition';
|
272 | children: Array<BlockContent | DefinitionContent>;
|
273 | }
|
274 |
|
275 | export interface Text extends Literal {
|
276 | type: 'text';
|
277 | }
|
278 |
|
279 | export interface Emphasis extends Parent {
|
280 | type: 'emphasis';
|
281 | children: PhrasingContent[];
|
282 | }
|
283 |
|
284 | export interface Strong extends Parent {
|
285 | type: 'strong';
|
286 | children: PhrasingContent[];
|
287 | }
|
288 |
|
289 | export interface Delete extends Parent {
|
290 | type: 'delete';
|
291 | children: PhrasingContent[];
|
292 | }
|
293 |
|
294 | export interface InlineCode extends Literal {
|
295 | type: 'inlineCode';
|
296 | }
|
297 |
|
298 | export interface Break extends Node {
|
299 | type: 'break';
|
300 | }
|
301 |
|
302 | export interface Link extends Parent, Resource {
|
303 | type: 'link';
|
304 | children: StaticPhrasingContent[];
|
305 | }
|
306 |
|
307 | export interface Image extends Node, Resource, Alternative {
|
308 | type: 'image';
|
309 | }
|
310 |
|
311 | export interface LinkReference extends Parent, Reference {
|
312 | type: 'linkReference';
|
313 | children: StaticPhrasingContent[];
|
314 | }
|
315 |
|
316 | export interface ImageReference extends Node, Reference, Alternative {
|
317 | type: 'imageReference';
|
318 | }
|
319 |
|
320 | export interface Footnote extends Parent {
|
321 | type: 'footnote';
|
322 | children: PhrasingContent[];
|
323 | }
|
324 |
|
325 | export interface FootnoteReference extends Node, Association {
|
326 | type: 'footnoteReference';
|
327 | }
|
328 |
|
329 |
|
330 | export interface Resource {
|
331 | url: string;
|
332 | title?: string | null | undefined;
|
333 | }
|
334 |
|
335 | export interface Association {
|
336 | identifier: string;
|
337 | label?: string | null | undefined;
|
338 | }
|
339 |
|
340 | export interface Reference extends Association {
|
341 | referenceType: ReferenceType;
|
342 | }
|
343 |
|
344 | export interface Alternative {
|
345 | alt?: string | null | undefined;
|
346 | }
|