3
3
[ ![ Build] [ build-badge ]] [ build ]
4
4
[ ![ Coverage] [ coverage-badge ]] [ coverage ]
5
5
[ ![ Downloads] [ downloads-badge ]] [ downloads ]
6
+ [ ![ Size] [ size-badge ]] [ size ]
7
+ [ ![ Sponsors] [ sponsors-badge ]] [ collective ]
8
+ [ ![ Backers] [ backers-badge ]] [ collective ]
6
9
[ ![ Chat] [ chat-badge ]] [ chat ]
7
10
8
- Parse a simple CSS selector to a [ HAST] [ ] node.
11
+ [ ** hast** ] [ hast ] utility to create an [ * element* ] [ element ] from a simple CSS
12
+ selector.
9
13
10
- ## Installation
14
+ ## Install
11
15
12
16
[ npm] [ ] :
13
17
14
- ``` bash
18
+ ``` sh
15
19
npm install hast-util-parse-selector
16
20
```
17
21
18
22
## Usage
19
23
20
- ``` javascript
24
+ ``` js
21
25
var parseSelector = require (' hast-util-parse-selector' )
22
26
23
27
console .log (parseSelector (' .quux#bar.baz.qux' ))
@@ -36,13 +40,14 @@ Yields:
36
40
37
41
### ` parseSelector([selector][, defaultTagName]) `
38
42
39
- Parse a CSS ` selector ` to a [ HAST ] [ ] node.
43
+ Create an [ * element * ] [ element ] [ * node* ] [ node ] from a simple CSS selector .
40
44
41
45
###### ` selector `
42
46
43
47
` string ` , optional — Can contain a tag-name (` foo ` ), classes (` .bar ` ),
44
- and an ID (` #baz ` ). Multiple classes are allowed. Uses the last ID if
45
- multiple IDs are found.
48
+ and an ID (` #baz ` ).
49
+ Multiple classes are allowed.
50
+ Uses the last ID if multiple IDs are found.
46
51
47
52
###### ` defaultTagName `
48
53
@@ -51,15 +56,17 @@ specify one.
51
56
52
57
###### Returns
53
58
54
- [ ` Node ` ] [ hast ] .
59
+ [ ` Element ` ] [ element ] .
55
60
56
61
## Contribute
57
62
58
- See [ ` contributing.md ` in ` syntax-tree/hast ` ] [ contributing ] for ways to get
63
+ See [ ` contributing.md ` in ` syntax-tree/.github ` ] [ contributing ] for ways to get
59
64
started.
65
+ See [ ` support.md ` ] [ support ] for ways to get help.
60
66
61
- This organisation has a [ Code of Conduct] [ coc ] . By interacting with this
62
- repository, organisation, or community you agree to abide by its terms.
67
+ This project has a [ Code of Conduct] [ coc ] .
68
+ By interacting with this repository, organisation, or community you agree to
69
+ abide by its terms.
63
70
64
71
## License
65
72
@@ -79,18 +86,34 @@ repository, organisation, or community you agree to abide by its terms.
79
86
80
87
[ downloads ] : https://www.npmjs.com/package/hast-util-parse-selector
81
88
89
+ [ size-badge ] : https://img.shields.io/bundlephobia/minzip/hast-util-parse-selector.svg
90
+
91
+ [ size ] : https://bundlephobia.com/result?p=hast-util-parse-selector
92
+
93
+ [ sponsors-badge ] : https://opencollective.com/unified/sponsors/badge.svg
94
+
95
+ [ backers-badge ] : https://opencollective.com/unified/backers/badge.svg
96
+
97
+ [ collective ] : https://opencollective.com/unified
98
+
82
99
[ chat-badge ] : https://img.shields.io/badge/join%20the%20community-on%20spectrum-7b16ff.svg
83
100
84
- [ chat ] : https://spectrum.chat/unified/rehype
101
+ [ chat ] : https://spectrum.chat/unified/syntax-tree
85
102
86
103
[ npm ] : https://docs.npmjs.com/cli/install
87
104
88
105
[ license ] : license
89
106
90
107
[ author ] : https://wooorm.com
91
108
109
+ [ contributing ] : https://github.com/syntax-tree/.github/blob/master/contributing.md
110
+
111
+ [ support ] : https://github.com/syntax-tree/.github/blob/master/support.md
112
+
113
+ [ coc ] : https://github.com/syntax-tree/.github/blob/master/code-of-conduct.md
114
+
92
115
[ hast ] : https://github.com/syntax-tree/hast
93
116
94
- [ contributing ] : https://github.com/syntax-tree/hast/blob/master/contributing.md
117
+ [ node ] : https://github.com/syntax-tree/hast#nodes
95
118
96
- [ coc ] : https://github.com/syntax-tree/hast/blob/master/code-of-conduct.md
119
+ [ element ] : https://github.com/syntax-tree/hast#element
0 commit comments