unifiedjs/unified

Don’t pass `processor` as argument to `attacher`s

wooorm opened this issue · 1 comments

Attachers should be invoked with the processor as the context object, instead of a parameter.

Often, attachers don’t even need to interact with the processor, so it makes no sense to pass it first.
Removing it from the arguments makes it easier to use attachers to without unified, such as in the following code:

var toc = require('remark-toc')();
var tree = {type: 'root', children: [/* … */]};
console.log(toc(tree));