PHTML

PHTML

Return a new instance of PHTML.

Constructor

new PHTML(plugins)

Source:
Examples
new PHTML(plugin)
new PHTML([ somePlugin, anotherPlugin ])
Parameters:
Name Type Description
plugins Array | Object | Plugin | function

Plugin or plugins being added.

Methods

(static) process(processOptionsopt, pluginsopt) → {ResultPromise}

Source:

Process input and return the new Result

Examples
PHTML.process('some html', processOptions)

Process HTML with plugins.

PHTML.process('some html', processOptions, plugins) // returns a new PHTML instance
Parameters:
Name Type Attributes Description
processOptions ProcessOptions <optional>

Custom settings applied to the Result.

plugins Array | Object | Plugin | function <optional>

Custom settings applied to the Result.

Returns:
Type
ResultPromise

(static) use(plugin) → {PHTML}

Source:

Return a new PHTML instance which will use plugins

Examples
PHTML.use(plugin) // returns a new PHTML instance
PHTML.use([ somePlugin, anotherPlugin ]) // returns a new PHTML instance
PHTML.use(somePlugin, anotherPlugin) // returns a new PHTML instance
Parameters:
Name Type Description
plugin Array | Object | Plugin | function

Plugin or plugins being added.

Returns:
Type
PHTML

process(input, processOptions) → {ResultPromise}

Source:

Process input using plugins and return the result

Example
phtml.process('some html', processOptions)
Parameters:
Name Type Description
input string

Source being processed.

processOptions ProcessOptions

Custom settings applied to the Result.

Returns:
Type
ResultPromise

use(plugins) → {PHTML}

Source:

Add plugins to the existing instance of PHTML

Examples
phtml.use(plugin)
phtml.use([ somePlugin, anotherPlugin ])
phtml.use(somePlugin, anotherPlugin)
Parameters:
Name Type Description
plugins Array | Object | Plugin | function

Plugin or plugins being added.

Returns:
Type
PHTML