Skip to content

Commit 5a24bdf

Browse files
committed
Add improved docs
1 parent 495a182 commit 5a24bdf

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

lib/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ import {visit} from 'unist-util-visit'
2626
* Non-null finite integer to use to shift ranks.
2727
* @returns {T}
2828
* Given, modified, tree.
29+
* @throws
30+
* When `shift` is not a valid non-null finite integer.
2931
*/
3032
export function shiftHeading(tree, shift) {
3133
if (

readme.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ to get the rank of an element.
4242
## Install
4343

4444
This package is [ESM only][esm].
45-
In Node.js (version 12.20+, 14.14+, 16.0+, or 18.0+), install with [npm][]:
45+
In Node.js (version 14.14+ and 16.0+), install with [npm][]:
4646

4747
```sh
4848
npm install hast-util-shift-heading
@@ -122,7 +122,7 @@ Yields:
122122

123123
## API
124124

125-
This package exports the identifier `shiftHeading`.
125+
This package exports the identifier [`shiftHeading`][shiftheading].
126126
There is no default export.
127127

128128
### `shiftHeading(tree, shift)`
@@ -135,12 +135,12 @@ Caps the rank so that shifting would not create invalid headings (so no `h0` or
135135

136136
###### Parameters
137137

138-
* `tree` ([`Node`][node]) — tree to walk
138+
* `tree` ([`Node`][node]) — tree to change
139139
* `shift` (`number`) — non-null finite integer to use to shift ranks
140140

141141
###### Returns
142142

143-
The given, mutated, tree ([`Node`][node]).
143+
Given, modified, tree ([`Node`][node]).
144144

145145
###### Throws
146146

@@ -155,7 +155,7 @@ It exports no additional types.
155155

156156
Projects maintained by the unified collective are compatible with all maintained
157157
versions of Node.js.
158-
As of now, that is Node.js 12.20+, 14.14+, 16.0+, and 18.0+.
158+
As of now, that is Node.js 14.14+ and 16.0+.
159159
Our projects sometimes work with older versions, but this is not guaranteed.
160160

161161
## Security
@@ -240,3 +240,5 @@ abide by its terms.
240240
[hast-util-heading-rank]: https://github.com/syntax-tree/hast-util-heading-rank
241241

242242
[xss]: https://en.wikipedia.org/wiki/Cross-site_scripting
243+
244+
[shiftheading]: #shiftheadingtree-shift

0 commit comments

Comments
 (0)