1
1
# ES HTML Parser
2
2
3
+ <p align =" left " >
3
4
<img src =" https://github.com/yeonjuan/es-html-parser/actions/workflows/main.yml/badge.svg?branch=main " alt =" CI Badge " />
4
5
<a href =" https://codecov.io/gh/yeonjuan/es-html-parser " >
5
6
<img src =" https://codecov.io/gh/yeonjuan/es-html-parser/branch/main/graph/badge.svg?token=LNYPD2GOJR " />
6
7
</a >
7
8
<a href =" https://www.npmjs.com/package/es-html-parser " >
8
9
<img src =" https://img.shields.io/npm/v/es-html-parser " />
9
10
</a >
11
+ </p >
10
12
11
13
ES HTML Parser is an HTML parser that generates an abstract syntax tree similar to the ESTree specification.
12
14
@@ -106,12 +108,12 @@ type AnyNode =
106
108
| StyleTagContentNode
107
109
| CloseStyleTagNode
108
110
| CommentNode
109
- | CommentStartNode
110
- | CommentEndNode
111
+ | CommentOpenNode
112
+ | CommentCloseNode
111
113
| CommentContentNode
112
114
| DoctypeNode
113
- | DoctypeStartNode
114
- | DoctypeEndNode
115
+ | DoctypeOpenNode
116
+ | DoctypeCloseNode
115
117
| DoctypeAttributeNode
116
118
| DoctypeAttributeValueNode
117
119
| DoctypeAttributeWrapperStart
@@ -133,14 +135,14 @@ type AnyToken =
133
135
| Token <TokenTypes .AttributeValueWrapperStart >
134
136
| Token <TokenTypes .AttributeValue >
135
137
| Token <TokenTypes .AttributeValueWrapperEnd >
136
- | Token <TokenTypes .DoctypeStart >
138
+ | Token <TokenTypes .DoctypeOpen >
137
139
| Token <TokenTypes .DoctypeAttributeValue >
138
140
| Token <TokenTypes .DoctypeAttributeWrapperStart >
139
141
| Token <TokenTypes .DoctypeAttributeWrapperEnd >
140
- | Token <TokenTypes .DoctypeEnd >
141
- | Token <TokenTypes .CommentStart >
142
+ | Token <TokenTypes .DoctypeClose >
143
+ | Token <TokenTypes .CommentOpen >
142
144
| Token <TokenTypes .CommentContent >
143
- | Token <TokenTypes .CommentEnd >
145
+ | Token <TokenTypes .CommentClose >
144
146
| Token <TokenTypes .OpenScriptTagStart >
145
147
| Token <TokenTypes .OpenScriptTagEnd >
146
148
| Token <TokenTypes .ScriptTagContent >
@@ -166,14 +168,14 @@ enum TokenTypes {
166
168
AttributeValueWrapperStart = " AttributeValueWrapperStart" ,
167
169
AttributeValue = " AttributeValue" ,
168
170
AttributeValueWrapperEnd = " AttributeValueWrapperEnd" ,
169
- DoctypeStart = " DoctypeStart " ,
171
+ DoctypeOpen = " DoctypeOpen " ,
170
172
DoctypeAttributeValue = " DoctypeAttributeValue" ,
171
173
DoctypeAttributeWrapperStart = " DoctypeAttributeWrapperStart" ,
172
174
DoctypeAttributeWrapperEnd = " DoctypeAttributeWrapperEnd" ,
173
- DoctypeEnd = " DoctypeEnd " ,
174
- CommentStart = " CommentStart " ,
175
+ DoctypeClose = " DoctypeClose " ,
176
+ CommentOpen = " CommentOpen " ,
175
177
CommentContent = " CommentContent" ,
176
- CommentEnd = " CommentEnd " ,
178
+ CommentClose = " CommentClose " ,
177
179
OpenScriptTagStart = " OpenScriptTagStart" ,
178
180
OpenScriptTagEnd = " OpenScriptTagEnd" ,
179
181
ScriptTagContent = " ScriptTagContent" ,
@@ -194,8 +196,8 @@ enum NodeTypes {
194
196
Text = " Text" ,
195
197
Doctype = " Doctype" ,
196
198
Comment = " Comment" ,
197
- CommentStart = " CommentStart " ,
198
- CommentEnd = " CommentEnd " ,
199
+ CommentOpen = " CommentOpen " ,
200
+ CommentClose = " CommentClose " ,
199
201
CommentContent = " CommentContent" ,
200
202
Attribute = " Attribute" ,
201
203
AttributeKey = " AttributeKey" ,
@@ -205,9 +207,9 @@ enum NodeTypes {
205
207
CloseTag = " CloseTag" ,
206
208
OpenTagEnd = " OpenTagEnd" ,
207
209
OpenTagStart = " OpenTagStart" ,
208
- DoctypeStart = " DoctypeStart " ,
210
+ DoctypeOpen = " DoctypeOpen " ,
209
211
DoctypeAttribute = " DoctypeAttribute" ,
210
- DoctypeEnd = " DoctypeEnd " ,
212
+ DoctypeClose = " DoctypeClose " ,
211
213
ScriptTag = " ScriptTag" ,
212
214
OpenScriptTagStart = " OpenScriptTagStart" ,
213
215
OpenScriptTagEnd = " OpenScriptTagEnd" ,
@@ -255,12 +257,12 @@ enum NodeTypes {
255
257
- [ CloseStyleTagNode] ( #closestyletagnode )
256
258
- [ StyleTagContentNode] ( #styletagcontentnode )
257
259
- [ CommentNode] ( #commentnode )
258
- - [ CommentStartNode ] ( #commentstartnode )
259
- - [ CommentEndNode ] ( #commentendnode )
260
+ - [ CommentOpenNode ] ( #commentopennode )
261
+ - [ CommentCloseNode ] ( #commentclosenode )
260
262
- [ CommentContentNode] ( #commentcontentnode )
261
263
- [ DoctypeNode] ( #doctypenode )
262
- - [ DoctypeStartNode ] ( #doctypestartnode )
263
- - [ DoctypeEndNode ] ( #doctypeendnode )
264
+ - [ DoctypeOpenNode ] ( #doctypeopennode )
265
+ - [ DoctypeCloseNode ] ( #doctypeclosenode )
264
266
- [ DoctypeAttributeNode] ( #doctypeattributenode )
265
267
- [ DoctypeAttributeValueNode] ( #doctypeattributevaluenode )
266
268
- [ DoctypeAttributeWrapperStartNode] ( #doctypeattributewrapperstartnode )
@@ -575,30 +577,30 @@ interface StyleTagContentNode extends BaseNode {
575
577
``` ts
576
578
interface CommentNode extends BaseNode {
577
579
type: " Comment" ;
578
- start : CommentStartNode ;
579
- end : CommentEndNode ;
580
+ open : CommentOpenNode ;
581
+ close : CommentCloseNode ;
580
582
value: CommentContentNode ;
581
583
}
582
584
```
583
585
584
- #### CommentStartNode
586
+ #### CommentOpenNode
585
587
586
- ` CommentStartNode ` represents comment start character sequence. (e.g. ` <!-- ` )
588
+ ` CommentOpenNode ` represents comment start character sequence. (e.g. ` <!-- ` )
587
589
588
590
``` ts
589
- interface CommentStartNode extends BaseNode {
590
- type: " CommentStart " ;
591
+ interface CommentOpenNode extends BaseNode {
592
+ type: " CommentOpen " ;
591
593
value: string ;
592
594
}
593
595
```
594
596
595
- #### CommentEndNode
597
+ #### CommentCloseNode
596
598
597
- ` CommentEndNode ` represents comment end character sequence. (e.g. ` --> ` )
599
+ ` CommentCloseNode ` represents comment end character sequence. (e.g. ` --> ` )
598
600
599
601
``` ts
600
- interface CommentEndNode extends BaseNode {
601
- type: " CommentEnd " ;
602
+ interface CommentCloseNode extends BaseNode {
603
+ type: " CommentClose " ;
602
604
value: string ;
603
605
}
604
606
```
@@ -622,29 +624,29 @@ interface CommentContentNode extends BaseNode {
622
624
interface DoctypeNode extends BaseNode {
623
625
type: " Doctype" ;
624
626
attributes: Array <DoctypeAttributeNode >;
625
- start : DoctypeStartNode ;
626
- end : DoctypeEndNode ;
627
+ open : DoctypeOpenNode ;
628
+ close : DoctypeCloseNode ;
627
629
}
628
630
```
629
631
630
- #### DoctypeStartNode
632
+ #### DoctypeOpenNode
631
633
632
- ` DoctypeStartNode ` represents character sequence of doctype start . (` <!DOCTYPE ` )
634
+ ` DoctypeOpenNode ` represents character sequence of doctype start . (` <!DOCTYPE ` )
633
635
634
636
``` ts
635
- interface DoctypeStartNode extends BaseNode {
636
- type: " DoctypeStart " ;
637
+ interface DoctypeOpenNode extends BaseNode {
638
+ type: " DoctypeOpen " ;
637
639
value: string ;
638
640
}
639
641
```
640
642
641
- #### DoctypeEndNode
643
+ #### DoctypeCloseNode
642
644
643
- ` DoctypeEndNode ` represents the doctype end character sequence (e.g. ` > ` )
645
+ ` DoctypeCloseNode ` represents the doctype end character sequence (e.g. ` > ` )
644
646
645
647
``` ts
646
- interface DoctypeEndNode extends BaseNode {
647
- type: " DoctypeEnd " ;
648
+ interface DoctypeCloseNode extends BaseNode {
649
+ type: " DoctypeClose " ;
648
650
value: string ;
649
651
}
650
652
```
0 commit comments