Skip to content

Commit 638ee10

Browse files
committed
Add improved docs
1 parent 945959f commit 638ee10

File tree

1 file changed

+52
-14
lines changed

1 file changed

+52
-14
lines changed

readme.md

Lines changed: 52 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
* [API](#api)
2020
* [`gfmTaskListItemFromMarkdown`](#gfmtasklistitemfrommarkdown)
2121
* [`gfmTaskListItemToMarkdown`](#gfmtasklistitemtomarkdown)
22+
* [HTML](#html)
23+
* [Syntax](#syntax)
2224
* [Syntax tree](#syntax-tree)
2325
* [Nodes](#nodes)
2426
* [Content model](#content-model)
@@ -30,28 +32,40 @@
3032

3133
## What is this?
3234

33-
This package contains extensions that add support for the task list item syntax
34-
enabled by GFM to [`mdast-util-from-markdown`][mdast-util-from-markdown] and
35-
[`mdast-util-to-markdown`][mdast-util-to-markdown].
35+
This package contains two extensions that add support for GFM task list item
36+
syntax in markdown to [mdast][].
37+
These extensions plug into
38+
[`mdast-util-from-markdown`][mdast-util-from-markdown] (to support parsing
39+
task lists in markdown into a syntax tree) and
40+
[`mdast-util-to-markdown`][mdast-util-to-markdown] (to support serializing
41+
task lists in syntax trees to markdown).
3642

3743
## When to use this
3844

39-
These tools are all rather low-level.
40-
In most cases, you’d want to use [`remark-gfm`][remark-gfm] with remark instead.
45+
You can use these extensions when you are working with
46+
`mdast-util-from-markdown` and `mdast-util-to-markdown` already.
47+
48+
When working with `mdast-util-from-markdown`, you must combine this package
49+
with
50+
[`micromark-extension-gfm-task-list-item`][extension].
51+
52+
When you don’t need a syntax tree, you can use [`micromark`][micromark]
53+
directly with `micromark-extension-gfm-task-list-item`.
4154

4255
When you are working with syntax trees and want all of GFM, use
4356
[`mdast-util-gfm`][mdast-util-gfm] instead.
4457

45-
When working with `mdast-util-from-markdown`, you must combine this package with
46-
[`micromark-extension-gfm-task-list-item`][extension].
58+
All these packages are used [`remark-gfm`][remark-gfm], which
59+
focusses on making it easier to transform content by abstracting these
60+
internals away.
4761

4862
This utility does not handle how markdown is turned to HTML.
4963
That’s done by [`mdast-util-to-hast`][mdast-util-to-hast].
5064

5165
## Install
5266

5367
This package is [ESM only][esm].
54-
In Node.js (version 12.20+, 14.14+, or 16.0+), install with [npm][]:
68+
In Node.js (version 14.14+ and 16.0+), install with [npm][]:
5569

5670
```sh
5771
npm install mdast-util-gfm-task-list-item
@@ -174,17 +188,29 @@ console.log(out)
174188

175189
## API
176190

177-
This package exports the identifiers `gfmTaskListItemFromMarkdown` and
178-
`gfmTaskListItemToMarkdown`.
191+
This package exports the identifiers
192+
[`gfmTaskListItemFromMarkdown`][api-gfmtasklistitemfrommarkdown] and
193+
[`gfmTaskListItemToMarkdown`][api-gfmtasklistitemtomarkdown].
179194
There is no default export.
180195

181196
### `gfmTaskListItemFromMarkdown`
182197

183-
Extension for [`mdast-util-from-markdown`][mdast-util-from-markdown].
198+
Extension for [`mdast-util-from-markdown`][mdast-util-from-markdown]
199+
to enable GFM task lists ([`FromMarkdownExtension`][frommarkdownextension]).
184200

185201
### `gfmTaskListItemToMarkdown`
186202

187-
Extension for [`mdast-util-to-markdown`][mdast-util-to-markdown].
203+
Extension for [`mdast-util-to-markdown`][mdast-util-to-markdown]
204+
to enable GFM task lists ([`ToMarkdownExtension`][tomarkdownextension]).
205+
206+
## HTML
207+
208+
This utility does not handle how markdown is turned to HTML.
209+
That’s done by [`mdast-util-to-hast`][mdast-util-to-hast].
210+
211+
## Syntax
212+
213+
See [Syntax in `micromark-extension-gfm-task-list-item`][syntax].
188214

189215
## Syntax tree
190216

@@ -217,13 +243,13 @@ type ListContentGfm = ListItemGfm
217243
This package is fully typed with [TypeScript][].
218244
It does not export additional types.
219245

220-
The `ListItemGfm` node type is supported in `@types/mdast` by default.
246+
The `ListItem` type of the mdast nodes are exposed from `@types/mdast`.
221247

222248
## Compatibility
223249

224250
Projects maintained by the unified collective are compatible with all maintained
225251
versions of Node.js.
226-
As of now, that is Node.js 12.20+, 14.14+, and 16.0+.
252+
As of now, that is Node.js 14.14+ and 16.0+.
227253
Our projects sometimes work with older versions, but this is not guaranteed.
228254

229255
This plugin works with `mdast-util-from-markdown` version 1+ and
@@ -313,6 +339,18 @@ abide by its terms.
313339

314340
[mdast-util-to-hast]: https://github.com/syntax-tree/mdast-util-to-hast
315341

342+
[micromark]: https://github.com/micromark/micromark
343+
316344
[extension]: https://github.com/micromark/micromark-extension-gfm-task-list-item
317345

346+
[syntax]: https://github.com/micromark/micromark-extension-gfm-task-list-item#syntax
347+
348+
[frommarkdownextension]: https://github.com/syntax-tree/mdast-util-from-markdown#extension
349+
350+
[tomarkdownextension]: https://github.com/syntax-tree/mdast-util-to-markdown#options
351+
318352
[gfm]: https://github.github.com/gfm/
353+
354+
[api-gfmtasklistitemfrommarkdown]: #gfmtasklistitemfrommarkdown
355+
356+
[api-gfmtasklistitemtomarkdown]: #gfmtasklistitemtomarkdown

0 commit comments

Comments
 (0)