@@ -55,7 +55,7 @@ also serialize HTML at a higher-level (easier) abstraction.
55
55
## Install
56
56
57
57
This package is [ ESM only] [ esm ] .
58
- In Node.js (version 14.14+ and 16.0 +), install with [ npm] [ ] :
58
+ In Node.js (version 16 +), install with [ npm] [ ] :
59
59
60
60
``` sh
61
61
npm install hast-util-to-html
@@ -107,7 +107,7 @@ Yields:
107
107
108
108
## API
109
109
110
- This package exports the identifier [ ` toHtml ` ] [ tohtml ] .
110
+ This package exports the identifier [ ` toHtml ` ] [ api-to-html ] .
111
111
There is no default export.
112
112
113
113
### ` toHtml(tree[, options]) `
@@ -118,7 +118,7 @@ Serialize hast as HTML.
118
118
119
119
* ` tree ` ([ ` Node ` ] [ node ] or ` Array<Node> ` )
120
120
— tree to serialize
121
- * ` options ` ([ ` Options ` ] [ options ] , optional)
121
+ * ` options ` ([ ` Options ` ] [ api- options] , optional)
122
122
— configuration
123
123
124
124
###### Returns
@@ -136,14 +136,6 @@ How to serialize character references (TypeScript type).
136
136
Prefer named character references (` & ` ) where possible (` boolean ` , default:
137
137
` false ` ).
138
138
139
- ###### ` useShortestReferences `
140
-
141
- Prefer the shortest possible reference, if that results in less bytes
142
- (` boolean ` , default: ` false ` ).
143
-
144
- > ⚠️ ** Note** : ` useNamedReferences ` can be omitted when using
145
- > ` useShortestReferences ` .
146
-
147
139
###### ` omitOptionalSemicolons `
148
140
149
141
Whether to omit semicolons when possible (` boolean ` , default: ` false ` ).
@@ -153,6 +145,14 @@ Whether to omit semicolons when possible (`boolean`, default: `false`).
153
145
> Omitting semicolons is possible for certain named and numeric references in
154
146
> some cases.
155
147
148
+ ###### ` useShortestReferences `
149
+
150
+ Prefer the shortest possible reference, if that results in less bytes
151
+ (` boolean ` , default: ` false ` ).
152
+
153
+ > ⚠️ ** Note** : ` useNamedReferences ` can be omitted when using
154
+ > ` useShortestReferences ` .
155
+
156
156
### ` Options `
157
157
158
158
Configuration (TypeScript type).
@@ -195,7 +195,7 @@ Use “bogus comments” instead of comments to save byes: `<?charlie>` instead
195
195
###### ` characterReferences `
196
196
197
197
Configure how to serialize character references
198
- ([ ` CharacterReferences ` ] [ characterreferences ] , optional).
198
+ ([ ` CharacterReferences ` ] [ api-character-references ] , optional).
199
199
200
200
###### ` closeEmptyElements `
201
201
@@ -245,15 +245,15 @@ Not used in the SVG space.
245
245
246
246
###### ` quote `
247
247
248
- Preferred quote to use ([ ` Quote ` ] [ quote ] , default: ` '"' ` ).
248
+ Preferred quote to use ([ ` Quote ` ] [ api- quote] , default: ` '"' ` ).
249
249
250
250
###### ` quoteSmart `
251
251
252
252
Use the other quote if that results in less bytes (` boolean ` , default: ` false ` ).
253
253
254
254
###### ` space `
255
255
256
- Which space the document is in ([ ` Space ` ] [ space ] , default: ` 'html' ` ).
256
+ Which space the document is in ([ ` Space ` ] [ api- space] , default: ` 'html' ` ).
257
257
258
258
When an ` <svg> ` element is found in the HTML space, this package already
259
259
automatically switches to and from the SVG space when entering and exiting it.
@@ -341,15 +341,21 @@ followed by browsers such as Chrome and Firefox.
341
341
## Types
342
342
343
343
This package is fully typed with [TypeScript][].
344
- It exports the additional types [ ` CharacterReferences ` ][characterreferences],
345
- [ ` Options ` ][options], [ ` Quote ` ][quote], and [ ` Space ` ][space].
344
+ It exports the additional types
345
+ [ ` CharacterReferences ` ][api-character-references],
346
+ [ ` Options ` ][api-options],
347
+ [ ` Quote ` ][api-quote], and
348
+ [ ` Space ` ][api-space].
346
349
347
350
## Compatibility
348
351
349
- Projects maintained by the unified collective are compatible with all maintained
352
+ Projects maintained by the unified collective are compatible with maintained
350
353
versions of Node.js.
351
- As of now, that is Node.js 14.14+ and 16.0+.
352
- Our projects sometimes work with older versions, but this is not guaranteed.
354
+
355
+ When we cut a new major release, we drop support for unmaintained versions of
356
+ Node.
357
+ This means we try to keep the current release line, ` hast -util -to -html @^8 ` ,
358
+ compatible with Node.js 12.
353
359
354
360
## Security
355
361
@@ -390,9 +396,9 @@ abide by its terms.
390
396
391
397
[downloads]: https://www.npmjs.com/package/hast-util-to-html
392
398
393
- [size-badge]: https://img.shields.io/bundlephobia/minzip/ hast-util-to-html.svg
399
+ [size-badge]: https://img.shields.io/badge/dynamic/json?label=minzipped%20size&query=$.size.compressedSize&url=https://deno.bundlejs.com/?q= hast-util-to-html
394
400
395
- [size]: https://bundlephobia .com/result?p =hast-util-to-html
401
+ [size]: https://bundlejs .com/?q =hast-util-to-html
396
402
397
403
[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg
398
404
@@ -440,12 +446,12 @@ abide by its terms.
440
446
441
447
[xast]: https://github.com/syntax-tree/xast
442
448
443
- [tohtml ]: #tohtmltree-options
449
+ [api-to-html ]: #tohtmltree-options
444
450
445
- [characterreferences ]: #characterreferences
451
+ [api-character-references ]: #characterreferences
446
452
447
- [options]: #options
453
+ [api- options]: #options
448
454
449
- [space]: #space-1
455
+ [api- space]: #space-1
450
456
451
- [quote]: #quote-1
457
+ [api- quote]: #quote-1
0 commit comments