{"_id":"mdast-util-gfm-task-list-item@2.0.1","bugs":{"url":"https://github.com/syntax-tree/mdast-util-gfm-task-list-item/issues"},"dist":{"shasum":"5d3b65f15563456ee88f5d7470da9808d4b8354d","tarball":"http://registry-npm.ywwl.com/mdast-util-gfm-task-list-item/download/mdast-util-gfm-task-list-item-2.0.1.tgz","fileCount":9,"integrity":"sha512-jXVO1hvB2hs82g1esi7I9nIJDqiijbQLIyH2jDUb5s7jIAZMr/79h0VHSq7XHKTqpLARRm+DDNjduB7S9+6XZA==","signatures":[{"sig":"MEUCIATrRTu2eK1s4ViRJCN6zQW9VJizBppchU1nZYh7c8m3AiEA5FdNY5mrKgAZl+7EnXTMK+s8mkbPVbHT28O89k01X50=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQDNHRXWsyaMFBj+kfHICoFRYgpuMgAZXax/vdXBsVhpjAIgLJupqF38Rbd02xPY0YZ01rOn3t5JsTbaWLMxZf4eLZQ="}],"unpackedSize":19413,"size":6089,"noattachment":false,"key":"/mdast-util-gfm-task-list-item/-/mdast-util-gfm-task-list-item-2.0.1.tgz"},"name":"mdast-util-gfm-task-list-item","type":"module","types":"./index.d.ts","author":{"url":"https://wooorm.com","name":"Titus Wormer","email":"tituswormer@gmail.com"},"exports":"./index.js","funding":{"url":"https://opencollective.com/unified","type":"opencollective"},"gitHead":"507bfd5aea1bf5908e45cd32257cb8d12a43c47c","license":"MIT","scripts":{"test":"npm run build && npm run format && npm run test-coverage","build":"tsc --build --clean && tsc --build && type-coverage","format":"remark --frail --output --quiet -- . && prettier --log-level warn --write -- . && xo --fix","prepack":"npm run build && npm run format","test-api":"npm run test-api-dev && npm run test-api-prod","test-api-dev":"node --conditions development test.js","test-api-prod":"node --conditions production test.js","test-coverage":"c8 --100 --reporter lcov -- npm run test-api"},"version":"2.0.1","_npmUser":{"name":"wooorm","email":"tituswormer@gmail.com"},"homepage":"https://github.com/syntax-tree/mdast-util-gfm-task-list-item#readme","keywords":["checkbox","check","gfm","item","list","markdown","markup","mdast-util","mdast","task","todo","unist","utility","util"],"prettier":{"semi":false,"useTabs":false,"tabWidth":2,"singleQuote":true,"trailingComma":"none","bracketSpacing":false},"repository":{"url":"git+https://github.com/syntax-tree/mdast-util-gfm-task-list-item.git","type":"git"},"_npmVersion":"12.2.2","description":"mdast extension to parse and serialize GFM task list items","directories":{},"maintainers":[{"name":"wooorm","email":"tituswormer@gmail.com"},{"name":"kmck","email":"keith@mcknig.ht"}],"sideEffects":false,"_nodeVersion":"26.12.1","contributors":[{"url":"https://wooorm.com","name":"Titus Wormer","email":"tituswormer@gmail.com"}],"dependencies":{"devlop":"^1.0.0","@types/mdast":"^4.0.0","mdast-util-to-markdown":"^2.0.0","mdast-util-from-markdown":"^2.0.0"},"remarkConfig":{"plugins":["remark-preset-wooorm"]},"typeCoverage":{"strict":true,"atLeast":100},"_hasShrinkwrap":false,"devDependencies":{"c8":"^12.0.0","xo":"^5.0.0","prettier":"^3.0.0","remark-cli":"^12.0.0","typescript":"^6.0.0","@types/node":"^26.0.0","type-coverage":"^2.0.0","remark-preset-wooorm":"^11.0.0","unist-util-remove-position":"^5.0.0","micromark-extension-gfm-task-list-item":"^2.0.0"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/mdast-util-gfm-task-list-item_2.0.1_1793966797458_0.19565075768014561"},"readme":"# mdast-util-gfm-task-list-item\n\n[![Build][badge-build-image]][badge-build-url]\n[![Coverage][badge-coverage-image]][badge-coverage-url]\n[![Downloads][badge-downloads-image]][badge-downloads-url]\n[![Size][badge-size-image]][badge-size-url]\n\n[mdast][github-mdast] extensions to parse and serialize [GFM][spec-gfm]\ntask list items.\n\n## Contents\n\n* [What is this?](#what-is-this)\n* [When to use this](#when-to-use-this)\n* [Install](#install)\n* [Use](#use)\n* [API](#api)\n  * [`gfmTaskListItemFromMarkdown()`](#gfmtasklistitemfrommarkdown)\n  * [`gfmTaskListItemToMarkdown()`](#gfmtasklistitemtomarkdown)\n* [HTML](#html)\n* [Syntax](#syntax)\n* [Syntax tree](#syntax-tree)\n  * [Nodes](#nodes)\n  * [Content model](#content-model)\n* [Types](#types)\n* [Compatibility](#compatibility)\n* [Related](#related)\n* [Contribute](#contribute)\n* [License](#license)\n\n## What is this?\n\nThis package contains two extensions that add support for GFM task list item\nsyntax in markdown to [mdast][github-mdast].\nThese extensions plug into\n[`mdast-util-from-markdown`][github-mdast-util-from-markdown]\n(to support parsing task lists in markdown into a syntax tree) and\n[`mdast-util-to-markdown`][github-mdast-util-to-markdown]\n(to support serializing task lists in syntax trees to markdown).\n\n## When to use this\n\nYou can use these extensions when you are working with\n`mdast-util-from-markdown` and `mdast-util-to-markdown` already.\n\nWhen working with `mdast-util-from-markdown`, you must combine this package\nwith\n[`micromark-extension-gfm-task-list-item`][github-extension].\n\nWhen you don’t need a syntax tree, you can use [`micromark`][github-micromark]\ndirectly with `micromark-extension-gfm-task-list-item`.\n\nWhen you are working with syntax trees and want all of GFM, use\n[`mdast-util-gfm`][github-mdast-util-gfm] instead.\n\nAll these packages are used in [`remark-gfm`][github-remark-gfm], which\nfocusses on making it easier to transform content by abstracting these\ninternals away.\n\nThis utility does not handle how markdown is turned to HTML.\nThat’s done by [`mdast-util-to-hast`][github-mdast-util-to-hast].\n\n## Install\n\nThis package is [ESM only][github-gist-esm].\nIn Node.js (version 16+),\ninstall with [npm][npmjs-install]:\n\n```sh\nnpm install mdast-util-gfm-task-list-item\n```\n\nIn browsers with [`esm.sh`][esmsh]:\n\n```html\n<script type=\"module\">\n  import {gfmTaskListItemFromMarkdown, gfmTaskListItemToMarkdown} from 'https://esm.sh/mdast-util-gfm-task-list-item@2?bundle'\n</script>\n```\n\n## Use\n\nSay our document `example.md` contains:\n\n```markdown\n* [ ] To do\n* [x] Done\n\n1. Mixed…\n2. [x] …messages\n```\n\n…and our module `example.js` looks as follows:\n\n```js\nimport fs from 'node:fs/promises'\nimport {gfmTaskListItem} from 'micromark-extension-gfm-task-list-item'\nimport {fromMarkdown} from 'mdast-util-from-markdown'\nimport {gfmTaskListItemFromMarkdown, gfmTaskListItemToMarkdown} from 'mdast-util-gfm-task-list-item'\nimport {toMarkdown} from 'mdast-util-to-markdown'\n\nconst doc = await fs.readFile('example.md')\n\nconst tree = fromMarkdown(doc, {\n  extensions: [gfmTaskListItem()],\n  mdastExtensions: [gfmTaskListItemFromMarkdown()]\n})\n\nconsole.log(tree)\n\nconst out = toMarkdown(tree, {extensions: [gfmTaskListItemToMarkdown()]})\n\nconsole.log(out)\n```\n\n…now running `node example.js` yields (positional info removed for brevity):\n\n```js\n{\n  type: 'root',\n  children: [\n    {\n      type: 'list',\n      ordered: false,\n      start: null,\n      spread: false,\n      children: [\n        {\n          type: 'listItem',\n          spread: false,\n          checked: false,\n          children: [\n            {type: 'paragraph', children: [{type: 'text', value: 'To do'}]}\n          ]\n        },\n        {\n          type: 'listItem',\n          spread: false,\n          checked: true,\n          children: [\n            {type: 'paragraph', children: [{type: 'text', value: 'Done'}]}\n          ]\n        }\n      ]\n    },\n    {\n      type: 'list',\n      ordered: true,\n      start: 1,\n      spread: false,\n      children: [\n        {\n          type: 'listItem',\n          spread: false,\n          checked: null,\n          children: [\n            {type: 'paragraph', children: [{type: 'text', value: 'Mixed…'}]}\n          ]\n        },\n        {\n          type: 'listItem',\n          spread: false,\n          checked: true,\n          children: [\n            {type: 'paragraph', children: [{type: 'text', value: '…messages'}]}\n          ]\n        }\n      ]\n    }\n  ]\n }\n```\n\n```markdown\n* [ ] To do\n* [x] Done\n\n1. Mixed…\n2. [x] …messages\n```\n\n## API\n\nThis package exports the identifiers\n[`gfmTaskListItemFromMarkdown`][api-gfm-task-list-item-from-markdown] and\n[`gfmTaskListItemToMarkdown`][api-gfm-task-list-item-to-markdown].\nThere is no default export.\n\n### `gfmTaskListItemFromMarkdown()`\n\nCreate an extension for\n[`mdast-util-from-markdown`][github-mdast-util-from-markdown]\nto enable GFM task list items in markdown.\n\n###### Returns\n\nExtension for `mdast-util-from-markdown` to enable GFM task list items\n([`FromMarkdownExtension`][github-mdast-util-from-markdown-extension]).\n\n### `gfmTaskListItemToMarkdown()`\n\nCreate an extension for\n[`mdast-util-to-markdown`][github-mdast-util-to-markdown]\nto enable GFM task list items in markdown.\n\n###### Returns\n\nExtension for `mdast-util-to-markdown` to enable GFM task list items\n([`ToMarkdownExtension`][github-mdast-util-to-markdown-options]).\n\n## HTML\n\nThis utility does not handle how markdown is turned to HTML.\nThat’s done by [`mdast-util-to-hast`][github-mdast-util-to-hast].\n\n## Syntax\n\nSee [Syntax in\n`micromark-extension-gfm-task-list-item`][github-extension-syntax].\n\n## Syntax tree\n\nThe following interfaces are added to **[mdast][github-mdast]** by this utility.\n\n### Nodes\n\n#### `ListItem` (GFM)\n\n```idl\ninterface ListItemGfm <: ListItem {\n  checked: boolean?\n}\n```\n\nIn GFM, a `checked` field can be present.\nIt represents whether the item is done (when `true`), not done (when `false`),\nor indeterminate or not applicable (when `null` or not present).\n\n### Content model\n\n#### `ListContent` (GFM)\n\n```idl\ntype ListContentGfm = ListItemGfm\n```\n\n## Types\n\nThis package is fully typed with [TypeScript][].\nIt does not export additional types.\n\nThe `ListItem` type of the mdast nodes are exposed from `@types/mdast`.\n\n## Compatibility\n\nProjects maintained by the unified collective are compatible with maintained\nversions of Node.js.\n\nWhen we cut a new major release,\nwe drop support for unmaintained versions of Node.\nThis means we try to keep the current release line,\n`mdast-util-gfm-task-list-item@2`,\ncompatible with Node.js 16.\n\nThis utility works with `mdast-util-from-markdown` version 2+ and\n`mdast-util-to-markdown` version 2+.\n\n## Related\n\n* [`remark-gfm`][github-remark-gfm]\n  — remark plugin to support GFM\n* [`mdast-util-gfm`][github-mdast-util-gfm]\n  — same but all of GFM (autolink literals, footnotes, strikethrough, tables,\n  tasklists)\n* [`micromark-extension-gfm-task-list-item`][github-extension]\n  — micromark extension to parse GFM task list items\n\n## Contribute\n\nSee\n[`contributing.md`][health-contributing]\nin\n[`syntax-tree/.github`][health]\nfor ways to get started.\nSee [`support.md`][health-support] for ways to get help.\n\nThis project has a [code of conduct][health-coc].\nBy interacting with this repository,\norganization,\nor community you agree to abide by its terms.\n\n## License\n\n[MIT][file-license] © [Titus Wormer][wooorm]\n\n<!-- Definitions -->\n\n[api-gfm-task-list-item-from-markdown]: #gfmtasklistitemfrommarkdown\n\n[api-gfm-task-list-item-to-markdown]: #gfmtasklistitemtomarkdown\n\n[badge-build-image]: https://github.com/syntax-tree/mdast-util-gfm-task-list-item/workflows/main/badge.svg\n\n[badge-build-url]: https://github.com/syntax-tree/mdast-util-gfm-task-list-item/actions\n\n[badge-coverage-image]: https://img.shields.io/codecov/c/github/syntax-tree/mdast-util-gfm-task-list-item.svg\n\n[badge-coverage-url]: https://codecov.io/github/syntax-tree/mdast-util-gfm-task-list-item\n\n[badge-downloads-image]: https://img.shields.io/npm/dm/mdast-util-gfm-task-list-item.svg\n\n[badge-downloads-url]: https://www.npmjs.com/package/mdast-util-gfm-task-list-item\n\n[badge-size-image]: https://img.shields.io/bundlejs/size/mdast-util-gfm-task-list-item\n\n[badge-size-url]: https://bundlejs.com/?q=mdast-util-gfm-task-list-item\n\n[esmsh]: https://esm.sh\n\n[file-license]: license\n\n[github-extension]: https://github.com/micromark/micromark-extension-gfm-task-list-item\n\n[github-extension-syntax]: https://github.com/micromark/micromark-extension-gfm-task-list-item#syntax\n\n[github-gist-esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c\n\n[github-mdast]: https://github.com/syntax-tree/mdast\n\n[github-mdast-util-from-markdown]: https://github.com/syntax-tree/mdast-util-from-markdown\n\n[github-mdast-util-from-markdown-extension]: https://github.com/syntax-tree/mdast-util-from-markdown#extension\n\n[github-mdast-util-gfm]: https://github.com/syntax-tree/mdast-util-gfm\n\n[github-mdast-util-to-hast]: https://github.com/syntax-tree/mdast-util-to-hast\n\n[github-mdast-util-to-markdown]: https://github.com/syntax-tree/mdast-util-to-markdown\n\n[github-mdast-util-to-markdown-options]: https://github.com/syntax-tree/mdast-util-to-markdown#options\n\n[github-micromark]: https://github.com/micromark/micromark\n\n[github-remark-gfm]: https://github.com/remarkjs/remark-gfm\n\n[health]: https://github.com/syntax-tree/.github\n\n[health-coc]: https://github.com/syntax-tree/.github/blob/main/code-of-conduct.md\n\n[health-contributing]: https://github.com/syntax-tree/.github/blob/main/contributing.md\n\n[health-support]: https://github.com/syntax-tree/.github/blob/main/support.md\n\n[npmjs-install]: https://docs.npmjs.com/cli/install\n\n[spec-gfm]: https://github.github.com/gfm/\n\n[typescript]: https://www.typescriptlang.org\n\n[wooorm]: https://wooorm.com\n","publish_time":1793966797571,"_cnpm_publish_time":1793966797571,"dist-tags":{"latest":"2.0.1"}}