micromark-extension-gfm-task-list-item
Advanced tools
Comparing version 1.0.5 to 2.0.0
@@ -5,8 +5,10 @@ /** | ||
/** | ||
* Extension for `micromark` that can be passed in `htmlExtensions` to | ||
* support GFM task list items when serializing to HTML. | ||
* Create an HTML extension for `micromark` to support GFM task list items when | ||
* serializing to HTML. | ||
* | ||
* @type {HtmlExtension} | ||
* @returns {HtmlExtension} | ||
* Extension for `micromark` that can be passed in `htmlExtensions` to | ||
* support GFM task list items when serializing to HTML. | ||
*/ | ||
export const gfmTaskListItemHtml: HtmlExtension | ||
export function gfmTaskListItemHtml(): HtmlExtension | ||
export type HtmlExtension = import('micromark-util-types').HtmlExtension |
@@ -5,24 +5,26 @@ /** | ||
// To do: next major: expose function to make extension. | ||
/** | ||
* Extension for `micromark` that can be passed in `htmlExtensions` to | ||
* support GFM task list items when serializing to HTML. | ||
* Create an HTML extension for `micromark` to support GFM task list items when | ||
* serializing to HTML. | ||
* | ||
* @type {HtmlExtension} | ||
* @returns {HtmlExtension} | ||
* Extension for `micromark` that can be passed in `htmlExtensions` to | ||
* support GFM task list items when serializing to HTML. | ||
*/ | ||
export const gfmTaskListItemHtml = { | ||
enter: { | ||
taskListCheck() { | ||
this.tag('<input type="checkbox" disabled="" ') | ||
} | ||
}, | ||
exit: { | ||
taskListCheck() { | ||
this.tag('/>') | ||
export function gfmTaskListItemHtml() { | ||
return { | ||
enter: { | ||
taskListCheck() { | ||
this.tag('<input type="checkbox" disabled="" ') | ||
} | ||
}, | ||
taskListCheckValueChecked() { | ||
this.tag('checked="" ') | ||
exit: { | ||
taskListCheck() { | ||
this.tag('/>') | ||
}, | ||
taskListCheckValueChecked() { | ||
this.tag('checked="" ') | ||
} | ||
} | ||
} | ||
} |
/** | ||
* Extension for `micromark` that can be passed in `extensions`, to | ||
* enable GFM task list items syntax. | ||
* Create an HTML extension for `micromark` to support GFM task list items | ||
* syntax. | ||
* | ||
* @type {Extension} | ||
* @returns {Extension} | ||
* Extension for `micromark` that can be passed in `htmlExtensions` to | ||
* support GFM task list items when serializing to HTML. | ||
*/ | ||
export const gfmTaskListItem: Extension | ||
export function gfmTaskListItem(): Extension | ||
export type Extension = import('micromark-util-types').Extension | ||
@@ -9,0 +11,0 @@ export type State = import('micromark-util-types').State |
@@ -8,7 +8,7 @@ /** | ||
import {ok as assert} from 'uvu/assert' | ||
import {ok as assert} from 'devlop' | ||
import {factorySpace} from 'micromark-factory-space' | ||
import { | ||
markdownLineEnding, | ||
markdownLineEndingOrSpace, | ||
markdownLineEnding, | ||
markdownSpace | ||
@@ -21,12 +21,14 @@ } from 'micromark-util-character' | ||
// To do: next major: expose function to make extension. | ||
/** | ||
* Extension for `micromark` that can be passed in `extensions`, to | ||
* enable GFM task list items syntax. | ||
* Create an HTML extension for `micromark` to support GFM task list items | ||
* syntax. | ||
* | ||
* @type {Extension} | ||
* @returns {Extension} | ||
* Extension for `micromark` that can be passed in `htmlExtensions` to | ||
* support GFM task list items when serializing to HTML. | ||
*/ | ||
export const gfmTaskListItem = { | ||
text: {[codes.leftSquareBracket]: tasklistCheck} | ||
export function gfmTaskListItem() { | ||
return { | ||
text: {[codes.leftSquareBracket]: tasklistCheck} | ||
} | ||
} | ||
@@ -33,0 +35,0 @@ |
@@ -5,8 +5,10 @@ /** | ||
/** | ||
* Extension for `micromark` that can be passed in `htmlExtensions` to | ||
* support GFM task list items when serializing to HTML. | ||
* Create an HTML extension for `micromark` to support GFM task list items when | ||
* serializing to HTML. | ||
* | ||
* @type {HtmlExtension} | ||
* @returns {HtmlExtension} | ||
* Extension for `micromark` that can be passed in `htmlExtensions` to | ||
* support GFM task list items when serializing to HTML. | ||
*/ | ||
export const gfmTaskListItemHtml: HtmlExtension | ||
export function gfmTaskListItemHtml(): HtmlExtension | ||
export type HtmlExtension = import('micromark-util-types').HtmlExtension |
@@ -5,24 +5,26 @@ /** | ||
// To do: next major: expose function to make extension. | ||
/** | ||
* Extension for `micromark` that can be passed in `htmlExtensions` to | ||
* support GFM task list items when serializing to HTML. | ||
* Create an HTML extension for `micromark` to support GFM task list items when | ||
* serializing to HTML. | ||
* | ||
* @type {HtmlExtension} | ||
* @returns {HtmlExtension} | ||
* Extension for `micromark` that can be passed in `htmlExtensions` to | ||
* support GFM task list items when serializing to HTML. | ||
*/ | ||
export const gfmTaskListItemHtml = { | ||
enter: { | ||
taskListCheck() { | ||
this.tag('<input type="checkbox" disabled="" ') | ||
} | ||
}, | ||
exit: { | ||
taskListCheck() { | ||
this.tag('/>') | ||
export function gfmTaskListItemHtml() { | ||
return { | ||
enter: { | ||
taskListCheck() { | ||
this.tag('<input type="checkbox" disabled="" ') | ||
} | ||
}, | ||
taskListCheckValueChecked() { | ||
this.tag('checked="" ') | ||
exit: { | ||
taskListCheck() { | ||
this.tag('/>') | ||
}, | ||
taskListCheckValueChecked() { | ||
this.tag('checked="" ') | ||
} | ||
} | ||
} | ||
} |
/** | ||
* Extension for `micromark` that can be passed in `extensions`, to | ||
* enable GFM task list items syntax. | ||
* Create an HTML extension for `micromark` to support GFM task list items | ||
* syntax. | ||
* | ||
* @type {Extension} | ||
* @returns {Extension} | ||
* Extension for `micromark` that can be passed in `htmlExtensions` to | ||
* support GFM task list items when serializing to HTML. | ||
*/ | ||
export const gfmTaskListItem: Extension | ||
export function gfmTaskListItem(): Extension | ||
export type Extension = import('micromark-util-types').Extension | ||
@@ -9,0 +11,0 @@ export type State = import('micromark-util-types').State |
@@ -8,6 +8,7 @@ /** | ||
import {ok as assert} from 'devlop' | ||
import {factorySpace} from 'micromark-factory-space' | ||
import { | ||
markdownLineEnding, | ||
markdownLineEndingOrSpace, | ||
markdownLineEnding, | ||
markdownSpace | ||
@@ -19,13 +20,15 @@ } from 'micromark-util-character' | ||
// To do: next major: expose function to make extension. | ||
/** | ||
* Extension for `micromark` that can be passed in `extensions`, to | ||
* enable GFM task list items syntax. | ||
* Create an HTML extension for `micromark` to support GFM task list items | ||
* syntax. | ||
* | ||
* @type {Extension} | ||
* @returns {Extension} | ||
* Extension for `micromark` that can be passed in `htmlExtensions` to | ||
* support GFM task list items when serializing to HTML. | ||
*/ | ||
export const gfmTaskListItem = { | ||
text: { | ||
[91]: tasklistCheck | ||
export function gfmTaskListItem() { | ||
return { | ||
text: { | ||
[91]: tasklistCheck | ||
} | ||
} | ||
@@ -32,0 +35,0 @@ } |
{ | ||
"name": "micromark-extension-gfm-task-list-item", | ||
"version": "1.0.5", | ||
"version": "2.0.0", | ||
"description": "micromark extension to support GFM task list items", | ||
@@ -31,4 +31,2 @@ "license": "MIT", | ||
"type": "module", | ||
"main": "index.js", | ||
"types": "index.d.ts", | ||
"files": [ | ||
@@ -45,11 +43,11 @@ "dev/", | ||
"dependencies": { | ||
"devlop": "^1.0.0", | ||
"micromark-factory-space": "^1.0.0", | ||
"micromark-util-character": "^1.0.0", | ||
"micromark-util-symbol": "^1.0.0", | ||
"micromark-util-types": "^1.0.0", | ||
"uvu": "^0.5.0" | ||
"micromark-util-types": "^1.0.0" | ||
}, | ||
"devDependencies": { | ||
"@types/node": "^20.0.0", | ||
"c8": "^7.0.0", | ||
"c8": "^8.0.0", | ||
"control-pictures": "^2.0.0", | ||
@@ -77,13 +75,23 @@ "create-gfm-fixtures": "^1.0.0", | ||
"prettier": { | ||
"tabWidth": 2, | ||
"useTabs": false, | ||
"singleQuote": true, | ||
"bracketSpacing": false, | ||
"semi": false, | ||
"trailingComma": "none" | ||
"singleQuote": true, | ||
"tabWidth": 2, | ||
"trailingComma": "none", | ||
"useTabs": false | ||
}, | ||
"remarkConfig": { | ||
"plugins": [ | ||
"remark-preset-wooorm" | ||
] | ||
}, | ||
"typeCoverage": { | ||
"atLeast": 100, | ||
"detail": true, | ||
"ignoreCatch": true, | ||
"strict": true | ||
}, | ||
"xo": { | ||
"prettier": true, | ||
"rules": { | ||
"n/file-extension-in-import": "off", | ||
"unicorn/no-this-assignment": "off" | ||
@@ -101,14 +109,3 @@ }, | ||
] | ||
}, | ||
"remarkConfig": { | ||
"plugins": [ | ||
"remark-preset-wooorm" | ||
] | ||
}, | ||
"typeCoverage": { | ||
"atLeast": 100, | ||
"detail": true, | ||
"strict": true, | ||
"ignoreCatch": true | ||
} | ||
} |
@@ -20,4 +20,4 @@ # micromark-extension-gfm-task-list-item | ||
* [API](#api) | ||
* [`gfmTaskListItem`](#gfmtasklistitem) | ||
* [`gfmTaskListItemHtml`](#gfmtasklistitemhtml) | ||
* [`gfmTaskListItem()`](#gfmtasklistitem) | ||
* [`gfmTaskListItemHtml()`](#gfmtasklistitemhtml) | ||
* [Authoring](#authoring) | ||
@@ -57,3 +57,3 @@ * [HTML](#html) | ||
This package is [ESM only][esm]. | ||
In Node.js (version 14.14+), install with [npm][]: | ||
In Node.js (version 16+), install with [npm][]: | ||
@@ -67,3 +67,3 @@ ```sh | ||
```js | ||
import {gfmTaskListItem, gfmTaskListItemHtml} from 'https://esm.sh/micromark-extension-gfm-task-list-item@1' | ||
import {gfmTaskListItem, gfmTaskListItemHtml} from 'https://esm.sh/micromark-extension-gfm-task-list-item@2' | ||
``` | ||
@@ -75,3 +75,3 @@ | ||
<script type="module"> | ||
import {gfmTaskListItem, gfmTaskListItemHtml} from 'https://esm.sh/micromark-extension-gfm-task-list-item@1?bundle' | ||
import {gfmTaskListItem, gfmTaskListItemHtml} from 'https://esm.sh/micromark-extension-gfm-task-list-item@2?bundle' | ||
</script> | ||
@@ -90,4 +90,4 @@ ``` | ||
const output = micromark('* [x] a\n* [ ] b', { | ||
extensions: [gfmTaskListItem], | ||
htmlExtensions: [gfmTaskListItemHtml] | ||
extensions: [gfmTaskListItem()], | ||
htmlExtensions: [gfmTaskListItemHtml()] | ||
}) | ||
@@ -102,4 +102,4 @@ | ||
<ul> | ||
<li><input checked="" disabled="" type="checkbox"> a</li> | ||
<li><input disabled="" type="checkbox"> b</li> | ||
<li><input type="checkbox" disabled="" checked="" /> a</li> | ||
<li><input type="checkbox" disabled="" /> b</li> | ||
</ul> | ||
@@ -118,9 +118,19 @@ ``` | ||
### `gfmTaskListItem` | ||
### `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`][micromark-extension]). | ||
### `gfmTaskListItemHtml` | ||
### `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 | ||
@@ -193,9 +203,12 @@ task list items when serializing to HTML | ||
Projects maintained by the unified collective are compatible with all maintained | ||
Projects maintained by the unified collective are compatible with maintained | ||
versions of Node.js. | ||
As of now, that is Node.js 14.14+. | ||
Our projects sometimes work with older versions, but this is not guaranteed. | ||
These extensions work with `micromark` version 3+. | ||
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 | ||
@@ -244,5 +257,5 @@ | ||
[size-badge]: https://img.shields.io/bundlephobia/minzip/micromark-extension-gfm-task-list-item.svg | ||
[size-badge]: https://img.shields.io/badge/dynamic/json?label=minzipped%20size&query=$.size.compressedSize&url=https://deno.bundlejs.com/?q=micromark-extension-gfm-task-list-item | ||
[size]: https://bundlephobia.com/result?p=micromark-extension-gfm-task-list-item | ||
[size]: https://bundlejs.com/?q=micromark-extension-gfm-task-list-item | ||
@@ -267,7 +280,7 @@ [sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg | ||
[contributing]: https://github.com/micromark/.github/blob/HEAD/contributing.md | ||
[contributing]: https://github.com/micromark/.github/blob/main/contributing.md | ||
[support]: https://github.com/micromark/.github/blob/HEAD/support.md | ||
[support]: https://github.com/micromark/.github/blob/main/support.md | ||
[coc]: https://github.com/micromark/.github/blob/HEAD/code-of-conduct.md | ||
[coc]: https://github.com/micromark/.github/blob/main/code-of-conduct.md | ||
@@ -274,0 +287,0 @@ [esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
24876
445
306
+ Addeddevlop@^1.0.0
+ Addeddevlop@1.1.0(transitive)
- Removeduvu@^0.5.0
- Removeddiff@5.2.0(transitive)
- Removedkleur@4.1.5(transitive)
- Removedmri@1.2.0(transitive)
- Removedsade@1.8.1(transitive)
- Removeduvu@0.5.6(transitive)