Skip to content

Latest commit

 

History

History
131 lines (96 loc) · 3.5 KB

File metadata and controls

131 lines (96 loc) · 3.5 KB

Modules

posthtmlfunction

Classes

PostHTML

Members

version

PostHTML Instance

posthtml ⇒ function

Returns: function - posthtml

Usage

import posthtml from 'posthtml'
import plugin from 'posthtml-plugin'

const ph = posthtml([ plugin() ])
Param Type
plugins Array

PostHTML

Kind: global class
Requires: module:api, module:posthtml-parser, module:posthtml-render
Author: Ivan Voischev (@voischev), Ivan Demidov (@scrum)

new PostHTML(plugins)

Param Type Description
plugins Array An array of PostHTML plugins

postHTML.use(plugin) ⇒ Constructor

Kind: instance method of PostHTML
Returns: Constructor - - this(PostHTML)

Usage

ph.use((tree) => { tag: 'div', content: tree })
  .process('<html>..</html>', {})
  .then((result) => result))

this: posthtml

Param Type Description
plugin function A PostHTML plugin

postHTML.process(html, options) ⇒ Object.<{html: String, tree: PostHTMLTree}> | Promise.<{html: String, tree: PostHTMLTree}>

Kind: instance method of PostHTML
Returns: Object.<{html: String, tree: PostHTMLTree}> - - Sync ModePromise.<{html: String, tree: PostHTMLTree}> - - Async Mode (default)

Usage

Sync

ph.process('<html>..</html>', { sync: true }).html

Async

ph.process('<html>..</html>', {}).then((result) => result))
Param Type Description
html String Input (HTML)
options Object PostHTML Options

process~options : Object

PostHTML Options

Kind: inner property of process
Properties

Name Type Description
options.sync Boolean enables sync mode, plugins will run synchronously, throws an error when used with async plugins
options.parser function use custom parser, replaces default (posthtml-parser)
options.render function use custom render, replaces default (posthtml-render)
options.skipParse Boolean disable parsing
options.directives Array Adds processing of custom directives.

version

PostHTML Instance

Kind: global variable
Properties

Name
plugins
options