Skip to content

Commit a6b48ab

Browse files
committed
Refactor docs
1 parent 15b1618 commit a6b48ab

File tree

1 file changed

+32
-26
lines changed

1 file changed

+32
-26
lines changed

readme.md

Lines changed: 32 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ also serialize HTML at a higher-level (easier) abstraction.
5555
## Install
5656

5757
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][]:
5959

6060
```sh
6161
npm install hast-util-to-html
@@ -107,7 +107,7 @@ Yields:
107107

108108
## API
109109

110-
This package exports the identifier [`toHtml`][tohtml].
110+
This package exports the identifier [`toHtml`][api-to-html].
111111
There is no default export.
112112

113113
### `toHtml(tree[, options])`
@@ -118,7 +118,7 @@ Serialize hast as HTML.
118118

119119
* `tree` ([`Node`][node] or `Array<Node>`)
120120
— tree to serialize
121-
* `options` ([`Options`][options], optional)
121+
* `options` ([`Options`][api-options], optional)
122122
— configuration
123123

124124
###### Returns
@@ -136,14 +136,6 @@ How to serialize character references (TypeScript type).
136136
Prefer named character references (`&amp;`) where possible (`boolean`, default:
137137
`false`).
138138

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-
147139
###### `omitOptionalSemicolons`
148140

149141
Whether to omit semicolons when possible (`boolean`, default: `false`).
@@ -153,6 +145,14 @@ Whether to omit semicolons when possible (`boolean`, default: `false`).
153145
> Omitting semicolons is possible for certain named and numeric references in
154146
> some cases.
155147
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+
156156
### `Options`
157157

158158
Configuration (TypeScript type).
@@ -195,7 +195,7 @@ Use “bogus comments” instead of comments to save byes: `<?charlie>` instead
195195
###### `characterReferences`
196196

197197
Configure how to serialize character references
198-
([`CharacterReferences`][characterreferences], optional).
198+
([`CharacterReferences`][api-character-references], optional).
199199

200200
###### `closeEmptyElements`
201201

@@ -245,15 +245,15 @@ Not used in the SVG space.
245245

246246
###### `quote`
247247

248-
Preferred quote to use ([`Quote`][quote], default: `'"'`).
248+
Preferred quote to use ([`Quote`][api-quote], default: `'"'`).
249249

250250
###### `quoteSmart`
251251

252252
Use the other quote if that results in less bytes (`boolean`, default: `false`).
253253

254254
###### `space`
255255

256-
Which space the document is in ([`Space`][space], default: `'html'`).
256+
Which space the document is in ([`Space`][api-space], default: `'html'`).
257257

258258
When an `<svg>` element is found in the HTML space, this package already
259259
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.
341341
## Types
342342
343343
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].
346349
347350
## Compatibility
348351
349-
Projects maintained by the unified collective are compatible with all maintained
352+
Projects maintained by the unified collective are compatible with maintained
350353
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.
353359
354360
## Security
355361
@@ -390,9 +396,9 @@ abide by its terms.
390396
391397
[downloads]: https://www.npmjs.com/package/hast-util-to-html
392398
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
394400
395-
[size]: https://bundlephobia.com/result?p=hast-util-to-html
401+
[size]: https://bundlejs.com/?q=hast-util-to-html
396402
397403
[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg
398404
@@ -440,12 +446,12 @@ abide by its terms.
440446
441447
[xast]: https://github.com/syntax-tree/xast
442448
443-
[tohtml]: #tohtmltree-options
449+
[api-to-html]: #tohtmltree-options
444450
445-
[characterreferences]: #characterreferences
451+
[api-character-references]: #characterreferences
446452
447-
[options]: #options
453+
[api-options]: #options
448454
449-
[space]: #space-1
455+
[api-space]: #space-1
450456
451-
[quote]: #quote-1
457+
[api-quote]: #quote-1

0 commit comments

Comments
 (0)