Skip to content

Commit 703eb24

Browse files
committed
Add improved docs
1 parent 44dd767 commit 703eb24

File tree

1 file changed

+67
-17
lines changed

1 file changed

+67
-17
lines changed

readme.md

Lines changed: 67 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,50 @@
88
[![Backers][backers-badge]][collective]
99
[![Chat][chat-badge]][chat]
1010

11-
[**hast**][hast] utility to check if an [*element*][element] is a
12-
[*heading*][spec].
11+
[hast][] utility to check if a node is a [*heading*][spec].
1312

14-
## Install
13+
## Contents
14+
15+
* [When should I use this?](#when-should-i-use-this)
16+
* [Install](#install)
17+
* [Use](#use)
18+
* [API](#api)
19+
* [`heading(node)`](#headingnode)
20+
* [Types](#types)
21+
* [Compatibility](#compatibility)
22+
* [Security](#security)
23+
* [Related](#related)
24+
* [Contribute](#contribute)
25+
* [License](#license)
26+
27+
## When should I use this?
1528

16-
This package is [ESM only](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c):
17-
Node 12+ is needed to use it and it must be `import`ed instead of `require`d.
29+
This utility is super niche, if you’re here you probably know what you’re
30+
looking for!
31+
32+
## Install
1833

19-
[npm][]:
34+
This package is [ESM only][esm].
35+
In Node.js (version 12.20+, 14.14+, 16.0+, or 18.0+), install with [npm][]:
2036

2137
```sh
2238
npm install hast-util-heading
2339
```
2440

41+
In Deno with [`esm.sh`][esmsh]:
42+
43+
```js
44+
import {heading} from 'https://esm.sh/hast-util-heading@2'
45+
```
46+
47+
In browsers with [`esm.sh`][esmsh]:
48+
49+
```html
50+
<script type="module">
51+
import {heading} from 'https://esm.sh/hast-util-heading@2?bundle'
52+
</script>
53+
```
54+
2555
## Use
2656

2757
```js
@@ -45,13 +75,25 @@ heading({
4575

4676
## API
4777

48-
This package exports the following identifiers: `heading`.
78+
This package exports the identifier `heading`.
4979
There is no default export.
5080

5181
### `heading(node)`
5282

5383
Check if the given value is a [*heading*][spec] [*element*][element].
5484

85+
## Types
86+
87+
This package is fully typed with [TypeScript][].
88+
It exports no additional types.
89+
90+
## Compatibility
91+
92+
Projects maintained by the unified collective are compatible with all maintained
93+
versions of Node.js.
94+
As of now, that is Node.js 12.20+, 14.14+, 16.0+, and 18.0+.
95+
Our projects sometimes work with older versions, but this is not guaranteed.
96+
5597
## Security
5698

5799
`hast-util-heading` does not change the syntax tree so there are no openings for
@@ -67,19 +109,19 @@ Check if the given value is a [*heading*][spec] [*element*][element].
67109
— check if a node is a (certain) element
68110
* [`hast-util-has-property`](https://github.com/syntax-tree/hast-util-has-property)
69111
— check if a node has a property
70-
* [`hast-util-is-body-ok-link`](https://github.com/rehypejs/rehype-minify/tree/HEAD/packages/hast-util-is-body-ok-link)
112+
* [`hast-util-is-body-ok-link`](https://github.com/rehypejs/rehype-minify/tree/main/packages/hast-util-is-body-ok-link)
71113
— check if a node is “Body OK” link element
72-
* [`hast-util-is-conditional-comment`](https://github.com/rehypejs/rehype-minify/tree/HEAD/packages/hast-util-is-conditional-comment)
114+
* [`hast-util-is-conditional-comment`](https://github.com/rehypejs/rehype-minify/tree/main/packages/hast-util-is-conditional-comment)
73115
— check if a node is a conditional comment
74-
* [`hast-util-is-css-link`](https://github.com/rehypejs/rehype-minify/tree/HEAD/packages/hast-util-is-css-link)
116+
* [`hast-util-is-css-link`](https://github.com/rehypejs/rehype-minify/tree/main/packages/hast-util-is-css-link)
75117
— check if a node is a CSS link element
76-
* [`hast-util-is-css-style`](https://github.com/rehypejs/rehype-minify/tree/HEAD/packages/hast-util-is-css-style)
118+
* [`hast-util-is-css-style`](https://github.com/rehypejs/rehype-minify/tree/main/packages/hast-util-is-css-style)
77119
— check if a node is a CSS style element
78120
* [`hast-util-embedded`](https://github.com/syntax-tree/hast-util-embedded)
79121
— check if a node is an embedded element
80122
* [`hast-util-interactive`](https://github.com/syntax-tree/hast-util-interactive)
81123
— check if a node is interactive
82-
* [`hast-util-is-javascript`](https://github.com/rehypejs/rehype-minify/tree/HEAD/packages/hast-util-is-javascript)
124+
* [`hast-util-is-javascript`](https://github.com/rehypejs/rehype-minify/tree/main/packages/hast-util-is-javascript)
83125
— check if a node is a JavaScript script element
84126
* [`hast-util-labelable`](https://github.com/syntax-tree/hast-util-labelable)
85127
— check whether a node is labelable
@@ -96,8 +138,8 @@ Check if the given value is a [*heading*][spec] [*element*][element].
96138

97139
## Contribute
98140

99-
See [`contributing.md` in `syntax-tree/.github`][contributing] for ways to get
100-
started.
141+
See [`contributing.md`][contributing] in [`syntax-tree/.github`][health] for
142+
ways to get started.
101143
See [`support.md`][support] for ways to get help.
102144

103145
This project has a [code of conduct][coc].
@@ -138,15 +180,23 @@ abide by its terms.
138180

139181
[npm]: https://docs.npmjs.com/cli/install
140182

183+
[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c
184+
185+
[esmsh]: https://esm.sh
186+
187+
[typescript]: https://www.typescriptlang.org
188+
141189
[license]: license
142190

143191
[author]: https://wooorm.com
144192

145-
[contributing]: https://github.com/syntax-tree/.github/blob/HEAD/contributing.md
193+
[health]: https://github.com/syntax-tree/.github
194+
195+
[contributing]: https://github.com/syntax-tree/.github/blob/main/contributing.md
146196

147-
[support]: https://github.com/syntax-tree/.github/blob/HEAD/support.md
197+
[support]: https://github.com/syntax-tree/.github/blob/main/support.md
148198

149-
[coc]: https://github.com/syntax-tree/.github/blob/HEAD/code-of-conduct.md
199+
[coc]: https://github.com/syntax-tree/.github/blob/main/code-of-conduct.md
150200

151201
[spec]: https://html.spec.whatwg.org/#heading-content
152202

0 commit comments

Comments
 (0)