micromark-extension-gfm-task-list-item
Advanced tools
Comparing version 2.0.1 to 2.1.0
export {gfmTaskListItemHtml} from './lib/html.js' | ||
export {gfmTaskListItem} from './lib/syntax.js' | ||
/** | ||
* Augment types. | ||
*/ | ||
declare module 'micromark-util-types' { | ||
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions | ||
/** | ||
* Token types. | ||
*/ | ||
interface TokenTypeMap { | ||
@@ -7,0 +12,0 @@ taskListCheck: 'taskListCheck' |
/** | ||
* @typedef {import('micromark-util-types').HtmlExtension} HtmlExtension | ||
* @import {HtmlExtension} from 'micromark-util-types' | ||
*/ | ||
@@ -12,3 +12,3 @@ /** | ||
*/ | ||
export function gfmTaskListItemHtml(): HtmlExtension | ||
export type HtmlExtension = import('micromark-util-types').HtmlExtension | ||
export function gfmTaskListItemHtml(): HtmlExtension; | ||
import type { HtmlExtension } from 'micromark-util-types'; |
/** | ||
* @typedef {import('micromark-util-types').HtmlExtension} HtmlExtension | ||
* @import {HtmlExtension} from 'micromark-util-types' | ||
*/ | ||
@@ -4,0 +4,0 @@ |
@@ -9,6 +9,3 @@ /** | ||
*/ | ||
export function gfmTaskListItem(): Extension | ||
export type Extension = import('micromark-util-types').Extension | ||
export type State = import('micromark-util-types').State | ||
export type TokenizeContext = import('micromark-util-types').TokenizeContext | ||
export type Tokenizer = import('micromark-util-types').Tokenizer | ||
export function gfmTaskListItem(): Extension; | ||
import type { Extension } from 'micromark-util-types'; |
/** | ||
* @typedef {import('micromark-util-types').Extension} Extension | ||
* @typedef {import('micromark-util-types').State} State | ||
* @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext | ||
* @typedef {import('micromark-util-types').Tokenizer} Tokenizer | ||
* @import {Extension, State, TokenizeContext, Tokenizer} from 'micromark-util-types' | ||
*/ | ||
@@ -17,3 +14,3 @@ | ||
const tasklistCheck = {tokenize: tokenizeTasklistCheck} | ||
const tasklistCheck = {name: 'tasklistCheck', tokenize: tokenizeTasklistCheck} | ||
@@ -20,0 +17,0 @@ /** |
export {gfmTaskListItemHtml} from './lib/html.js' | ||
export {gfmTaskListItem} from './lib/syntax.js' | ||
/** | ||
* Augment types. | ||
*/ | ||
declare module 'micromark-util-types' { | ||
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions | ||
/** | ||
* Token types. | ||
*/ | ||
interface TokenTypeMap { | ||
@@ -7,0 +12,0 @@ taskListCheck: 'taskListCheck' |
@@ -1,2 +0,2 @@ | ||
export {gfmTaskListItemHtml} from './lib/html.js' | ||
export {gfmTaskListItem} from './lib/syntax.js' | ||
export { gfmTaskListItemHtml } from './lib/html.js'; | ||
export { gfmTaskListItem } from './lib/syntax.js'; |
/** | ||
* @typedef {import('micromark-util-types').HtmlExtension} HtmlExtension | ||
* @import {HtmlExtension} from 'micromark-util-types' | ||
*/ | ||
@@ -12,3 +12,3 @@ /** | ||
*/ | ||
export function gfmTaskListItemHtml(): HtmlExtension | ||
export type HtmlExtension = import('micromark-util-types').HtmlExtension | ||
export function gfmTaskListItemHtml(): HtmlExtension; | ||
import type { HtmlExtension } from 'micromark-util-types'; |
/** | ||
* @typedef {import('micromark-util-types').HtmlExtension} HtmlExtension | ||
* @import {HtmlExtension} from 'micromark-util-types' | ||
*/ | ||
@@ -17,3 +17,3 @@ | ||
taskListCheck() { | ||
this.tag('<input type="checkbox" disabled="" ') | ||
this.tag('<input type="checkbox" disabled="" '); | ||
} | ||
@@ -23,9 +23,9 @@ }, | ||
taskListCheck() { | ||
this.tag('/>') | ||
this.tag('/>'); | ||
}, | ||
taskListCheckValueChecked() { | ||
this.tag('checked="" ') | ||
this.tag('checked="" '); | ||
} | ||
} | ||
} | ||
} | ||
}; | ||
} |
@@ -9,6 +9,3 @@ /** | ||
*/ | ||
export function gfmTaskListItem(): Extension | ||
export type Extension = import('micromark-util-types').Extension | ||
export type State = import('micromark-util-types').State | ||
export type TokenizeContext = import('micromark-util-types').TokenizeContext | ||
export type Tokenizer = import('micromark-util-types').Tokenizer | ||
export function gfmTaskListItem(): Extension; | ||
import type { Extension } from 'micromark-util-types'; |
/** | ||
* @typedef {import('micromark-util-types').Extension} Extension | ||
* @typedef {import('micromark-util-types').State} State | ||
* @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext | ||
* @typedef {import('micromark-util-types').Tokenizer} Tokenizer | ||
* @import {Extension, State, TokenizeContext, Tokenizer} from 'micromark-util-types' | ||
*/ | ||
import {factorySpace} from 'micromark-factory-space' | ||
import { | ||
markdownLineEnding, | ||
markdownLineEndingOrSpace, | ||
markdownSpace | ||
} from 'micromark-util-character' | ||
import { factorySpace } from 'micromark-factory-space'; | ||
import { markdownLineEnding, markdownLineEndingOrSpace, markdownSpace } from 'micromark-util-character'; | ||
const tasklistCheck = { | ||
name: 'tasklistCheck', | ||
tokenize: tokenizeTasklistCheck | ||
} | ||
}; | ||
@@ -31,3 +25,3 @@ /** | ||
} | ||
} | ||
}; | ||
} | ||
@@ -40,4 +34,4 @@ | ||
function tokenizeTasklistCheck(effects, ok, nok) { | ||
const self = this | ||
return open | ||
const self = this; | ||
return open; | ||
@@ -56,15 +50,14 @@ /** | ||
if ( | ||
// Exit if there’s stuff before. | ||
self.previous !== null || | ||
// Exit if not in the first content that is the first child of a list | ||
// item. | ||
!self._gfmTasklistFirstContentOfListItem | ||
) { | ||
return nok(code) | ||
// Exit if there’s stuff before. | ||
self.previous !== null || | ||
// Exit if not in the first content that is the first child of a list | ||
// item. | ||
!self._gfmTasklistFirstContentOfListItem) { | ||
return nok(code); | ||
} | ||
effects.enter('taskListCheck') | ||
effects.enter('taskListCheckMarker') | ||
effects.consume(code) | ||
effects.exit('taskListCheckMarker') | ||
return inside | ||
effects.enter('taskListCheck'); | ||
effects.enter('taskListCheckMarker'); | ||
effects.consume(code); | ||
effects.exit('taskListCheckMarker'); | ||
return inside; | ||
} | ||
@@ -87,14 +80,14 @@ | ||
if (markdownLineEndingOrSpace(code)) { | ||
effects.enter('taskListCheckValueUnchecked') | ||
effects.consume(code) | ||
effects.exit('taskListCheckValueUnchecked') | ||
return close | ||
effects.enter('taskListCheckValueUnchecked'); | ||
effects.consume(code); | ||
effects.exit('taskListCheckValueUnchecked'); | ||
return close; | ||
} | ||
if (code === 88 || code === 120) { | ||
effects.enter('taskListCheckValueChecked') | ||
effects.consume(code) | ||
effects.exit('taskListCheckValueChecked') | ||
return close | ||
effects.enter('taskListCheckValueChecked'); | ||
effects.consume(code); | ||
effects.exit('taskListCheckValueChecked'); | ||
return close; | ||
} | ||
return nok(code) | ||
return nok(code); | ||
} | ||
@@ -114,9 +107,9 @@ | ||
if (code === 93) { | ||
effects.enter('taskListCheckMarker') | ||
effects.consume(code) | ||
effects.exit('taskListCheckMarker') | ||
effects.exit('taskListCheck') | ||
return after | ||
effects.enter('taskListCheckMarker'); | ||
effects.consume(code); | ||
effects.exit('taskListCheckMarker'); | ||
effects.exit('taskListCheck'); | ||
return after; | ||
} | ||
return nok(code) | ||
return nok(code); | ||
} | ||
@@ -130,3 +123,3 @@ | ||
if (markdownLineEnding(code)) { | ||
return ok(code) | ||
return ok(code); | ||
} | ||
@@ -137,13 +130,9 @@ | ||
if (markdownSpace(code)) { | ||
return effects.check( | ||
{ | ||
tokenize: spaceThenNonSpace | ||
}, | ||
ok, | ||
nok | ||
)(code) | ||
return effects.check({ | ||
tokenize: spaceThenNonSpace | ||
}, ok, nok)(code); | ||
} | ||
// EOF, or non-whitespace, both wrong. | ||
return nok(code) | ||
return nok(code); | ||
} | ||
@@ -157,3 +146,3 @@ } | ||
function spaceThenNonSpace(effects, ok, nok) { | ||
return factorySpace(effects, after, 'whitespace') | ||
return factorySpace(effects, after, "whitespace"); | ||
@@ -175,4 +164,4 @@ /** | ||
// Anything else is good. | ||
return code === null ? nok(code) : ok(code) | ||
return code === null ? nok(code) : ok(code); | ||
} | ||
} | ||
} |
{ | ||
"name": "micromark-extension-gfm-task-list-item", | ||
"version": "2.0.1", | ||
"version": "2.1.0", | ||
"description": "micromark extension to support GFM task list items", | ||
@@ -50,3 +50,3 @@ "license": "MIT", | ||
"@types/node": "^20.0.0", | ||
"c8": "^8.0.0", | ||
"c8": "^10.0.0", | ||
"control-pictures": "^2.0.0", | ||
@@ -56,8 +56,8 @@ "create-gfm-fixtures": "^1.0.0", | ||
"micromark-build": "^2.0.0", | ||
"prettier": "^2.0.0", | ||
"remark-cli": "^11.0.0", | ||
"remark-preset-wooorm": "^9.0.0", | ||
"prettier": "^3.0.0", | ||
"remark-cli": "^12.0.0", | ||
"remark-preset-wooorm": "^10.0.0", | ||
"type-coverage": "^2.0.0", | ||
"typescript": "^5.0.0", | ||
"xo": "^0.54.0" | ||
"xo": "^0.58.0" | ||
}, | ||
@@ -67,3 +67,3 @@ "scripts": { | ||
"build": "tsc --build --clean && tsc --build && type-coverage && micromark-build", | ||
"format": "remark . -qfo && prettier . -w --loglevel warn && xo --fix", | ||
"format": "remark . -qfo && prettier . -w --log-level warn && xo --fix", | ||
"test-api-prod": "node --conditions production test/index.js", | ||
@@ -97,3 +97,4 @@ "test-api-dev": "node --conditions development test/index.js", | ||
"rules": { | ||
"unicorn/no-this-assignment": "off" | ||
"unicorn/no-this-assignment": "off", | ||
"unicorn/prefer-string-replace-all": "off" | ||
}, | ||
@@ -103,6 +104,29 @@ "overrides": [ | ||
"files": [ | ||
"**/*.d.ts" | ||
], | ||
"rules": { | ||
"@typescript-eslint/array-type": [ | ||
"error", | ||
{ | ||
"default": "generic" | ||
} | ||
], | ||
"@typescript-eslint/ban-types": [ | ||
"error", | ||
{ | ||
"extendDefaults": true | ||
} | ||
], | ||
"@typescript-eslint/consistent-type-definitions": [ | ||
"error", | ||
"interface" | ||
] | ||
} | ||
}, | ||
{ | ||
"files": [ | ||
"test/**/*.js" | ||
], | ||
"rules": { | ||
"no-await-in-loop": 0 | ||
"no-await-in-loop": "off" | ||
} | ||
@@ -109,0 +133,0 @@ } |
@@ -15,19 +15,19 @@ # micromark-extension-gfm-task-list-item | ||
* [What is this?](#what-is-this) | ||
* [When to use this](#when-to-use-this) | ||
* [Install](#install) | ||
* [Use](#use) | ||
* [API](#api) | ||
* [`gfmTaskListItem()`](#gfmtasklistitem) | ||
* [`gfmTaskListItemHtml()`](#gfmtasklistitemhtml) | ||
* [Authoring](#authoring) | ||
* [HTML](#html) | ||
* [CSS](#css) | ||
* [Syntax](#syntax) | ||
* [Types](#types) | ||
* [Compatibility](#compatibility) | ||
* [Security](#security) | ||
* [Related](#related) | ||
* [Contribute](#contribute) | ||
* [License](#license) | ||
* [What is this?](#what-is-this) | ||
* [When to use this](#when-to-use-this) | ||
* [Install](#install) | ||
* [Use](#use) | ||
* [API](#api) | ||
* [`gfmTaskListItem()`](#gfmtasklistitem) | ||
* [`gfmTaskListItemHtml()`](#gfmtasklistitemhtml) | ||
* [Authoring](#authoring) | ||
* [HTML](#html) | ||
* [CSS](#css) | ||
* [Syntax](#syntax) | ||
* [Types](#types) | ||
* [Compatibility](#compatibility) | ||
* [Security](#security) | ||
* [Related](#related) | ||
* [Contribute](#contribute) | ||
* [License](#license) | ||
@@ -213,10 +213,10 @@ ## What is this? | ||
* [`micromark-extension-gfm`][micromark-extension-gfm] | ||
— support all of GFM | ||
* [`mdast-util-gfm-task-list-item`][mdast-util-gfm-task-list-item] | ||
— support all of GFM in mdast | ||
* [`mdast-util-gfm`][mdast-util-gfm] | ||
— support all of GFM in mdast | ||
* [`remark-gfm`][remark-gfm] | ||
— support all of GFM in remark | ||
* [`micromark-extension-gfm`][micromark-extension-gfm] | ||
— support all of GFM | ||
* [`mdast-util-gfm-task-list-item`][mdast-util-gfm-task-list-item] | ||
— support all of GFM in mdast | ||
* [`mdast-util-gfm`][mdast-util-gfm] | ||
— support all of GFM in mdast | ||
* [`remark-gfm`][remark-gfm] | ||
— support all of GFM in remark | ||
@@ -223,0 +223,0 @@ ## Contribute |
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
24410
430