Global

Methods

getAttributeListArray(attrs, valueopt) → {Array.<AttributePartial>}

Source:

Return an AttributeList-compatible array from an array or object.

Parameters:
Name Type Attributes Description
attrs Array.<(AttributePartial|AttributePlain)> | RegExp | string | void

raw attributes.

value any <optional>

optional attribute value to be used when attr is a primative.

Returns:
Type
Array.<AttributePartial>

Type Definitions

AttributeArgument

Source:

Any kind of attribute

Type:

AttributePartial

Source:
Properties:
Name Type Attributes Description
name RegExp | string <optional>
value RegExp | String <optional>
source AttributeSource <optional>

Object representing a complete or partial attribute

Type:
  • Object

AttributePlain

Source:

Object representing an attribute

Type:
  • Object.<string, string>

AttributeSource

Source:
Properties:
Name Type Attributes Description
before string <optional>
quote string <optional>

Object representing the source configuration of an attribute

Type:
  • Object

CommentInput

Source:
Properties:
Name Type Description
comment string

Content of the Comment.

source CommentSource

Source mapping of the Comment.

input CommentInput

Metadata of the Comment.

startOffset number

Starting offset within the input source.

endOffset number

Ending offset within the input source.

html string

HTML source of the Comment.

Custom settings applied to the Comment.

Type:
  • Object

DoctypeSource

Source:
Properties:
Name Type Attributes Description
doctype string

Label of the Doctype.

name string <optional>

Name of the Doctype.

publicId string <optional>

Public identifier portion of the Doctype.

systemId string <optional>

System identifier portion of the Doctype.

source DoctypeSource <optional>

Source mapping of the Doctype.

input Object

Raw HTML source of the Doctype.

before number

Starting content within the Doctype.

after number

Starting content within the Doctype.

beforePublicId number

Ending offset within the Doctype.

afterPublicId number

Ending offset within the Doctype.

Custom settings applied to the Doctype, or the content of the Doctype.

Type:
  • Object

ElementJSON

Source:
Properties:
Name Type Attributes Default Description
name string <optional>
"span"

Tag name of the Element.

isSelfClosing boolean <optional>
false

Whether the Element is self-closing.

isVoid boolean <optional>
false

Whether the Element is void.

isWithoutEndTag boolean <optional>
false

Whether the Element includes a closing tag.

attrs Array | AttributeList | Object <optional>

Attributes applied to the Element.

nodes Array | NodeList <optional>

Nodes appended to the Element.

source Object <optional>

Source mapping of the Element.

result Result

Result applied to the Element.

before string

Raw content before the inner-opening tag of the Element.

after string

Raw content before the inner-closing tag of the Element.

name string

Tag name of the Element.

isSelfClosing boolean

Whether the Element is self-closing.

isVoid boolean

Whether the Element is void.

attrs Object.<string, (string|null)>

Attributes applied to the Element.

nodes Array.<(ElementJSON|string)>

Nodes appended to the Element.

Custom settings applied to the Element or its tag name.

Type:
  • Object

FragmentSource

Source:
Properties:
Name Type Description
nodes Array.<Node>

Nodes appended to the Fragment.

source FragmentSource

Source mapping of the Fragment.

result Result

Result applied to the Fragment.

Custom settings applied to the Fragment.

Type:
  • Object

Message

Source:
Properties:
Name Type Attributes Description
type string

Type of message.

text string

Message itself.

opts MessageInfo <optional>

Information about the message.

Message gathered during transformations.

Type:
  • Object

MessageInfo

Source:
Properties:
Name Type Attributes Description
plugin Plugin <optional>

Current plugin.

Information about the message.

Type:
  • Object

MessageWarning

Source:

Warning message gathered during transformations.

Type:
  • Object

ProcessOptions

Source:
Properties:
Name Type Attributes Description
from string <optional>

Source input location.

to string <optional>

Destination output location.

voidElements Array.<string> <optional>

Void elements.

Custom settings applied to the Result.

Type:
  • Object

ResultPromise

Source:

Promise to return a syntax tree.

Type:
Example
resultPromise.then(result => {
 // do something with the result
})

ResultType

Source:
Properties:
Name Type Description
from string

Path to the HTML source file. You should always set from, because it is used in source map generation and syntax error messages.

to string

Path to the HTML output file.

root Fragment

Object representing the parsed nodes of the HTML file.

messages Array.<Message>

List of the messages gathered during transformations.

voidElements Array.<string>

List of the elements that only have a start tag, as they cannot have any content.

Result of a pHTML transformation.

Type:
  • Object

TextSource

Source:
Properties:
Name Type Description
data string

Content of the Text.

source TextSource

Source mapping of the Text.

input Object

Raw HTML source of the Text.

startOffset number

starting offset of the raw HTML source of the Text.

endOffset number

Ending offset of the raw HTML source of the Text.

Custom settings applied to the Text, or the content of the Text.

Type:
  • Object