mdast-zone
mdast-zone copied to clipboard
Pass attributes and parameters to the handler
Initial checklist
- [x] I read the support docs
- [x] I read the contributing guide
- [x] I agree to follow the code of conduct
- [x] I searched issues and discussions and couldn’t find anything (or linked relevant results below)
Problem
mdast-comment-marker parses extra parameters from the comment. It would be useful if handler receive these parameters in the Info:
E.g.:
<!-- foo start bar=42 -->
Foo
<!-- foo end -->
then in the handler:
zone(tree, 'foo', function (start, nodes, end, info) {
console.log(info.parameters); // { bar: 42 }
// ...
})
Current solutions
Parse the comment again.
Proposed solutions
Store info parameters in the scope and then pass to the handler.