{"action":"opened","issue":{"url":"https://api.github.com/repos/wooorm/unified/issues/24","repository_url":"https://api.github.com/repos/wooorm/unified","labels_url":"https://api.github.com/repos/wooorm/unified/issues/24/labels{/name}","comments_url":"https://api.github.com/repos/wooorm/unified/issues/24/comments","events_url":"https://api.github.com/repos/wooorm/unified/issues/24/events","html_url":"https://github.com/wooorm/unified/issues/24","id":206975563,"number":24,"title":"Change `processor.parser`, `processor.compiler` signatures","user":{"login":"wooorm","id":944406,"avatar_url":"https://avatars.githubusercontent.com/u/944406?v=3","gravatar_id":"","url":"https://api.github.com/users/wooorm","html_url":"https://github.com/wooorm","followers_url":"https://api.github.com/users/wooorm/followers","following_url":"https://api.github.com/users/wooorm/following{/other_user}","gists_url":"https://api.github.com/users/wooorm/gists{/gist_id}","starred_url":"https://api.github.com/users/wooorm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wooorm/subscriptions","organizations_url":"https://api.github.com/users/wooorm/orgs","repos_url":"https://api.github.com/users/wooorm/repos","events_url":"https://api.github.com/users/wooorm/events{/privacy}","received_events_url":"https://api.github.com/users/wooorm/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-02-11T11:51:28Z","updated_at":"2017-02-11T11:51:28Z","closed_at":null,"body":"`parser(vfile, settings, processor)`  > `parser(doc, vfile)`\r\n`compiler(vfile, settings, processor)`  > `compiler(tree, vfile)`\r\n\r\nThat makes it more similar to transformers, and allows for `settings` to be removed (GH-23).\r\n\r\n---\r\n\r\n```js\r\nvar parse = require('./parse')\r\nvar proc = unified().use(parse, {b: true}).data('settings', {a: true});\r\n\r\nproces.parse('foo', console.log);\r\n```\r\n\r\n`parse.js`:\r\n\r\n```js\r\nmodule.exports = parser;\r\n\r\nParser.prototype.parse = parse;\r\nParser.prototype.defaults = {c: true};\r\n\r\n// Invoked when attaching.\r\nfunction parser(options) {\r\n  var proc = this;\r\n  var LocalParser = proc.parser = unherit(Parser);\r\n  LocalParser.prototype.defaults = xtend(LocalParser.prototype.defaults, options);\r\n  LocalParser.prototype.processor = proc;\r\n}\r\n\r\n// Constructed just before parsing.\r\nfunction Parser(contents, file) {\r\n  // allow use without unified.\r\n  var settings = this.processor ? this.processor.data('settings') : {};\r\n  this.doc = contents;\r\n  this.file = file;\r\n  this.settings = xtend(this.defaults, settings);\r\n}\r\n\r\n// Constructed when parsing, with `this` as an instance of Parser.\r\nfunction parse() {\r\n  this.settings; //=> {a: true, b: true, c: true}\r\n  return this.start(); // ...or something\r\n}\r\n"}}
{"actor":{"display_login":"wooorm"}}