unified

Project: micromark/micromark-extension-gfm-task-list-item

Package: micromark-extension-gfm-task-list-item@1.0.0

  1. Dependents: 1
  2. micromark extension to support GFM task list items
  1. unified 173
  2. markdown 137
  3. micromark 32
  4. gfm 17
  5. micromark-extension 15
  6. list 12
  7. check 11
  8. item 6
  9. task 4
  10. checkbox 4
  11. todo 2

micromark-extension-gfm-task-list-item

Build Coverage Downloads Size Sponsors Backers Chat

micromark extension to support GitHub flavored markdown (GFM) task list items. This extension matches the GFM spec for the few things it defines and otherwise matches github.com.

When to use this

You should probably use micromark-extension-gfm instead, which combines this package with other GFM features. Alternatively, if you don’t want all of GFM, use this package.

Install

This package is ESM only: Node 12+ is needed to use it and it must be imported instead of required.

npm:

npm install micromark-extension-gfm-task-list-item

Use

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:

<ul>
<li><input checked="" disabled="" type="checkbox"> a</li>
<li><input disabled="" type="checkbox"> b</li>
</ul>

API

This package exports the following identifiers: gfmTaskListItem, gfmTaskListItemHtml. There is no default export.

The export map supports the endorsed development condition. Run node --conditions development module.js to get instrumented dev code. Without this condition, production code is loaded.

gfmTaskListItem

gfmTaskListItemHtml

Support task list items. An extension for micromark to parse checks (can be passed in extensions) and one to compile as <input> elements (can be passed in htmlExtensions).

Contribute

See contributing.md in micromark/.github for ways to get started. See support.md for ways to get help.

This project has a code of conduct. By interacting with this repository, organization, or community you agree to abide by its terms.

License

MIT © Titus Wormer