Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don’t pass processor as argument to attachers #21

Closed
wooorm opened this issue Feb 8, 2017 · 1 comment
Closed

Don’t pass processor as argument to attachers #21

wooorm opened this issue Feb 8, 2017 · 1 comment
Labels
🗄 area/interface This affects the public interface 💪 phase/solved Post is done 🧑 semver/major This is a change 🦋 type/enhancement This is great to have

Comments

@wooorm
Copy link
Member

wooorm commented Feb 8, 2017

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));
@wooorm wooorm changed the title Don’t pass processor as argument to attachers. Don’t pass processor as argument to attachers Feb 8, 2017
@wooorm
Copy link
Member Author

wooorm commented Feb 10, 2017

Here’s an example which this change would make much prettier: https://github.com/wooorm/rehype-format/blob/7715bf1f6f6d56025bd8fe260ea599d6954e75dd/index.js#L4

@wooorm wooorm mentioned this issue Feb 20, 2017
11 tasks
@wooorm wooorm closed this as completed in 6f1b3e3 Feb 23, 2017
@wooorm wooorm added ⛵️ status/released 🗄 area/interface This affects the public interface 🦋 type/enhancement This is great to have 🧑 semver/major This is a change labels Aug 10, 2019
@wooorm wooorm added the 💪 phase/solved Post is done label May 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🗄 area/interface This affects the public interface 💪 phase/solved Post is done 🧑 semver/major This is a change 🦋 type/enhancement This is great to have
Development

No branches or pull requests

1 participant