8
8
[ ![ Backers] [ backers-badge ]] [ collective ]
9
9
[ ![ Chat] [ chat-badge ]] [ chat ]
10
10
11
- Check if an [ mdast] [ ] [ node] [ ] is [ phrasing content] [ phrasing ] .
11
+ [ mdast] [ ] utility to check if a node is phrasing content.
12
12
13
- ## Install
13
+ ## Contents
14
+
15
+ * [ What is this?] ( #what-is-this )
16
+ * [ When should I use this?] ( #when-should-i-use-this )
17
+ * [ Install] ( #install )
18
+ * [ Use] ( #use )
19
+ * [ API] ( #api )
20
+ * [ ` phrasing(node) ` ] ( #phrasingnode )
21
+ * [ Types] ( #types )
22
+ * [ Compatibility] ( #compatibility )
23
+ * [ Security] ( #security )
24
+ * [ Related] ( #related )
25
+ * [ Contribute] ( #contribute )
26
+ * [ License] ( #license )
27
+
28
+ ## What is this?
29
+
30
+ This package is a tiny utility to check that a given [ node] [ ] is [ phrasing
31
+ content] [ phrasing ] .
14
32
15
- This package is [ ESM only] ( https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c ) :
16
- Node 12+ is needed to use it and it must be ` import ` ed instead of ` require ` d.
33
+ ## When should I use this?
34
+
35
+ This utility is typically useful if you’re making other utilities.
36
+ It uses [ ` unist-util-is ` ] [ unist-util-is ] , which you can use for your own checks.
37
+
38
+ A different utility, [ ` hast-util-phrasing ` ] [ hast-util-phrasing ] , does the same
39
+ but on [ hast] [ ] .
40
+
41
+ ## Install
17
42
18
- [ npm] [ ] :
43
+ This package is [ ESM only] [ esm ] .
44
+ In Node.js (version 12.20+, 14.14+, or 16.0+), install with [ npm] [ ] :
19
45
20
46
``` sh
21
47
npm install mdast-util-phrasing
22
48
```
23
49
50
+ In Deno with [ ` esm.sh ` ] [ esmsh ] :
51
+
52
+ ``` js
53
+ import {phrasing } from ' https://esm.sh/mdast-util-phrasing@3'
54
+ ```
55
+
56
+ In browsers with [ ` esm.sh ` ] [ esmsh ] :
57
+
58
+ ``` html
59
+ <script type =" module" >
60
+ import {phrasing } from ' https://esm.sh/mdast-util-phrasing@3?bundle'
61
+ </script >
62
+ ```
63
+
24
64
## Use
25
65
26
66
``` js
27
67
import {phrasing } from ' mdast-util-phrasing'
28
68
29
- phrasing ({
30
- type: ' paragraph' ,
31
- children: [{type: ' text' , value: ' Alpha' }]
32
- }) // => false
69
+ phrasing ({type: ' paragraph' , children: [{type: ' text' , value: ' Alpha' }]})
70
+ // => false
33
71
34
- phrasing ({
35
- type: ' strong' ,
36
- children: [{type: ' text' , value: ' Delta' }]
37
- }) // => true
72
+ phrasing ({type: ' strong' , children: [{type: ' text' , value: ' Delta' }]})
73
+ // => true
38
74
```
39
75
40
76
## API
41
77
42
- This package exports the following identifiers: ` phrasing ` .
78
+ This package exports the identifier ` phrasing ` .
43
79
There is no default export.
44
80
45
81
### ` phrasing(node) `
46
82
47
- Check if the given value is a phrasing element .
83
+ Check if the given value ( ` unknown ` ) is phrasing content .
48
84
49
- ###### Parameters
85
+ ###### Returns
50
86
51
- ` node ` ( ` * ` ) — Value to check, typically a [ node ] [ ] .
87
+ Whether ` node ` is [ phrasing content ] [ phrasing ] ( ` boolean ` ) .
52
88
53
- ###### Returns
89
+ ## Types
90
+
91
+ This package is fully typed with [ TypeScript] [ ] .
92
+ It does not export extra types.
93
+
94
+ ## Compatibility
54
95
55
- ` boolean ` — whether ` node ` is [ phrasing content] [ phrasing ] .
96
+ Projects maintained by the unified collective are compatible with all maintained
97
+ versions of Node.js.
98
+ As of now, that is Node.js 12.20+, 14.14+, and 16.0+.
99
+ Our projects sometimes work with older versions, but this is not guaranteed.
56
100
57
101
## Security
58
102
59
- Use of ` mdast-util-phrasing ` does not involve [ ** hast** ] [ hast ] , user content,
60
- or change the tree, so there are no openings for
61
- [ cross-site scripting (XSS) ] [ xss ] attacks.
103
+ Use of ` mdast-util-phrasing ` does not involve ** [ hast] [ ] ** , user content, or
104
+ change the tree, so there are no openings for [ cross-site scripting (XSS) ] [ xss ]
105
+ attacks.
62
106
63
107
## Related
64
108
@@ -69,8 +113,8 @@ or change the tree, so there are no openings for
69
113
70
114
## Contribute
71
115
72
- See [ ` contributing.md ` in ` syntax-tree/.github ` ] [ contributing ] for ways to get
73
- started.
116
+ See [ ` contributing.md ` ] [ contributing ] in [ ` syntax-tree/.github ` ] [ health ] for
117
+ ways to get started.
74
118
See [ ` support.md ` ] [ support ] for ways to get help.
75
119
76
120
This project has a [ code of conduct] [ coc ] .
@@ -111,22 +155,34 @@ abide by its terms.
111
155
112
156
[ npm ] : https://docs.npmjs.com/cli/install
113
157
158
+ [ esm ] : https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c
159
+
160
+ [ esmsh ] : https://esm.sh
161
+
162
+ [ typescript ] : https://www.typescriptlang.org
163
+
114
164
[ license ] : license
115
165
116
166
[ author ] : https://draft.li
117
167
118
- [ contributing ] : https://github.com/syntax-tree/.github/blob/HEAD/contributing.md
168
+ [ health ] : https://github.com/syntax-tree/.github
119
169
120
- [ support ] : https://github.com/syntax-tree/.github/blob/HEAD/support .md
170
+ [ contributing ] : https://github.com/syntax-tree/.github/blob/main/contributing .md
121
171
122
- [ coc ] : https://github.com/syntax-tree/.github/blob/HEAD/code-of-conduct.md
172
+ [ support ] : https://github.com/syntax-tree/.github/blob/main/support.md
173
+
174
+ [ coc ] : https://github.com/syntax-tree/.github/blob/main/code-of-conduct.md
175
+
176
+ [ xss ] : https://en.wikipedia.org/wiki/Cross-site_scripting
177
+
178
+ [ hast ] : https://github.com/syntax-tree/hast
123
179
124
180
[ mdast ] : https://github.com/syntax-tree/mdast
125
181
126
182
[ node ] : https://github.com/syntax-tree/mdast#nodes
127
183
128
184
[ phrasing ] : https://github.com/syntax-tree/mdast#phrasingcontent
129
185
130
- [ xss ] : https://en.wikipedia.org/wiki/Cross-site_scripting
186
+ [ unist-util-is ] : https://github.com/syntax-tree/unist-util-is
131
187
132
- [ hast ] : https://github.com/syntax-tree/hast
188
+ [ hast-util-phrasing ] : https://github.com/syntax-tree/hast-util-phrasing
0 commit comments