|
19 | 19 | * [API](#api)
|
20 | 20 | * [`gfmTaskListItemFromMarkdown`](#gfmtasklistitemfrommarkdown)
|
21 | 21 | * [`gfmTaskListItemToMarkdown`](#gfmtasklistitemtomarkdown)
|
| 22 | +* [HTML](#html) |
| 23 | +* [Syntax](#syntax) |
22 | 24 | * [Syntax tree](#syntax-tree)
|
23 | 25 | * [Nodes](#nodes)
|
24 | 26 | * [Content model](#content-model)
|
|
30 | 32 |
|
31 | 33 | ## What is this?
|
32 | 34 |
|
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). |
36 | 42 |
|
37 | 43 | ## When to use this
|
38 | 44 |
|
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`. |
41 | 54 |
|
42 | 55 | When you are working with syntax trees and want all of GFM, use
|
43 | 56 | [`mdast-util-gfm`][mdast-util-gfm] instead.
|
44 | 57 |
|
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. |
47 | 61 |
|
48 | 62 | This utility does not handle how markdown is turned to HTML.
|
49 | 63 | That’s done by [`mdast-util-to-hast`][mdast-util-to-hast].
|
50 | 64 |
|
51 | 65 | ## Install
|
52 | 66 |
|
53 | 67 | 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][]: |
55 | 69 |
|
56 | 70 | ```sh
|
57 | 71 | npm install mdast-util-gfm-task-list-item
|
@@ -174,17 +188,29 @@ console.log(out)
|
174 | 188 |
|
175 | 189 | ## API
|
176 | 190 |
|
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]. |
179 | 194 | There is no default export.
|
180 | 195 |
|
181 | 196 | ### `gfmTaskListItemFromMarkdown`
|
182 | 197 |
|
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]). |
184 | 200 |
|
185 | 201 | ### `gfmTaskListItemToMarkdown`
|
186 | 202 |
|
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]. |
188 | 214 |
|
189 | 215 | ## Syntax tree
|
190 | 216 |
|
@@ -217,13 +243,13 @@ type ListContentGfm = ListItemGfm
|
217 | 243 | This package is fully typed with [TypeScript][].
|
218 | 244 | It does not export additional types.
|
219 | 245 |
|
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`. |
221 | 247 |
|
222 | 248 | ## Compatibility
|
223 | 249 |
|
224 | 250 | Projects maintained by the unified collective are compatible with all maintained
|
225 | 251 | 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+. |
227 | 253 | Our projects sometimes work with older versions, but this is not guaranteed.
|
228 | 254 |
|
229 | 255 | This plugin works with `mdast-util-from-markdown` version 1+ and
|
@@ -313,6 +339,18 @@ abide by its terms.
|
313 | 339 |
|
314 | 340 | [mdast-util-to-hast]: https://github.com/syntax-tree/mdast-util-to-hast
|
315 | 341 |
|
| 342 | +[micromark]: https://github.com/micromark/micromark |
| 343 | + |
316 | 344 | [extension]: https://github.com/micromark/micromark-extension-gfm-task-list-item
|
317 | 345 |
|
| 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 | + |
318 | 352 | [gfm]: https://github.github.com/gfm/
|
| 353 | + |
| 354 | +[api-gfmtasklistitemfrommarkdown]: #gfmtasklistitemfrommarkdown |
| 355 | + |
| 356 | +[api-gfmtasklistitemtomarkdown]: #gfmtasklistitemtomarkdown |
0 commit comments