This commit is contained in:
14
node_modules/micromark-extension-gfm-task-list-item/html.js
generated
vendored
Normal file
14
node_modules/micromark-extension-gfm-task-list-item/html.js
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
exports.enter = {taskListCheck: enterCheck}
|
||||
exports.exit = {taskListCheck: exitCheck, taskListCheckValueChecked: checked}
|
||||
|
||||
function enterCheck() {
|
||||
this.tag('<input ')
|
||||
}
|
||||
|
||||
function checked() {
|
||||
this.tag('checked="" ')
|
||||
}
|
||||
|
||||
function exitCheck() {
|
||||
this.tag('disabled="" type="checkbox">')
|
||||
}
|
||||
1
node_modules/micromark-extension-gfm-task-list-item/index.js
generated
vendored
Normal file
1
node_modules/micromark-extension-gfm-task-list-item/index.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = require('./syntax')
|
||||
22
node_modules/micromark-extension-gfm-task-list-item/license
generated
vendored
Normal file
22
node_modules/micromark-extension-gfm-task-list-item/license
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
(The MIT License)
|
||||
|
||||
Copyright (c) 2020 Titus Wormer <tituswormer@gmail.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
'Software'), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
75
node_modules/micromark-extension-gfm-task-list-item/package.json
generated
vendored
Normal file
75
node_modules/micromark-extension-gfm-task-list-item/package.json
generated
vendored
Normal file
@@ -0,0 +1,75 @@
|
||||
{
|
||||
"name": "micromark-extension-gfm-task-list-item",
|
||||
"version": "0.3.3",
|
||||
"description": "micromark extension to support GFM task list items",
|
||||
"license": "MIT",
|
||||
"keywords": [
|
||||
"micromark",
|
||||
"micromark-extension",
|
||||
"task",
|
||||
"list",
|
||||
"item",
|
||||
"check",
|
||||
"checkbox",
|
||||
"todo",
|
||||
"gfm",
|
||||
"markdown",
|
||||
"unified"
|
||||
],
|
||||
"repository": "micromark/micromark-extension-gfm-task-list-item",
|
||||
"bugs": "https://github.com/micromark/micromark-extension-gfm-task-list-item/issues",
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/unified"
|
||||
},
|
||||
"author": "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)",
|
||||
"contributors": [
|
||||
"Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)"
|
||||
],
|
||||
"files": [
|
||||
"index.js",
|
||||
"html.js",
|
||||
"syntax.js"
|
||||
],
|
||||
"dependencies": {
|
||||
"micromark": "~2.11.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"control-pictures": "^1.0.0",
|
||||
"nyc": "^15.0.0",
|
||||
"prettier": "^2.0.0",
|
||||
"remark-cli": "^9.0.0",
|
||||
"remark-preset-wooorm": "^8.0.0",
|
||||
"tape": "^5.0.0",
|
||||
"xo": "^0.36.0"
|
||||
},
|
||||
"scripts": {
|
||||
"format": "remark . -qfo && prettier . -w --loglevel warn && xo --fix",
|
||||
"test-api": "node test",
|
||||
"test-coverage": "nyc --reporter lcov tape test/index.js",
|
||||
"test": "npm run format && npm run test-coverage"
|
||||
},
|
||||
"nyc": {
|
||||
"check-coverage": true,
|
||||
"lines": 100,
|
||||
"functions": 100,
|
||||
"branches": 100
|
||||
},
|
||||
"prettier": {
|
||||
"tabWidth": 2,
|
||||
"useTabs": false,
|
||||
"singleQuote": true,
|
||||
"bracketSpacing": false,
|
||||
"semi": false,
|
||||
"trailingComma": "none"
|
||||
},
|
||||
"xo": {
|
||||
"prettier": true,
|
||||
"esnext": false
|
||||
},
|
||||
"remarkConfig": {
|
||||
"plugins": [
|
||||
"preset-wooorm"
|
||||
]
|
||||
}
|
||||
}
|
||||
124
node_modules/micromark-extension-gfm-task-list-item/readme.md
generated
vendored
Normal file
124
node_modules/micromark-extension-gfm-task-list-item/readme.md
generated
vendored
Normal file
@@ -0,0 +1,124 @@
|
||||
# micromark-extension-gfm-task-list-item
|
||||
|
||||
[![Build][build-badge]][build]
|
||||
[![Coverage][coverage-badge]][coverage]
|
||||
[![Downloads][downloads-badge]][downloads]
|
||||
[![Size][size-badge]][size]
|
||||
[![Sponsors][sponsors-badge]][collective]
|
||||
[![Backers][backers-badge]][collective]
|
||||
[![Chat][chat-badge]][chat]
|
||||
|
||||
**[micromark][]** extension to support GitHub flavored markdown [task list
|
||||
items][].
|
||||
This extension matches the GFM spec for the few things it defines and otherwise
|
||||
matches github.com.
|
||||
|
||||
This package provides the low-level modules for integrating with the micromark
|
||||
tokenizer and the micromark HTML compiler.
|
||||
|
||||
You probably shouldn’t use this package directly, but instead use
|
||||
[`mdast-util-gfm-task-list-item`][mdast-util-gfm-task-list-item] with
|
||||
**[mdast][]**.
|
||||
|
||||
## Install
|
||||
|
||||
[npm][]:
|
||||
|
||||
```sh
|
||||
npm install micromark-extension-gfm-task-list-item
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### `html`
|
||||
|
||||
### `syntax`
|
||||
|
||||
> Note: `syntax` is the default export of this module, `html` is available at
|
||||
> `micromark-extension-gfm-task-list-item/html`.
|
||||
|
||||
Support [task list items][].
|
||||
The exports are extensions for the micromark parser (to tokenize checks; can be
|
||||
passed in `extensions`) and the default HTML compiler (to compile as `<input>`
|
||||
elements; can be passed in `htmlExtensions`).
|
||||
|
||||
## Related
|
||||
|
||||
* [`remarkjs/remark`][remark]
|
||||
— markdown processor powered by plugins
|
||||
* [`micromark/micromark`][micromark]
|
||||
— the smallest commonmark-compliant markdown parser that exists
|
||||
* [`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-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
|
||||
|
||||
## Contribute
|
||||
|
||||
See [`contributing.md` in `micromark/.github`][contributing] for ways to get
|
||||
started.
|
||||
See [`support.md`][support] for ways to get help.
|
||||
|
||||
This project has a [code of conduct][coc].
|
||||
By interacting with this repository, organization, or community you agree to
|
||||
abide by its terms.
|
||||
|
||||
## License
|
||||
|
||||
[MIT][license] © [Titus Wormer][author]
|
||||
|
||||
<!-- Definitions -->
|
||||
|
||||
[build-badge]: https://github.com/micromark/micromark-extension-gfm-task-list-item/workflows/main/badge.svg
|
||||
|
||||
[build]: https://github.com/micromark/micromark-extension-gfm-task-list-item/actions
|
||||
|
||||
[coverage-badge]: https://img.shields.io/codecov/c/github/micromark/micromark-extension-gfm-task-list-item.svg
|
||||
|
||||
[coverage]: https://codecov.io/github/micromark/micromark-extension-gfm-task-list-item
|
||||
|
||||
[downloads-badge]: https://img.shields.io/npm/dm/micromark-extension-gfm-task-list-item.svg
|
||||
|
||||
[downloads]: https://www.npmjs.com/package/micromark-extension-gfm-task-list-item
|
||||
|
||||
[size-badge]: https://img.shields.io/bundlephobia/minzip/micromark-extension-gfm-task-list-item.svg
|
||||
|
||||
[size]: https://bundlephobia.com/result?p=micromark-extension-gfm-task-list-item
|
||||
|
||||
[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg
|
||||
|
||||
[backers-badge]: https://opencollective.com/unified/backers/badge.svg
|
||||
|
||||
[collective]: https://opencollective.com/unified
|
||||
|
||||
[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg
|
||||
|
||||
[chat]: https://github.com/micromark/micromark/discussions
|
||||
|
||||
[npm]: https://docs.npmjs.com/cli/install
|
||||
|
||||
[license]: license
|
||||
|
||||
[author]: https://wooorm.com
|
||||
|
||||
[contributing]: https://github.com/micromark/.github/blob/HEAD/contributing.md
|
||||
|
||||
[support]: https://github.com/micromark/.github/blob/HEAD/support.md
|
||||
|
||||
[coc]: https://github.com/micromark/.github/blob/HEAD/code-of-conduct.md
|
||||
|
||||
[micromark]: https://github.com/micromark/micromark
|
||||
|
||||
[from-markdown]: https://github.com/syntax-tree/mdast-util-from-markdown
|
||||
|
||||
[to-markdown]: https://github.com/syntax-tree/mdast-util-to-markdown
|
||||
|
||||
[remark]: https://github.com/remarkjs/remark
|
||||
|
||||
[mdast]: https://github.com/syntax-tree/mdast
|
||||
|
||||
[mdast-util-gfm-task-list-item]: https://github.com/syntax-tree/mdast-util-gfm-task-list-item
|
||||
|
||||
[task list items]: https://github.github.com/gfm/#task-list-items-extension-
|
||||
80
node_modules/micromark-extension-gfm-task-list-item/syntax.js
generated
vendored
Normal file
80
node_modules/micromark-extension-gfm-task-list-item/syntax.js
generated
vendored
Normal file
@@ -0,0 +1,80 @@
|
||||
var markdownLineEndingOrSpace = require('micromark/dist/character/markdown-line-ending-or-space')
|
||||
var spaceFactory = require('micromark/dist/tokenize/factory-space')
|
||||
var prefixSize = require('micromark/dist/util/prefix-size')
|
||||
|
||||
var tasklistCheck = {tokenize: tokenizeTasklistCheck}
|
||||
|
||||
exports.text = {91: tasklistCheck}
|
||||
|
||||
function tokenizeTasklistCheck(effects, ok, nok) {
|
||||
var self = this
|
||||
|
||||
return open
|
||||
|
||||
function open(code) {
|
||||
if (
|
||||
// Exit if not `[`.
|
||||
code !== 91 ||
|
||||
// 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
|
||||
}
|
||||
|
||||
function inside(code) {
|
||||
// Tab or space.
|
||||
if (code === -2 || code === 32) {
|
||||
effects.enter('taskListCheckValueUnchecked')
|
||||
effects.consume(code)
|
||||
effects.exit('taskListCheckValueUnchecked')
|
||||
return close
|
||||
}
|
||||
|
||||
// Upper- and lower `x`.
|
||||
if (code === 88 || code === 120) {
|
||||
effects.enter('taskListCheckValueChecked')
|
||||
effects.consume(code)
|
||||
effects.exit('taskListCheckValueChecked')
|
||||
return close
|
||||
}
|
||||
|
||||
return nok(code)
|
||||
}
|
||||
|
||||
function close(code) {
|
||||
// `]`
|
||||
if (code === 93) {
|
||||
effects.enter('taskListCheckMarker')
|
||||
effects.consume(code)
|
||||
effects.exit('taskListCheckMarker')
|
||||
effects.exit('taskListCheck')
|
||||
return effects.check({tokenize: spaceThenNonSpace}, ok, nok)
|
||||
}
|
||||
|
||||
return nok(code)
|
||||
}
|
||||
}
|
||||
|
||||
function spaceThenNonSpace(effects, ok, nok) {
|
||||
var self = this
|
||||
|
||||
return spaceFactory(effects, after, 'whitespace')
|
||||
|
||||
function after(code) {
|
||||
return prefixSize(self.events, 'whitespace') &&
|
||||
code !== null &&
|
||||
!markdownLineEndingOrSpace(code)
|
||||
? ok(code)
|
||||
: nok(code)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user