-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathevent.ts
64 lines (57 loc) · 1.32 KB
/
event.ts
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
type CodeBlock = {
kind: "indented";
} | {
kind: "fenced";
language: string;
};
type Alignment =
| "none"
| "left"
| "center"
| "right";
type Link = {
kind:
| "inline"
| "reference"
| "collapsed"
| "shortcut"
| "autolink"
| "email";
url: string;
title: string;
};
type SimpleTags =
| "paragraph"
| "blockQuote"
| "listItem"
| "tableHead"
| "tableRow"
| "tableCell"
| "emphasis"
| "strong"
| "strikethrough";
type TagCommon<T> = {
tag: T;
};
type Tag =
| TagCommon<SimpleTags>
| TagCommon<"heading"> & { level: number }
| TagCommon<"codeBlock"> & CodeBlock
| TagCommon<"list"> & { startNumber?: number }
| TagCommon<"footnoteDefinition"> & { label: string }
| TagCommon<"table"> & { alignments: Alignment[] }
| TagCommon<"link" | "image"> & Link;
type TokenCommon<T> = {
type: T;
};
/**
* Markdown tokens that are generated during traversal of the document.
* check https://docs.rs/pulldown-cmark/0.8.0/pulldown_cmark/enum.Event.html
* for more detailed information.
*/
export type Token =
| TokenCommon<"start" | "end"> & Tag
| TokenCommon<"text" | "code" | "html"> & { content: string }
| TokenCommon<"footnoteReference"> & { label: string }
| TokenCommon<"softBreak" | "hardBreak" | "rule">
| TokenCommon<"taskListMarker"> & { checked: boolean };