micromark extension to support GFM task list items
Installations
npm install micromark-extension-gfm-task-list-item
Developer Guide
Typescript
Yes
Module System
ESM
Node Version
22.0.0
NPM Version
10.8.1
Score
99
Supply Chain
99.5
Quality
76.7
Maintenance
100
Vulnerability
100
License
Releases
Contributors
Unable to fetch Contributors
Languages
JavaScript (100%)
Developer
Download Statistics
Total Downloads
306,671,962
Last Day
292,445
Last Week
1,818,510
Last Month
14,787,107
Last Year
166,646,697
GitHub Statistics
7 Stars
83 Commits
1 Forks
7 Watching
1 Branches
12 Contributors
Bundle Size
1.75 kB
Minified
756.00 B
Minified + Gzipped
Sponsor this package
Package Meta Information
Latest Version
2.1.0
Package Id
micromark-extension-gfm-task-list-item@2.1.0
Unpacked Size
23.84 kB
Size
6.44 kB
File Count
15
NPM Version
10.8.1
Node Version
22.0.0
Publised On
05 Jul 2024
Total Downloads
Cumulative downloads
Total Downloads
306,671,962
Last day
-11.9%
292,445
Compared to previous day
Last week
-44.3%
1,818,510
Compared to previous week
Last month
-5.6%
14,787,107
Compared to previous month
Last year
92.6%
166,646,697
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
micromark-extension-gfm-task-list-item
micromark extensions to support GFM task list items.
Contents
- What is this?
- When to use this
- Install
- Use
- API
- Authoring
- HTML
- CSS
- Syntax
- Types
- Compatibility
- Security
- Related
- Contribute
- License
What is this?
This package contains extensions that add support for task lists as enabled by
GFM to 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
.
To support all GFM features, use
micromark-extension-gfm
.
When you need a syntax tree, you can combine this package with
mdast-util-gfm-task-list-item
.
All these packages are used remark-gfm
, which focusses on making
it easier to transform content by abstracting these internals away.
Install
This package is ESM only. In Node.js (version 16+), install with npm:
1npm install micromark-extension-gfm-task-list-item
In Deno with esm.sh
:
1import {gfmTaskListItem, gfmTaskListItemHtml} from 'https://esm.sh/micromark-extension-gfm-task-list-item@2'
In browsers with esm.sh
:
1<script type="module"> 2 import {gfmTaskListItem, gfmTaskListItemHtml} from 'https://esm.sh/micromark-extension-gfm-task-list-item@2?bundle' 3</script>
Use
1import {micromark} from 'micromark' 2import { 3 gfmTaskListItem, 4 gfmTaskListItemHtml 5} from 'micromark-extension-gfm-task-list-item' 6 7const output = micromark('* [x] a\n* [ ] b', { 8 extensions: [gfmTaskListItem()], 9 htmlExtensions: [gfmTaskListItemHtml()] 10}) 11 12console.log(output)
Yields:
1<ul> 2<li><input type="checkbox" disabled="" checked="" /> a</li> 3<li><input type="checkbox" disabled="" /> b</li> 4</ul>
API
This package exports the identifiers gfmTaskListItem
and gfmTaskListItemHtml
.
There is no default export.
The export map supports the development
condition.
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
).
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
).
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 <input>
element, in the checkbox state (type=checkbox
),
in HTML.
See § 4.10.5.1.15 Checkbox state (type=checkbox
)
in the HTML spec for more info.
1<!--…--> 2<li><input type="checkbox" disabled="" /> foo</li> 3<li><input type="checkbox" disabled="" checked="" /> bar</li> 4<!--…-->
CSS
GitHub itself uses slightly different markup for task list items than they define in their spec. When following the spec, as this extension does, only inputs are added. They can be styled with the following CSS:
1input[type="checkbox"] { 2 margin: 0 .2em .25em -1.6em; 3 vertical-align: middle; 4} 5 6input[type="checkbox"]:dir(rtl) { 7 margin: 0 -1.6em .25em .2em; 8}
For the complete actual CSS see
sindresorhus/github-markdown-css
.
Syntax
Checks form with the following BNF:
1gfm_task_list_item_check ::= '[' (0x09 | ' ' | 'X' | 'x') ']'
The check is only allowed at the start of the first paragraph, optionally
following zero or more definitions or a blank line, in a list item.
The check must be followed by whitespace ([\t\n\r ]*
), which is in turn
followed by non-whitespace.
Types
This package is fully typed with TypeScript. It exports no additional types.
Compatibility
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,
micromark-extension-gfm-task-list-item@^2
, compatible with Node.js 16.
This package works with micromark
version 3
and later.
Security
This package is safe.
Related
micromark-extension-gfm
— support all of GFMmdast-util-gfm-task-list-item
— support all of GFM in mdastmdast-util-gfm
— support all of GFM in mdastremark-gfm
— support all of GFM in remark
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
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
no dangerous workflow patterns detected
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
- Info: project has a license file: license:0
- Info: FSF or OSI recognized license: MIT License: license:0
Reason
security policy file detected
Details
- Info: security policy file detected: github.com/micromark/.github/security.md:1
- Info: Found linked content: github.com/micromark/.github/security.md:1
- Info: Found disclosure, vulnerability, and/or timelines in security policy: github.com/micromark/.github/security.md:1
- Info: Found text in security policy: github.com/micromark/.github/security.md:1
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
Found 1/30 approved changesets -- score normalized to 0
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/bb.yml:11: update your workflow using https://app.stepsecurity.io/secureworkflow/micromark/micromark-extension-gfm-task-list-item/bb.yml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/main.yml:10: update your workflow using https://app.stepsecurity.io/secureworkflow/micromark/micromark-extension-gfm-task-list-item/main.yml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/main.yml:11: update your workflow using https://app.stepsecurity.io/secureworkflow/micromark/micromark-extension-gfm-task-list-item/main.yml/main?enable=pin
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/main.yml:16: update your workflow using https://app.stepsecurity.io/secureworkflow/micromark/micromark-extension-gfm-task-list-item/main.yml/main?enable=pin
- Warn: npmCommand not pinned by hash: .github/workflows/main.yml:15
- Info: 0 out of 2 GitHub-owned GitHubAction dependencies pinned
- Info: 0 out of 2 third-party GitHubAction dependencies pinned
- Info: 0 out of 1 npmCommand dependencies pinned
Reason
detected GitHub workflow tokens with excessive permissions
Details
- Warn: no topLevel permission defined: .github/workflows/bb.yml:1
- Warn: no topLevel permission defined: .github/workflows/main.yml:1
- Info: no jobLevel write permissions found
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'main'
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
- Warn: 0 commits out of 1 are checked with a SAST tool
Score
4.1
/10
Last Scanned on 2025-01-06
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 More