You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
defaultdecodeEntities
decodeEntities
• OptionaldecodeEntities: boolean
Option inherited from parsing; will be used as the default value for encodeEntities.
default true
emptyAttrs
• OptionalemptyAttrs: boolean
Print an empty attribute's value.
default xmlMode
example With emptyAttrs: false: <input checked>
example With emptyAttrs: true: <input checked="">
selfClosingTags
• OptionalselfClosingTags: boolean
Print self-closing tags for tags without contents. If xmlMode is set, this
will apply to all tags. Otherwise, only tags that are defined as self-closing
in the HTML specification will be printed as such.
default xmlMode
example With selfClosingTags: false: <foo></foo><br></br>
example With xmlMode: true and selfClosingTags: true: <foo/><br/>
example With xmlMode: false and selfClosingTags: true: <foo></foo><br />
xmlMode
• OptionalxmlMode: boolean | "foreign"
Treat the input as an XML document; enables the emptyAttrs and selfClosingTags options.
If the value is "foreign", it will try to correct mixed-case attribute names.