Skip to content

Commit

Permalink
Refactor comments
Browse files Browse the repository at this point in the history
  • Loading branch information
wooorm committed Jun 17, 2019
1 parent dc4bd73 commit 497c73d
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,27 @@ var mdast2nlcst = require('mdast-util-to-nlcst')

module.exports = remark2retext

/* Attacher.
* If a destination processor is given, runs the destination
* with the new NLCST tree (bridge-mode).
* If a parser is given, returns the NLCST tree: further
* plug-ins run on that tree (mutate-mode). */
// Attacher.
// If a destination processor is given, runs the destination with the new nlcst
// tree (bridge mode).
// If a parser is given, returns the nlcst tree: further plugins run on that
// tree (mutate mode).
function remark2retext(destination, options) {
var fn = destination && destination.run ? bridge : mutate
return fn(destination, options)
}

/* Mutate-mode. Further transformers run on the NLCST tree. */
// Mutate mode.
// Further transformers run on the nlcst tree.
function mutate(parser, options) {
return transformer
function transformer(node, file) {
return mdast2nlcst(node, file, parser, options)
}
}

/* Bridge-mode. Runs the destination with the new NLCST
* tree. */
// Bridge mode.
// Runs the destination with the new nlcst tree.
function bridge(destination, options) {
return transformer
function transformer(node, file, next) {
Expand Down

0 comments on commit 497c73d

Please sign in to comment.