Skip to content

Commit

Permalink
Merge 5819f4c into 01a3453
Browse files Browse the repository at this point in the history
  • Loading branch information
michael-ciniawsky committed Dec 27, 2017
2 parents 01a3453 + 5819f4c commit b32dfcf
Showing 1 changed file with 21 additions and 3 deletions.
24 changes: 21 additions & 3 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,30 @@ class PostHTML {
*/
options = options || {}

if (options.parser) parser = options.parser
if (options.render) render = options.render
if (options.parser) {
if (typeof options.parser === 'object') {
parser = parser(options.parser)
}

if (typeof options.parser === 'function') {
parser = options.parser
}
}
// else {
// TODO(michael-ciniawsky)
// Call parser() with defauts here, when curried
// parser = parser
// }

if (options.render) {
if (typeof options.render === 'function') {
render = options.render
}
}

tree = options.skipParse
? tree
: parser(tree, options)
: parser(tree)

tree.options = options
tree.processor = this
Expand Down

0 comments on commit b32dfcf

Please sign in to comment.