11# ES HTML Parser
22
3+ <p align =" left " >
34<img src =" https://github.com/yeonjuan/es-html-parser/actions/workflows/main.yml/badge.svg?branch=main " alt =" CI Badge " />
45<a href =" https://codecov.io/gh/yeonjuan/es-html-parser " >
56<img src =" https://codecov.io/gh/yeonjuan/es-html-parser/branch/main/graph/badge.svg?token=LNYPD2GOJR " />
67</a >
78<a href =" https://www.npmjs.com/package/es-html-parser " >
89<img src =" https://img.shields.io/npm/v/es-html-parser " />
910</a >
11+ </p >
1012
1113ES HTML Parser is an HTML parser that generates an abstract syntax tree similar to the ESTree specification.
1214
@@ -106,12 +108,12 @@ type AnyNode =
106108 | StyleTagContentNode
107109 | CloseStyleTagNode
108110 | CommentNode
109- | CommentStartNode
110- | CommentEndNode
111+ | CommentOpenNode
112+ | CommentCloseNode
111113 | CommentContentNode
112114 | DoctypeNode
113- | DoctypeStartNode
114- | DoctypeEndNode
115+ | DoctypeOpenNode
116+ | DoctypeCloseNode
115117 | DoctypeAttributeNode
116118 | DoctypeAttributeValueNode
117119 | DoctypeAttributeWrapperStart
@@ -133,14 +135,14 @@ type AnyToken =
133135 | Token <TokenTypes .AttributeValueWrapperStart >
134136 | Token <TokenTypes .AttributeValue >
135137 | Token <TokenTypes .AttributeValueWrapperEnd >
136- | Token <TokenTypes .DoctypeStart >
138+ | Token <TokenTypes .DoctypeOpen >
137139 | Token <TokenTypes .DoctypeAttributeValue >
138140 | Token <TokenTypes .DoctypeAttributeWrapperStart >
139141 | Token <TokenTypes .DoctypeAttributeWrapperEnd >
140- | Token <TokenTypes .DoctypeEnd >
141- | Token <TokenTypes .CommentStart >
142+ | Token <TokenTypes .DoctypeClose >
143+ | Token <TokenTypes .CommentOpen >
142144 | Token <TokenTypes .CommentContent >
143- | Token <TokenTypes .CommentEnd >
145+ | Token <TokenTypes .CommentClose >
144146 | Token <TokenTypes .OpenScriptTagStart >
145147 | Token <TokenTypes .OpenScriptTagEnd >
146148 | Token <TokenTypes .ScriptTagContent >
@@ -166,14 +168,14 @@ enum TokenTypes {
166168 AttributeValueWrapperStart = " AttributeValueWrapperStart" ,
167169 AttributeValue = " AttributeValue" ,
168170 AttributeValueWrapperEnd = " AttributeValueWrapperEnd" ,
169- DoctypeStart = " DoctypeStart " ,
171+ DoctypeOpen = " DoctypeOpen " ,
170172 DoctypeAttributeValue = " DoctypeAttributeValue" ,
171173 DoctypeAttributeWrapperStart = " DoctypeAttributeWrapperStart" ,
172174 DoctypeAttributeWrapperEnd = " DoctypeAttributeWrapperEnd" ,
173- DoctypeEnd = " DoctypeEnd " ,
174- CommentStart = " CommentStart " ,
175+ DoctypeClose = " DoctypeClose " ,
176+ CommentOpen = " CommentOpen " ,
175177 CommentContent = " CommentContent" ,
176- CommentEnd = " CommentEnd " ,
178+ CommentClose = " CommentClose " ,
177179 OpenScriptTagStart = " OpenScriptTagStart" ,
178180 OpenScriptTagEnd = " OpenScriptTagEnd" ,
179181 ScriptTagContent = " ScriptTagContent" ,
@@ -194,8 +196,8 @@ enum NodeTypes {
194196 Text = " Text" ,
195197 Doctype = " Doctype" ,
196198 Comment = " Comment" ,
197- CommentStart = " CommentStart " ,
198- CommentEnd = " CommentEnd " ,
199+ CommentOpen = " CommentOpen " ,
200+ CommentClose = " CommentClose " ,
199201 CommentContent = " CommentContent" ,
200202 Attribute = " Attribute" ,
201203 AttributeKey = " AttributeKey" ,
@@ -205,9 +207,9 @@ enum NodeTypes {
205207 CloseTag = " CloseTag" ,
206208 OpenTagEnd = " OpenTagEnd" ,
207209 OpenTagStart = " OpenTagStart" ,
208- DoctypeStart = " DoctypeStart " ,
210+ DoctypeOpen = " DoctypeOpen " ,
209211 DoctypeAttribute = " DoctypeAttribute" ,
210- DoctypeEnd = " DoctypeEnd " ,
212+ DoctypeClose = " DoctypeClose " ,
211213 ScriptTag = " ScriptTag" ,
212214 OpenScriptTagStart = " OpenScriptTagStart" ,
213215 OpenScriptTagEnd = " OpenScriptTagEnd" ,
@@ -255,12 +257,12 @@ enum NodeTypes {
255257 - [ CloseStyleTagNode] ( #closestyletagnode )
256258 - [ StyleTagContentNode] ( #styletagcontentnode )
257259- [ CommentNode] ( #commentnode )
258- - [ CommentStartNode ] ( #commentstartnode )
259- - [ CommentEndNode ] ( #commentendnode )
260+ - [ CommentOpenNode ] ( #commentopennode )
261+ - [ CommentCloseNode ] ( #commentclosenode )
260262 - [ CommentContentNode] ( #commentcontentnode )
261263- [ DoctypeNode] ( #doctypenode )
262- - [ DoctypeStartNode ] ( #doctypestartnode )
263- - [ DoctypeEndNode ] ( #doctypeendnode )
264+ - [ DoctypeOpenNode ] ( #doctypeopennode )
265+ - [ DoctypeCloseNode ] ( #doctypeclosenode )
264266- [ DoctypeAttributeNode] ( #doctypeattributenode )
265267 - [ DoctypeAttributeValueNode] ( #doctypeattributevaluenode )
266268 - [ DoctypeAttributeWrapperStartNode] ( #doctypeattributewrapperstartnode )
@@ -575,30 +577,30 @@ interface StyleTagContentNode extends BaseNode {
575577``` ts
576578interface CommentNode extends BaseNode {
577579 type: " Comment" ;
578- start : CommentStartNode ;
579- end : CommentEndNode ;
580+ open : CommentOpenNode ;
581+ close : CommentCloseNode ;
580582 value: CommentContentNode ;
581583}
582584```
583585
584- #### CommentStartNode
586+ #### CommentOpenNode
585587
586- ` CommentStartNode ` represents comment start character sequence. (e.g. ` <!-- ` )
588+ ` CommentOpenNode ` represents comment start character sequence. (e.g. ` <!-- ` )
587589
588590``` ts
589- interface CommentStartNode extends BaseNode {
590- type: " CommentStart " ;
591+ interface CommentOpenNode extends BaseNode {
592+ type: " CommentOpen " ;
591593 value: string ;
592594}
593595```
594596
595- #### CommentEndNode
597+ #### CommentCloseNode
596598
597- ` CommentEndNode ` represents comment end character sequence. (e.g. ` --> ` )
599+ ` CommentCloseNode ` represents comment end character sequence. (e.g. ` --> ` )
598600
599601``` ts
600- interface CommentEndNode extends BaseNode {
601- type: " CommentEnd " ;
602+ interface CommentCloseNode extends BaseNode {
603+ type: " CommentClose " ;
602604 value: string ;
603605}
604606```
@@ -622,29 +624,29 @@ interface CommentContentNode extends BaseNode {
622624interface DoctypeNode extends BaseNode {
623625 type: " Doctype" ;
624626 attributes: Array <DoctypeAttributeNode >;
625- start : DoctypeStartNode ;
626- end : DoctypeEndNode ;
627+ open : DoctypeOpenNode ;
628+ close : DoctypeCloseNode ;
627629}
628630```
629631
630- #### DoctypeStartNode
632+ #### DoctypeOpenNode
631633
632- ` DoctypeStartNode ` represents character sequence of doctype start . (` <!DOCTYPE ` )
634+ ` DoctypeOpenNode ` represents character sequence of doctype start . (` <!DOCTYPE ` )
633635
634636``` ts
635- interface DoctypeStartNode extends BaseNode {
636- type: " DoctypeStart " ;
637+ interface DoctypeOpenNode extends BaseNode {
638+ type: " DoctypeOpen " ;
637639 value: string ;
638640}
639641```
640642
641- #### DoctypeEndNode
643+ #### DoctypeCloseNode
642644
643- ` DoctypeEndNode ` represents the doctype end character sequence (e.g. ` > ` )
645+ ` DoctypeCloseNode ` represents the doctype end character sequence (e.g. ` > ` )
644646
645647``` ts
646- interface DoctypeEndNode extends BaseNode {
647- type: " DoctypeEnd " ;
648+ interface DoctypeCloseNode extends BaseNode {
649+ type: " DoctypeClose " ;
648650 value: string ;
649651}
650652```
0 commit comments