# micromark-extension-gfm-task-list-item
[![Build][build-badge]][build]
[![Coverage][coverage-badge]][coverage]
[![Downloads][downloads-badge]][downloads]
[![Size][size-badge]][size]
[![Sponsors][sponsors-badge]][collective]
[![Backers][backers-badge]][collective]
[![Chat][chat-badge]][chat]
[micromark][] extensions to support GFM [task list items][].
## Contents
* [What is this?](#what-is-this)
* [When to use this](#when-to-use-this)
* [Install](#install)
* [Use](#use)
* [API](#api)
* [`gfmTaskListItem()`](#gfmtasklistitem)
* [`gfmTaskListItemHtml()`](#gfmtasklistitemhtml)
* [Authoring](#authoring)
* [HTML](#html)
* [CSS](#css)
* [Syntax](#syntax)
* [Types](#types)
* [Compatibility](#compatibility)
* [Security](#security)
* [Related](#related)
* [Contribute](#contribute)
* [License](#license)
## What is this?
This package contains extensions that add support for task lists as enabled by
GFM to [`micromark`][micromark].
It matches how task list items work on `github.com`.
## When to use this
This project is useful when you want to support task lists in markdown.
You can use these extensions when you are working with [`micromark`][micromark].
To support all GFM features, use
[`micromark-extension-gfm`][micromark-extension-gfm].
When you need a syntax tree, you can combine this package with
[`mdast-util-gfm-task-list-item`][mdast-util-gfm-task-list-item].
All these packages are used [`remark-gfm`][remark-gfm], which focusses on making
it easier to transform content by abstracting these internals away.
## Install
This package is [ESM only][esm].
In Node.js (version 16+), install with [npm][]:
```sh
npm install micromark-extension-gfm-task-list-item
```
In Deno with [`esm.sh`][esmsh]:
```js
import {gfmTaskListItem, gfmTaskListItemHtml} from 'https://esm.sh/micromark-extension-gfm-task-list-item@2'
```
In browsers with [`esm.sh`][esmsh]:
```html
```
## Use
```js
import {micromark} from 'micromark'
import {
gfmTaskListItem,
gfmTaskListItemHtml
} from 'micromark-extension-gfm-task-list-item'
const output = micromark('* [x] a\n* [ ] b', {
extensions: [gfmTaskListItem()],
htmlExtensions: [gfmTaskListItemHtml()]
})
console.log(output)
```
Yields:
```html
a
b
```
## API
This package exports the identifiers [`gfmTaskListItem`][api-gfm-task-list-item]
and [`gfmTaskListItemHtml`][api-gfm-task-list-item-html].
There is no default export.
The export map supports the [`development` condition][development].
Run `node --conditions development module.js` to get instrumented dev code.
Without this condition, production code is loaded.
### `gfmTaskListItem()`
Create an HTML extension for `micromark` to support GFM task list items
syntax.
###### Returns
Extension for `micromark` that can be passed in `extensions`, to enable GFM
task list items syntax ([`Extension`][micromark-extension]).
### `gfmTaskListItemHtml()`
Create an HTML extension for `micromark` to support GFM task list items when
serializing to HTML.
###### Returns
Extension for `micromark` that can be passed in `htmlExtensions` to support GFM
task list items when serializing to HTML
([`HtmlExtension`][micromark-html-extension]).
## Authoring
It is recommended to use lowercase `x` (instead of uppercase `X`), because in
markdown, it is more common to use lowercase in places where casing does not
matter.
It is also recommended to use a space (instead of a tab), as there is no benefit
of using tabs in this case.
## HTML
Checks relate to the `` element, in the checkbox state (`type=checkbox`),
in HTML.
See [*§ 4.10.5.1.15 Checkbox state (`type=checkbox`)*][html-input-checkbox]
in the HTML spec for more info.
```html