1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 | import { TypeofTxtNode } from "./TypeofTxtNode";
|
7 | export declare enum ASTNodeTypes {
|
8 | Document = "Document",
|
9 | DocumentExit = "Document:exit",
|
10 | Paragraph = "Paragraph",
|
11 | ParagraphExit = "Paragraph:exit",
|
12 | BlockQuote = "BlockQuote",
|
13 | BlockQuoteExit = "BlockQuote:exit",
|
14 | ListItem = "ListItem",
|
15 | ListItemExit = "ListItem:exit",
|
16 | List = "List",
|
17 | ListExit = "List:exit",
|
18 | Header = "Header",
|
19 | HeaderExit = "Header:exit",
|
20 | CodeBlock = "CodeBlock",
|
21 | CodeBlockExit = "CodeBlock:exit",
|
22 | HtmlBlock = "HtmlBlock",
|
23 | HtmlBlockExit = "HtmlBlock:exit",
|
24 | HorizontalRule = "HorizontalRule",
|
25 | HorizontalRuleExit = "HorizontalRule:exit",
|
26 | Comment = "Comment",
|
27 | CommentExit = "Comment:exit",
|
28 | |
29 |
|
30 |
|
31 | ReferenceDef = "ReferenceDef",
|
32 | |
33 |
|
34 |
|
35 | ReferenceDefExit = "ReferenceDef:exit",
|
36 | Str = "Str",
|
37 | StrExit = "Str:exit",
|
38 | Break = "Break",
|
39 | BreakExit = "Break:exit",
|
40 | Emphasis = "Emphasis",
|
41 | EmphasisExit = "Emphasis:exit",
|
42 | Strong = "Strong",
|
43 | StrongExit = "Strong:exit",
|
44 | Html = "Html",
|
45 | HtmlExit = "Html:exit",
|
46 | Link = "Link",
|
47 | LinkExit = "Link:exit",
|
48 | Image = "Image",
|
49 | ImageExit = "Image:exit",
|
50 | Code = "Code",
|
51 | CodeExit = "Code:exit",
|
52 | Delete = "Delete",
|
53 | DeleteExit = "Delete:exit"
|
54 | }
|
55 |
|
56 |
|
57 |
|
58 |
|
59 | export declare type TxtNodeType = keyof typeof ASTNodeTypes | string;
|
60 |
|
61 |
|
62 |
|
63 |
|
64 | export { TypeofTxtNode };
|
65 |
|
66 |
|
67 |
|
68 | export declare type AnyTxtNode = TxtNode | TxtTextNode | TxtParentNode;
|
69 |
|
70 |
|
71 |
|
72 |
|
73 | export interface TxtNode {
|
74 | type: TxtNodeType;
|
75 | raw: string;
|
76 | range: TextNodeRange;
|
77 | loc: TxtNodeLineLocation;
|
78 | parent?: TxtNode;
|
79 | [index: string]: any;
|
80 | }
|
81 |
|
82 |
|
83 |
|
84 | export interface TxtNodeLineLocation {
|
85 | start: TxtNodePosition;
|
86 | end: TxtNodePosition;
|
87 | }
|
88 |
|
89 |
|
90 |
|
91 |
|
92 |
|
93 |
|
94 | export interface TxtNodePosition {
|
95 | line: number;
|
96 | column: number;
|
97 | }
|
98 |
|
99 |
|
100 |
|
101 | export declare type TextNodeRange = readonly [startIndex: number, endIndex: number];
|
102 |
|
103 |
|
104 |
|
105 |
|
106 |
|
107 | export interface TxtTextNode extends TxtNode {
|
108 | value: string;
|
109 | }
|
110 |
|
111 |
|
112 |
|
113 |
|
114 | export interface TxtParentNode extends TxtNode {
|
115 | children: Array<TxtNode | TxtTextNode>;
|
116 | }
|