Skip to content

Commit 5cdf41e

Browse files
committed
Refactor some docs
1 parent 69e189b commit 5cdf41e

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

readme.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
This package is a [unified][] ([rehype][]) plugin to format whitespace in HTML.
3535
In short, it works as follows:
3636

37-
* collapse all existing white space to either a line ending or a single space
37+
* collapse all existing whitespace to either a line ending or a single space
3838
* remove those spaces and line endings if they do not contribute to the
3939
document
4040
* inject needed line endings
@@ -104,11 +104,13 @@ import rehypeStringify from 'rehype-stringify'
104104
import {read} from 'to-vfile'
105105
import {unified} from 'unified'
106106

107-
const file = await unified()
107+
const file = await read('index.html')
108+
109+
await unified()
108110
.use(rehypeParse)
109111
.use(rehypeFormat)
110112
.use(rehypeStringify)
111-
.process(await read('index.html'))
113+
.process(file)
112114

113115
console.log(String(file))
114116
```
@@ -221,7 +223,7 @@ import {unified} from 'unified'
221223

222224
const file = await unified()
223225
.use(rehypeParse)
224-
.use(rehypeFormat, {blanks: ['head', 'body'], indent: '\t'})
226+
.use(rehypeFormat, {blanks: ['body', 'head'], indent: '\t'})
225227
.use(rehypeStringify)
226228
.process('<h1>Hi!</h1><p>Hello, Venus!</p>')
227229

@@ -260,16 +262,16 @@ versions of Node.js.
260262

261263
When we cut a new major release, we drop support for unmaintained versions of
262264
Node.
263-
This means we try to keep the current release line, `rehype-format@^5`,
265+
This means we try to keep the current release line, `rehype-format@5`,
264266
compatible with Node.js 16.
265267

266268
This plugin works with `rehype-parse` version 3+, `rehype-stringify` version 3+,
267269
`rehype` version 5+, and `unified` version 6+.
268270

269271
## Security
270272

271-
Use of `rehype-format` changes white space in the tree.
272-
White space in `<script>`, `<style>`, `<pre>`, or `<textarea>` is not modified.
273+
Use of `rehype-format` changes whitespace in the tree.
274+
Whitespace in `<script>`, `<style>`, `<pre>`, or `<textarea>` is not modified.
273275
If the tree is already safe, use of this plugin does not open you up for a
274276
[cross-site scripting (XSS)][xss] attack.
275277
When in doubt, use [`rehype-sanitize`][rehype-sanitize].

0 commit comments

Comments
 (0)