Gathering detailed insights and metrics for mdast-util-gfm-task-list-item
Gathering detailed insights and metrics for mdast-util-gfm-task-list-item
Gathering detailed insights and metrics for mdast-util-gfm-task-list-item
Gathering detailed insights and metrics for mdast-util-gfm-task-list-item
mdast extension to parse and serialize GFM task list items
npm install mdast-util-gfm-task-list-item
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
5 Stars
62 Commits
2 Forks
9 Watching
1 Branches
11 Contributors
Updated on 17 Feb 2024
JavaScript (100%)
Cumulative downloads
Total Downloads
Last day
-5.8%
712,288
Compared to previous day
Last week
4.1%
4,095,545
Compared to previous week
Last month
11.5%
16,817,470
Compared to previous month
Last year
96.3%
159,580,291
Compared to previous year
mdast extensions to parse and serialize GFM task list items.
This package contains two extensions that add support for GFM task list item
syntax in markdown to mdast.
These extensions plug into
mdast-util-from-markdown
(to support parsing
task lists in markdown into a syntax tree) and
mdast-util-to-markdown
(to support serializing
task lists in syntax trees to markdown).
You can use these extensions when you are working with
mdast-util-from-markdown
and mdast-util-to-markdown
already.
When working with mdast-util-from-markdown
, you must combine this package
with
micromark-extension-gfm-task-list-item
.
When you don’t need a syntax tree, you can use micromark
directly with micromark-extension-gfm-task-list-item
.
When you are working with syntax trees and want all of GFM, use
mdast-util-gfm
instead.
All these packages are used remark-gfm
, which
focusses on making it easier to transform content by abstracting these
internals away.
This utility does not handle how markdown is turned to HTML.
That’s done by mdast-util-to-hast
.
This package is ESM only. In Node.js (version 16+), install with npm:
1npm install mdast-util-gfm-task-list-item
In Deno with esm.sh
:
1import {gfmTaskListItemFromMarkdown, gfmTaskListItemToMarkdown} from 'https://esm.sh/mdast-util-gfm-task-list-item@2'
In browsers with esm.sh
:
1<script type="module"> 2 import {gfmTaskListItemFromMarkdown, gfmTaskListItemToMarkdown} from 'https://esm.sh/mdast-util-gfm-task-list-item@2?bundle' 3</script>
Say our document example.md
contains:
1* [ ] To do 2* [x] Done 3 41. Mixed… 52. [x] …messages
…and our module example.js
looks as follows:
1import fs from 'node:fs/promises' 2import {gfmTaskListItem} from 'micromark-extension-gfm-task-list-item' 3import {fromMarkdown} from 'mdast-util-from-markdown' 4import {gfmTaskListItemFromMarkdown, gfmTaskListItemToMarkdown} from 'mdast-util-gfm-task-list-item' 5import {toMarkdown} from 'mdast-util-to-markdown' 6 7const doc = await fs.readFile('example.md') 8 9const tree = fromMarkdown(doc, { 10 extensions: [gfmTaskListItem()], 11 mdastExtensions: [gfmTaskListItemFromMarkdown()] 12}) 13 14console.log(tree) 15 16const out = toMarkdown(tree, {extensions: [gfmTaskListItemToMarkdown()]}) 17 18console.log(out)
…now running node example.js
yields (positional info removed for brevity):
1{ 2 type: 'root', 3 children: [ 4 { 5 type: 'list', 6 ordered: false, 7 start: null, 8 spread: false, 9 children: [ 10 { 11 type: 'listItem', 12 spread: false, 13 checked: false, 14 children: [ 15 {type: 'paragraph', children: [{type: 'text', value: 'To do'}]} 16 ] 17 }, 18 { 19 type: 'listItem', 20 spread: false, 21 checked: true, 22 children: [ 23 {type: 'paragraph', children: [{type: 'text', value: 'Done'}]} 24 ] 25 } 26 ] 27 }, 28 { 29 type: 'list', 30 ordered: true, 31 start: 1, 32 spread: false, 33 children: [ 34 { 35 type: 'listItem', 36 spread: false, 37 checked: null, 38 children: [ 39 {type: 'paragraph', children: [{type: 'text', value: 'Mixed…'}]} 40 ] 41 }, 42 { 43 type: 'listItem', 44 spread: false, 45 checked: true, 46 children: [ 47 {type: 'paragraph', children: [{type: 'text', value: '…messages'}]} 48 ] 49 } 50 ] 51 } 52 ] 53}
1* [ ] To do 2* [x] Done 3 41. Mixed… 52. [x] …messages
This package exports the identifiers
gfmTaskListItemFromMarkdown
and
gfmTaskListItemToMarkdown
.
There is no default export.
gfmTaskListItemFromMarkdown()
Create an extension for mdast-util-from-markdown
to enable GFM task list items in markdown.
Extension for mdast-util-from-markdown
to enable GFM task list items
(FromMarkdownExtension
).
gfmTaskListItemToMarkdown()
Create an extension for mdast-util-to-markdown
to
enable GFM task list items in markdown.
Extension for mdast-util-to-markdown
to enable GFM task list items
(ToMarkdownExtension
).
This utility does not handle how markdown is turned to HTML.
That’s done by mdast-util-to-hast
.
See Syntax in micromark-extension-gfm-task-list-item
.
The following interfaces are added to mdast by this utility.
ListItem
(GFM)1interface ListItemGfm <: ListItem { 2 checked: boolean? 3}
In GFM, a checked
field can be present.
It represents whether the item is done (when true
), not done (when false
),
or indeterminate or not applicable (when null
or not present).
ListContent
(GFM)1type ListContentGfm = ListItemGfm
This package is fully typed with TypeScript. It does not export additional types.
The ListItem
type of the mdast nodes are exposed from @types/mdast
.
Projects maintained by the unified collective are compatible with maintained versions of Node.js.
When we cut a new major release, we drop support for unmaintained versions of
Node.
This means we try to keep the current release line,
mdast-util-gfm-task-list-item@^2
, compatible with Node.js 16.
remarkjs/remark-gfm
— remark plugin to support GFMsyntax-tree/mdast-util-gfm
— same but all of GFM (autolink literals, footnotes, strikethrough, tables,
tasklists)micromark/micromark-extension-gfm-task-list-item
— micromark extension to parse GFM task list itemsSee contributing.md
in syntax-tree/.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.
MIT © Titus Wormer
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
security policy file detected
Details
Reason
Found 1/30 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2024-11-18
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn Moremdast-util-gfm-strikethrough
mdast extension to parse and serialize GFM strikethrough
mdast-util-gfm
mdast extension to parse and serialize GFM (GitHub Flavored Markdown)
mdast-util-gfm-table
mdast extension to parse and serialize GFM tables
mdast-util-gfm-autolink-literal
mdast extension to parse and serialize GFM autolink literals