Select unist nodes using css-like selectors.
var select = require('unist-util-select');
select(ast, 'paragraph emphasis > text')
//=> array of nodes
- Type selectors:
paragraph
- Descendant selectors:
paragraph text
- Child selectors:
paragraph > text
- Sibling selectors:
paragraph ~ text
- Adjacent sibling selectors:
paragraph + text
- Group selectors:
paragraph, text
- Universal selector:
*
- Attribute selectors:
text[value*="substr"]
- Existence:
[value]
- Equality:
[value="foo"]
- Begins with:
[value^="prefix"]
- Containment:
[value*="substr"]
- Ends with:
[value$="suffix"]
- Existence:
Applies selector
to ast
, returns array of matching nodes.
npm install unist-util-select
MIT