Skip to main content

Interface: HTMLParser2Options

Defined in: src/options.ts:13

Options accepted by htmlparser2, the default parser for XML.

See​

https://github.com/fb55/htmlparser2/wiki/Parser-options

Extends​

Properties​

decodeEntities?​

optional decodeEntities: boolean

Defined in: node_modules/dom-serializer/lib/esm/index.d.ts:40

Option inherited from parsing; will be used as the default value for encodeEntities.

Default​

true

Inherited from​

DomSerializerOptions.decodeEntities


emptyAttrs?​

optional emptyAttrs: boolean

Defined in: node_modules/dom-serializer/lib/esm/index.d.ts:10

Print an empty attribute's value.

Default​

xmlMode

Examples​

With <code>emptyAttrs: false</code>: <code>&lt;input checked&gt;</code>
With <code>emptyAttrs: true</code>: <code>&lt;input checked=""&gt;</code>

Inherited from​

DomSerializerOptions.emptyAttrs


encodeEntities?​

optional encodeEntities: boolean | "utf8"

Defined in: node_modules/dom-serializer/lib/esm/index.d.ts:34

Encode characters that are either reserved in HTML or XML.

If xmlMode is true or the value not 'utf8', characters outside of the utf8 range will be encoded as well.

Default​

decodeEntities

Inherited from​

DomSerializerOptions.encodeEntities


lowerCaseAttributeNames?​

optional lowerCaseAttributeNames: boolean

Defined in: node_modules/htmlparser2/dist/esm/Parser.d.ts:29

If set to true, all attribute names will be lowercased. This has noticeable impact on speed.

Default​

!xmlMode

Inherited from​

HTMLParser2ParserOptions.lowerCaseAttributeNames


lowerCaseTags?​

optional lowerCaseTags: boolean

Defined in: node_modules/htmlparser2/dist/esm/Parser.d.ts:23

If set to true, all tags will be lowercased.

Default​

!xmlMode

Inherited from​

HTMLParser2ParserOptions.lowerCaseTags


recognizeCDATA?​

optional recognizeCDATA: boolean

Defined in: node_modules/htmlparser2/dist/esm/Parser.d.ts:36

If set to true, CDATA sections will be recognized as text even if the xmlMode option is not enabled. NOTE: If xmlMode is set to true then CDATA sections will always be recognized as text.

Default​

xmlMode

Inherited from​

HTMLParser2ParserOptions.recognizeCDATA


recognizeSelfClosing?​

optional recognizeSelfClosing: boolean

Defined in: node_modules/htmlparser2/dist/esm/Parser.d.ts:43

If set to true, self-closing tags will trigger the onclosetag event even if xmlMode is not set to true. NOTE: If xmlMode is set to true then self-closing tags will always be recognized.

Default​

xmlMode

Inherited from​

HTMLParser2ParserOptions.recognizeSelfClosing


selfClosingTags?​

optional selfClosingTags: boolean

Defined in: node_modules/dom-serializer/lib/esm/index.d.ts:18

Print self-closing tags for tags without contents.

Default​

xmlMode

Examples​

With <code>selfClosingTags: false</code>: <code>&lt;foo&gt;&lt;/foo&gt;</code>
With <code>selfClosingTags: true</code>: <code>&lt;foo /&gt;</code>

Inherited from​

DomSerializerOptions.selfClosingTags


Tokenizer?​

optional Tokenizer: typeof default

Defined in: node_modules/htmlparser2/dist/esm/Parser.d.ts:47

Allows the default tokenizer to be overwritten.

Inherited from​

HTMLParser2ParserOptions.Tokenizer


withEndIndices?​

optional withEndIndices: boolean

Defined in: node_modules/domhandler/lib/esm/index.d.ts:19

Add an endIndex property to nodes. When the parser is used in a non-streaming fashion, endIndex is an integer indicating the position of the end of the node in the document.

Default​

false

Inherited from​

DomHandlerOptions.withEndIndices


withStartIndices?​

optional withStartIndices: boolean

Defined in: node_modules/domhandler/lib/esm/index.d.ts:11

Add a startIndex property to nodes. When the parser is used in a non-streaming fashion, startIndex is an integer indicating the position of the start of the node in the document.

Default​

false

Inherited from​

DomHandlerOptions.withStartIndices


xmlMode?​

optional xmlMode: boolean

Defined in: src/options.ts:16

Treat the input as an XML document.

Overrides​

DomHandlerOptions.xmlMode