Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

micromark-extension-gfm-task-list-item

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

micromark-extension-gfm-task-list-item - npm Package Compare versions

Comparing version 1.0.2 to 1.0.3

4

dev/lib/html.js

@@ -9,3 +9,3 @@ /**

taskListCheck() {
this.tag('<input ')
this.tag('<input type="checkbox" disabled="" ')
}

@@ -15,3 +15,3 @@ },

taskListCheck() {
this.tag('disabled="" type="checkbox">')
this.tag('/>')
},

@@ -18,0 +18,0 @@ taskListCheckValueChecked() {

@@ -14,4 +14,4 @@ /**

import {
markdownSpace,
markdownLineEndingOrSpace
markdownLineEndingOrSpace,
markdownLineEnding
} from 'micromark-util-character'

@@ -56,3 +56,5 @@ import {codes} from 'micromark-util-symbol/codes.js'

function inside(code) {
if (markdownSpace(code)) {
// To match how GH works in comments, use `markdownSpace` (`[ \t]`) instead
// of `markdownLineEndingOrSpace` (`[ \t\r\n]`).
if (markdownLineEndingOrSpace(code)) {
effects.enter('taskListCheckValueUnchecked')

@@ -98,9 +100,14 @@ effects.consume(code)

return tail &&
tail[1].type === types.whitespace &&
code !== codes.eof &&
!markdownLineEndingOrSpace(code)
? ok(code)
: nok(code)
return (
// We either found spaces…
((tail && tail[1].type === types.whitespace) ||
// …or it was followed by a line ending, in which case, there has to be
// non-whitespace after that line ending, because otherwise we’d get an
// EOF as the content is closed with blank lines.
markdownLineEnding(code)) &&
code !== codes.eof
? ok(code)
: nok(code)
)
}
}

@@ -9,3 +9,3 @@ /**

taskListCheck() {
this.tag('<input ')
this.tag('<input type="checkbox" disabled="" ')
}

@@ -15,3 +15,3 @@ },

taskListCheck() {
this.tag('disabled="" type="checkbox">')
this.tag('/>')
},

@@ -18,0 +18,0 @@

@@ -12,4 +12,4 @@ /**

import {
markdownSpace,
markdownLineEndingOrSpace
markdownLineEndingOrSpace,
markdownLineEnding
} from 'micromark-util-character'

@@ -50,3 +50,5 @@ const tasklistCheck = {

function inside(code) {
if (markdownSpace(code)) {
// To match how GH works in comments, use `markdownSpace` (`[ \t]`) instead
// of `markdownLineEndingOrSpace` (`[ \t\r\n]`).
if (markdownLineEndingOrSpace(code)) {
effects.enter('taskListCheckValueUnchecked')

@@ -96,9 +98,13 @@ effects.consume(code)

const tail = self.events[self.events.length - 1]
return tail &&
tail[1].type === 'whitespace' &&
code !== null &&
!markdownLineEndingOrSpace(code)
? ok(code)
: nok(code)
return (
// We either found spaces…
((tail && tail[1].type === 'whitespace') || // …or it was followed by a line ending, in which case, there has to be
// non-whitespace after that line ending, because otherwise we’d get an
// EOF as the content is closed with blank lines.
markdownLineEnding(code)) &&
code !== null
? ok(code)
: nok(code)
)
}
}
{
"name": "micromark-extension-gfm-task-list-item",
"version": "1.0.2",
"version": "1.0.3",
"description": "micromark extension to support GFM task list items",

@@ -54,2 +54,3 @@ "license": "MIT",

"control-pictures": "^2.0.0",
"create-gfm-fixtures": "^1.0.0",
"micromark": "^3.0.0",

@@ -64,3 +65,3 @@ "micromark-build": "^1.0.0",

"typescript": "^4.0.0",
"xo": "^0.45.0"
"xo": "^0.47.0"
},

@@ -67,0 +68,0 @@ "scripts": {

@@ -13,18 +13,43 @@ # micromark-extension-gfm-task-list-item

items][].
This extension matches the GFM spec for the few things it defines and otherwise
matches github.com.
## 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)
* [Types](#types)
* [Compatibility](#compatibility)
* [Security](#security)
* [Related](#related)
* [Contribute](#contribute)
* [License](#license)
## What is this?
This package is a micromark extension to add support for GFM task list items.
It matches how task list items work on `github.com`.
## When to use this
You should probably use [`micromark-extension-gfm`][micromark-extension-gfm]
instead, which combines this package with other GFM features.
Alternatively, if you don’t want all of GFM, use this package.
In many cases, when working with micromark, you’d want to use
[`micromark-extension-gfm`][micromark-extension-gfm] instead, which combines
this package with other GFM features.
When working with syntax trees, you’d want to combine this package with
[`mdast-util-gfm-task-list-item`][mdast-util-gfm-task-list-item] (or
[`mdast-util-gfm`][mdast-util-gfm] when using `micromark-extension-gfm`).
These tools are all rather low-level.
In most cases, you’d instead want to use [`remark-gfm`][remark-gfm] with
[remark][].
## Install
This package is [ESM only](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c):
Node 12+ is needed to use it and it must be `import`ed instead of `require`d.
This package is [ESM only][esm].
In Node.js (version 12.20+, 14.14+, or 16.0+), install with [npm][]:
[npm][]:
```sh

@@ -34,2 +59,16 @@ npm install micromark-extension-gfm-task-list-item

In Deno with [Skypack][]:
```js
import {gfmTaskListItem, gfmTaskListItemHtml} from 'https://cdn.skypack.dev/micromark-extension-gfm-task-list-item@1?dts'
```
In browsers with [Skypack][]:
```html
<script type="module">
import {gfmTaskListItem, gfmTaskListItemHtml} from 'https://cdn.skypack.dev/micromark-extension-gfm-task-list-item@1?min'
</script>
```
## Use

@@ -68,3 +107,3 @@

The export map supports the endorsed
[`development` condition](https://nodejs.org/api/packages.html#packages\_resolving\_user\_conditions).
[`development` condition](https://nodejs.org/api/packages.html#packages_resolving_user_conditions).
Run `node --conditions development module.js` to get instrumented dev code.

@@ -75,26 +114,32 @@ Without this condition, production code is loaded.

An extension for micromark to parse GFM task list items (can be passed in
`extensions`).
### `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`).
An extension to compile them to HTML (can be passed in `htmlExtensions`).
## Types
This package is fully typed with [TypeScript][].
There are no additional exported types.
## Compatibility
This package is at least compatible with all maintained versions of Node.js.
As of now, that is Node.js 12.20+, 14.14+, and 16.0+.
It also works in Deno and modern browsers.
## Security
This package is safe.
## Related
* [`remarkjs/remark`][remark]
— markdown processor powered by plugins
* [`remarkjs/remark-gfm`](https://github.com/remarkjs/remark-gfm)
— remark plugin using this and other GFM features
* [`micromark/micromark`][micromark]
— the smallest commonmark-compliant markdown parser that exists
* [`micromark/micromark-extension-gfm`][micromark-extension-gfm]
— micromark extension combining this with other GFM features
* [`syntax-tree/mdast-util-gfm-task-list-item`](https://github.com/syntax-tree/mdast-util-gfm-task-list-item)
— mdast utility to support task lists
* [`syntax-tree/mdast-util-gfm`](https://github.com/syntax-tree/mdast-util-gfm)
— mdast utility to support GFM
* [`syntax-tree/mdast-util-from-markdown`][from-markdown]
— mdast parser using `micromark` to create mdast from markdown
* [`syntax-tree/mdast-util-to-markdown`][to-markdown]
— mdast serializer to create markdown from mdast
* [`syntax-tree/mdast-util-gfm-task-list-item`][mdast-util-gfm-task-list-item]
— support GFM task list items in mdast
* [`syntax-tree/mdast-util-gfm`][mdast-util-gfm]
— support GFM in mdast
* [`remarkjs/remark-gfm`][remark-gfm]
— support GFM in remark

@@ -145,2 +190,4 @@ ## Contribute

[skypack]: https://www.skypack.dev
[license]: license

@@ -156,12 +203,18 @@

[micromark]: https://github.com/micromark/micromark
[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c
[from-markdown]: https://github.com/syntax-tree/mdast-util-from-markdown
[typescript]: https://www.typescriptlang.org
[to-markdown]: https://github.com/syntax-tree/mdast-util-to-markdown
[micromark]: https://github.com/micromark/micromark
[remark]: https://github.com/remarkjs/remark
[micromark-extension-gfm]: https://github.com/micromark/micromark-extension-gfm
[mdast-util-gfm-task-list-item]: https://github.com/syntax-tree/mdast-util-gfm-task-list-item
[mdast-util-gfm]: https://github.com/syntax-tree/mdast-util-gfm
[remark-gfm]: https://github.com/remarkjs/remark-gfm
[task list items]: https://github.github.com/gfm/#task-list-items-extension-
[micromark-extension-gfm]: https://github.com/micromark/micromark-extension-gfm
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc