Spaces:
Paused
Paused
Include updated package-lock.json (part 5)
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- node_modules/micromark-extension-gfm-task-list-item/package.json +131 -0
- node_modules/micromark-extension-gfm-task-list-item/readme.md +305 -0
- node_modules/micromark-factory-destination/dev/index.d.ts +42 -0
- node_modules/micromark-factory-destination/dev/index.d.ts.map +1 -0
- node_modules/micromark-factory-destination/dev/index.js +255 -0
- node_modules/micromark-factory-destination/index.d.ts +42 -0
- node_modules/micromark-factory-destination/index.d.ts.map +1 -0
- node_modules/micromark-factory-destination/index.js +206 -0
- node_modules/micromark-factory-destination/license +22 -0
- node_modules/micromark-factory-destination/package.json +57 -0
- node_modules/micromark-factory-destination/readme.md +234 -0
- node_modules/micromark-factory-label/dev/index.d.ts +37 -0
- node_modules/micromark-factory-label/dev/index.d.ts.map +1 -0
- node_modules/micromark-factory-label/dev/index.js +172 -0
- node_modules/micromark-factory-label/index.d.ts +37 -0
- node_modules/micromark-factory-label/index.d.ts.map +1 -0
- node_modules/micromark-factory-label/index.js +148 -0
- node_modules/micromark-factory-label/license +22 -0
- node_modules/micromark-factory-label/package.json +60 -0
- node_modules/micromark-factory-label/readme.md +224 -0
- node_modules/micromark-factory-space/dev/index.d.ts +37 -0
- node_modules/micromark-factory-space/dev/index.d.ts.map +1 -0
- node_modules/micromark-factory-space/dev/index.js +67 -0
- node_modules/micromark-factory-space/index.d.ts +37 -0
- node_modules/micromark-factory-space/index.d.ts.map +1 -0
- node_modules/micromark-factory-space/index.js +64 -0
- node_modules/micromark-factory-space/license +22 -0
- node_modules/micromark-factory-space/package.json +55 -0
- node_modules/micromark-factory-space/readme.md +225 -0
- node_modules/micromark-factory-title/dev/index.d.ts +36 -0
- node_modules/micromark-factory-title/dev/index.d.ts.map +1 -0
- node_modules/micromark-factory-title/dev/index.js +169 -0
- node_modules/micromark-factory-title/index.d.ts +36 -0
- node_modules/micromark-factory-title/index.d.ts.map +1 -0
- node_modules/micromark-factory-title/index.js +158 -0
- node_modules/micromark-factory-title/license +22 -0
- node_modules/micromark-factory-title/package.json +58 -0
- node_modules/micromark-factory-title/readme.md +229 -0
- node_modules/micromark-factory-whitespace/dev/index.d.ts +22 -0
- node_modules/micromark-factory-whitespace/dev/index.d.ts.map +1 -0
- node_modules/micromark-factory-whitespace/dev/index.js +53 -0
- node_modules/micromark-factory-whitespace/index.d.ts +22 -0
- node_modules/micromark-factory-whitespace/index.d.ts.map +1 -0
- node_modules/micromark-factory-whitespace/index.js +44 -0
- node_modules/micromark-factory-whitespace/license +22 -0
- node_modules/micromark-factory-whitespace/package.json +57 -0
- node_modules/micromark-factory-whitespace/readme.md +205 -0
- node_modules/micromark-util-character/dev/index.d.ts +195 -0
- node_modules/micromark-util-character/dev/index.d.ts.map +1 -0
- node_modules/micromark-util-character/dev/index.js +252 -0
node_modules/micromark-extension-gfm-task-list-item/package.json
ADDED
|
@@ -0,0 +1,131 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"name": "micromark-extension-gfm-task-list-item",
|
| 3 |
+
"version": "2.1.0",
|
| 4 |
+
"description": "micromark extension to support GFM task list items",
|
| 5 |
+
"license": "MIT",
|
| 6 |
+
"keywords": [
|
| 7 |
+
"micromark",
|
| 8 |
+
"micromark-extension",
|
| 9 |
+
"task",
|
| 10 |
+
"list",
|
| 11 |
+
"item",
|
| 12 |
+
"check",
|
| 13 |
+
"checkbox",
|
| 14 |
+
"todo",
|
| 15 |
+
"gfm",
|
| 16 |
+
"markdown",
|
| 17 |
+
"unified"
|
| 18 |
+
],
|
| 19 |
+
"repository": "micromark/micromark-extension-gfm-task-list-item",
|
| 20 |
+
"bugs": "https://github.com/micromark/micromark-extension-gfm-task-list-item/issues",
|
| 21 |
+
"funding": {
|
| 22 |
+
"type": "opencollective",
|
| 23 |
+
"url": "https://opencollective.com/unified"
|
| 24 |
+
},
|
| 25 |
+
"author": "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)",
|
| 26 |
+
"contributors": [
|
| 27 |
+
"Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)"
|
| 28 |
+
],
|
| 29 |
+
"sideEffects": false,
|
| 30 |
+
"type": "module",
|
| 31 |
+
"files": [
|
| 32 |
+
"dev/",
|
| 33 |
+
"lib/",
|
| 34 |
+
"index.d.ts",
|
| 35 |
+
"index.js"
|
| 36 |
+
],
|
| 37 |
+
"exports": {
|
| 38 |
+
"development": "./dev/index.js",
|
| 39 |
+
"default": "./index.js"
|
| 40 |
+
},
|
| 41 |
+
"dependencies": {
|
| 42 |
+
"devlop": "^1.0.0",
|
| 43 |
+
"micromark-factory-space": "^2.0.0",
|
| 44 |
+
"micromark-util-character": "^2.0.0",
|
| 45 |
+
"micromark-util-symbol": "^2.0.0",
|
| 46 |
+
"micromark-util-types": "^2.0.0"
|
| 47 |
+
},
|
| 48 |
+
"devDependencies": {
|
| 49 |
+
"@types/node": "^20.0.0",
|
| 50 |
+
"c8": "^10.0.0",
|
| 51 |
+
"control-pictures": "^2.0.0",
|
| 52 |
+
"create-gfm-fixtures": "^1.0.0",
|
| 53 |
+
"micromark": "^4.0.0",
|
| 54 |
+
"micromark-build": "^2.0.0",
|
| 55 |
+
"prettier": "^3.0.0",
|
| 56 |
+
"remark-cli": "^12.0.0",
|
| 57 |
+
"remark-preset-wooorm": "^10.0.0",
|
| 58 |
+
"type-coverage": "^2.0.0",
|
| 59 |
+
"typescript": "^5.0.0",
|
| 60 |
+
"xo": "^0.58.0"
|
| 61 |
+
},
|
| 62 |
+
"scripts": {
|
| 63 |
+
"prepack": "npm run build && npm run format",
|
| 64 |
+
"build": "tsc --build --clean && tsc --build && type-coverage && micromark-build",
|
| 65 |
+
"format": "remark . -qfo && prettier . -w --log-level warn && xo --fix",
|
| 66 |
+
"test-api-prod": "node --conditions production test/index.js",
|
| 67 |
+
"test-api-dev": "node --conditions development test/index.js",
|
| 68 |
+
"test-api": "npm run test-api-dev && npm run test-api-prod",
|
| 69 |
+
"test-coverage": "c8 --100 --reporter lcov npm run test-api",
|
| 70 |
+
"test": "npm run build && npm run format && npm run test-coverage"
|
| 71 |
+
},
|
| 72 |
+
"prettier": {
|
| 73 |
+
"bracketSpacing": false,
|
| 74 |
+
"semi": false,
|
| 75 |
+
"singleQuote": true,
|
| 76 |
+
"tabWidth": 2,
|
| 77 |
+
"trailingComma": "none",
|
| 78 |
+
"useTabs": false
|
| 79 |
+
},
|
| 80 |
+
"remarkConfig": {
|
| 81 |
+
"plugins": [
|
| 82 |
+
"remark-preset-wooorm"
|
| 83 |
+
]
|
| 84 |
+
},
|
| 85 |
+
"typeCoverage": {
|
| 86 |
+
"atLeast": 100,
|
| 87 |
+
"detail": true,
|
| 88 |
+
"ignoreCatch": true,
|
| 89 |
+
"strict": true
|
| 90 |
+
},
|
| 91 |
+
"xo": {
|
| 92 |
+
"prettier": true,
|
| 93 |
+
"rules": {
|
| 94 |
+
"unicorn/no-this-assignment": "off",
|
| 95 |
+
"unicorn/prefer-string-replace-all": "off"
|
| 96 |
+
},
|
| 97 |
+
"overrides": [
|
| 98 |
+
{
|
| 99 |
+
"files": [
|
| 100 |
+
"**/*.d.ts"
|
| 101 |
+
],
|
| 102 |
+
"rules": {
|
| 103 |
+
"@typescript-eslint/array-type": [
|
| 104 |
+
"error",
|
| 105 |
+
{
|
| 106 |
+
"default": "generic"
|
| 107 |
+
}
|
| 108 |
+
],
|
| 109 |
+
"@typescript-eslint/ban-types": [
|
| 110 |
+
"error",
|
| 111 |
+
{
|
| 112 |
+
"extendDefaults": true
|
| 113 |
+
}
|
| 114 |
+
],
|
| 115 |
+
"@typescript-eslint/consistent-type-definitions": [
|
| 116 |
+
"error",
|
| 117 |
+
"interface"
|
| 118 |
+
]
|
| 119 |
+
}
|
| 120 |
+
},
|
| 121 |
+
{
|
| 122 |
+
"files": [
|
| 123 |
+
"test/**/*.js"
|
| 124 |
+
],
|
| 125 |
+
"rules": {
|
| 126 |
+
"no-await-in-loop": "off"
|
| 127 |
+
}
|
| 128 |
+
}
|
| 129 |
+
]
|
| 130 |
+
}
|
| 131 |
+
}
|
node_modules/micromark-extension-gfm-task-list-item/readme.md
ADDED
|
@@ -0,0 +1,305 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# micromark-extension-gfm-task-list-item
|
| 2 |
+
|
| 3 |
+
[![Build][build-badge]][build]
|
| 4 |
+
[![Coverage][coverage-badge]][coverage]
|
| 5 |
+
[![Downloads][downloads-badge]][downloads]
|
| 6 |
+
[![Size][size-badge]][size]
|
| 7 |
+
[![Sponsors][sponsors-badge]][collective]
|
| 8 |
+
[![Backers][backers-badge]][collective]
|
| 9 |
+
[![Chat][chat-badge]][chat]
|
| 10 |
+
|
| 11 |
+
[micromark][] extensions to support GFM [task list items][].
|
| 12 |
+
|
| 13 |
+
## Contents
|
| 14 |
+
|
| 15 |
+
* [What is this?](#what-is-this)
|
| 16 |
+
* [When to use this](#when-to-use-this)
|
| 17 |
+
* [Install](#install)
|
| 18 |
+
* [Use](#use)
|
| 19 |
+
* [API](#api)
|
| 20 |
+
* [`gfmTaskListItem()`](#gfmtasklistitem)
|
| 21 |
+
* [`gfmTaskListItemHtml()`](#gfmtasklistitemhtml)
|
| 22 |
+
* [Authoring](#authoring)
|
| 23 |
+
* [HTML](#html)
|
| 24 |
+
* [CSS](#css)
|
| 25 |
+
* [Syntax](#syntax)
|
| 26 |
+
* [Types](#types)
|
| 27 |
+
* [Compatibility](#compatibility)
|
| 28 |
+
* [Security](#security)
|
| 29 |
+
* [Related](#related)
|
| 30 |
+
* [Contribute](#contribute)
|
| 31 |
+
* [License](#license)
|
| 32 |
+
|
| 33 |
+
## What is this?
|
| 34 |
+
|
| 35 |
+
This package contains extensions that add support for task lists as enabled by
|
| 36 |
+
GFM to [`micromark`][micromark].
|
| 37 |
+
It matches how task list items work on `github.com`.
|
| 38 |
+
|
| 39 |
+
## When to use this
|
| 40 |
+
|
| 41 |
+
This project is useful when you want to support task lists in markdown.
|
| 42 |
+
|
| 43 |
+
You can use these extensions when you are working with [`micromark`][micromark].
|
| 44 |
+
To support all GFM features, use
|
| 45 |
+
[`micromark-extension-gfm`][micromark-extension-gfm].
|
| 46 |
+
|
| 47 |
+
When you need a syntax tree, you can combine this package with
|
| 48 |
+
[`mdast-util-gfm-task-list-item`][mdast-util-gfm-task-list-item].
|
| 49 |
+
|
| 50 |
+
All these packages are used [`remark-gfm`][remark-gfm], which focusses on making
|
| 51 |
+
it easier to transform content by abstracting these internals away.
|
| 52 |
+
|
| 53 |
+
## Install
|
| 54 |
+
|
| 55 |
+
This package is [ESM only][esm].
|
| 56 |
+
In Node.js (version 16+), install with [npm][]:
|
| 57 |
+
|
| 58 |
+
```sh
|
| 59 |
+
npm install micromark-extension-gfm-task-list-item
|
| 60 |
+
```
|
| 61 |
+
|
| 62 |
+
In Deno with [`esm.sh`][esmsh]:
|
| 63 |
+
|
| 64 |
+
```js
|
| 65 |
+
import {gfmTaskListItem, gfmTaskListItemHtml} from 'https://esm.sh/micromark-extension-gfm-task-list-item@2'
|
| 66 |
+
```
|
| 67 |
+
|
| 68 |
+
In browsers with [`esm.sh`][esmsh]:
|
| 69 |
+
|
| 70 |
+
```html
|
| 71 |
+
<script type="module">
|
| 72 |
+
import {gfmTaskListItem, gfmTaskListItemHtml} from 'https://esm.sh/micromark-extension-gfm-task-list-item@2?bundle'
|
| 73 |
+
</script>
|
| 74 |
+
```
|
| 75 |
+
|
| 76 |
+
## Use
|
| 77 |
+
|
| 78 |
+
```js
|
| 79 |
+
import {micromark} from 'micromark'
|
| 80 |
+
import {
|
| 81 |
+
gfmTaskListItem,
|
| 82 |
+
gfmTaskListItemHtml
|
| 83 |
+
} from 'micromark-extension-gfm-task-list-item'
|
| 84 |
+
|
| 85 |
+
const output = micromark('* [x] a\n* [ ] b', {
|
| 86 |
+
extensions: [gfmTaskListItem()],
|
| 87 |
+
htmlExtensions: [gfmTaskListItemHtml()]
|
| 88 |
+
})
|
| 89 |
+
|
| 90 |
+
console.log(output)
|
| 91 |
+
```
|
| 92 |
+
|
| 93 |
+
Yields:
|
| 94 |
+
|
| 95 |
+
```html
|
| 96 |
+
<ul>
|
| 97 |
+
<li><input type="checkbox" disabled="" checked="" /> a</li>
|
| 98 |
+
<li><input type="checkbox" disabled="" /> b</li>
|
| 99 |
+
</ul>
|
| 100 |
+
```
|
| 101 |
+
|
| 102 |
+
## API
|
| 103 |
+
|
| 104 |
+
This package exports the identifiers [`gfmTaskListItem`][api-gfm-task-list-item]
|
| 105 |
+
and [`gfmTaskListItemHtml`][api-gfm-task-list-item-html].
|
| 106 |
+
There is no default export.
|
| 107 |
+
|
| 108 |
+
The export map supports the [`development` condition][development].
|
| 109 |
+
Run `node --conditions development module.js` to get instrumented dev code.
|
| 110 |
+
Without this condition, production code is loaded.
|
| 111 |
+
|
| 112 |
+
### `gfmTaskListItem()`
|
| 113 |
+
|
| 114 |
+
Create an HTML extension for `micromark` to support GFM task list items
|
| 115 |
+
syntax.
|
| 116 |
+
|
| 117 |
+
###### Returns
|
| 118 |
+
|
| 119 |
+
Extension for `micromark` that can be passed in `extensions`, to enable GFM
|
| 120 |
+
task list items syntax ([`Extension`][micromark-extension]).
|
| 121 |
+
|
| 122 |
+
### `gfmTaskListItemHtml()`
|
| 123 |
+
|
| 124 |
+
Create an HTML extension for `micromark` to support GFM task list items when
|
| 125 |
+
serializing to HTML.
|
| 126 |
+
|
| 127 |
+
###### Returns
|
| 128 |
+
|
| 129 |
+
Extension for `micromark` that can be passed in `htmlExtensions` to support GFM
|
| 130 |
+
task list items when serializing to HTML
|
| 131 |
+
([`HtmlExtension`][micromark-html-extension]).
|
| 132 |
+
|
| 133 |
+
## Authoring
|
| 134 |
+
|
| 135 |
+
It is recommended to use lowercase `x` (instead of uppercase `X`), because in
|
| 136 |
+
markdown, it is more common to use lowercase in places where casing does not
|
| 137 |
+
matter.
|
| 138 |
+
It is also recommended to use a space (instead of a tab), as there is no benefit
|
| 139 |
+
of using tabs in this case.
|
| 140 |
+
|
| 141 |
+
## HTML
|
| 142 |
+
|
| 143 |
+
Checks relate to the `<input>` element, in the checkbox state (`type=checkbox`),
|
| 144 |
+
in HTML.
|
| 145 |
+
See [*§ 4.10.5.1.15 Checkbox state (`type=checkbox`)*][html-input-checkbox]
|
| 146 |
+
in the HTML spec for more info.
|
| 147 |
+
|
| 148 |
+
```html
|
| 149 |
+
<!--…-->
|
| 150 |
+
<li><input type="checkbox" disabled="" /> foo</li>
|
| 151 |
+
<li><input type="checkbox" disabled="" checked="" /> bar</li>
|
| 152 |
+
<!--…-->
|
| 153 |
+
```
|
| 154 |
+
|
| 155 |
+
## CSS
|
| 156 |
+
|
| 157 |
+
GitHub itself uses slightly different markup for task list items than they
|
| 158 |
+
define in their spec.
|
| 159 |
+
When following the spec, as this extension does, only inputs are added.
|
| 160 |
+
They can be styled with the following CSS:
|
| 161 |
+
|
| 162 |
+
```css
|
| 163 |
+
input[type="checkbox"] {
|
| 164 |
+
margin: 0 .2em .25em -1.6em;
|
| 165 |
+
vertical-align: middle;
|
| 166 |
+
}
|
| 167 |
+
|
| 168 |
+
input[type="checkbox"]:dir(rtl) {
|
| 169 |
+
margin: 0 -1.6em .25em .2em;
|
| 170 |
+
}
|
| 171 |
+
```
|
| 172 |
+
|
| 173 |
+
For the complete actual CSS see
|
| 174 |
+
[`sindresorhus/github-markdown-css`][github-markdown-css].
|
| 175 |
+
|
| 176 |
+
## Syntax
|
| 177 |
+
|
| 178 |
+
Checks form with the following BNF:
|
| 179 |
+
|
| 180 |
+
```bnf
|
| 181 |
+
gfm_task_list_item_check ::= '[' (0x09 | ' ' | 'X' | 'x') ']'
|
| 182 |
+
```
|
| 183 |
+
|
| 184 |
+
The check is only allowed at the start of the first paragraph, optionally
|
| 185 |
+
following zero or more definitions or a blank line, in a list item.
|
| 186 |
+
The check must be followed by whitespace (`[\t\n\r ]*`), which is in turn
|
| 187 |
+
followed by non-whitespace.
|
| 188 |
+
|
| 189 |
+
## Types
|
| 190 |
+
|
| 191 |
+
This package is fully typed with [TypeScript][].
|
| 192 |
+
It exports no additional types.
|
| 193 |
+
|
| 194 |
+
## Compatibility
|
| 195 |
+
|
| 196 |
+
Projects maintained by the unified collective are compatible with maintained
|
| 197 |
+
versions of Node.js.
|
| 198 |
+
|
| 199 |
+
When we cut a new major release, we drop support for unmaintained versions of
|
| 200 |
+
Node.
|
| 201 |
+
This means we try to keep the current release line,
|
| 202 |
+
`micromark-extension-gfm-task-list-item@^2`, compatible with Node.js 16.
|
| 203 |
+
|
| 204 |
+
This package works with `micromark` version `3` and later.
|
| 205 |
+
|
| 206 |
+
## Security
|
| 207 |
+
|
| 208 |
+
This package is safe.
|
| 209 |
+
|
| 210 |
+
## Related
|
| 211 |
+
|
| 212 |
+
* [`micromark-extension-gfm`][micromark-extension-gfm]
|
| 213 |
+
— support all of GFM
|
| 214 |
+
* [`mdast-util-gfm-task-list-item`][mdast-util-gfm-task-list-item]
|
| 215 |
+
— support all of GFM in mdast
|
| 216 |
+
* [`mdast-util-gfm`][mdast-util-gfm]
|
| 217 |
+
— support all of GFM in mdast
|
| 218 |
+
* [`remark-gfm`][remark-gfm]
|
| 219 |
+
— support all of GFM in remark
|
| 220 |
+
|
| 221 |
+
## Contribute
|
| 222 |
+
|
| 223 |
+
See [`contributing.md` in `micromark/.github`][contributing] for ways to get
|
| 224 |
+
started.
|
| 225 |
+
See [`support.md`][support] for ways to get help.
|
| 226 |
+
|
| 227 |
+
This project has a [code of conduct][coc].
|
| 228 |
+
By interacting with this repository, organization, or community you agree to
|
| 229 |
+
abide by its terms.
|
| 230 |
+
|
| 231 |
+
## License
|
| 232 |
+
|
| 233 |
+
[MIT][license] © [Titus Wormer][author]
|
| 234 |
+
|
| 235 |
+
<!-- Definitions -->
|
| 236 |
+
|
| 237 |
+
[build-badge]: https://github.com/micromark/micromark-extension-gfm-task-list-item/workflows/main/badge.svg
|
| 238 |
+
|
| 239 |
+
[build]: https://github.com/micromark/micromark-extension-gfm-task-list-item/actions
|
| 240 |
+
|
| 241 |
+
[coverage-badge]: https://img.shields.io/codecov/c/github/micromark/micromark-extension-gfm-task-list-item.svg
|
| 242 |
+
|
| 243 |
+
[coverage]: https://codecov.io/github/micromark/micromark-extension-gfm-task-list-item
|
| 244 |
+
|
| 245 |
+
[downloads-badge]: https://img.shields.io/npm/dm/micromark-extension-gfm-task-list-item.svg
|
| 246 |
+
|
| 247 |
+
[downloads]: https://www.npmjs.com/package/micromark-extension-gfm-task-list-item
|
| 248 |
+
|
| 249 |
+
[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
|
| 250 |
+
|
| 251 |
+
[size]: https://bundlejs.com/?q=micromark-extension-gfm-task-list-item
|
| 252 |
+
|
| 253 |
+
[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg
|
| 254 |
+
|
| 255 |
+
[backers-badge]: https://opencollective.com/unified/backers/badge.svg
|
| 256 |
+
|
| 257 |
+
[collective]: https://opencollective.com/unified
|
| 258 |
+
|
| 259 |
+
[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg
|
| 260 |
+
|
| 261 |
+
[chat]: https://github.com/micromark/micromark/discussions
|
| 262 |
+
|
| 263 |
+
[npm]: https://docs.npmjs.com/cli/install
|
| 264 |
+
|
| 265 |
+
[esmsh]: https://esm.sh
|
| 266 |
+
|
| 267 |
+
[license]: license
|
| 268 |
+
|
| 269 |
+
[author]: https://wooorm.com
|
| 270 |
+
|
| 271 |
+
[contributing]: https://github.com/micromark/.github/blob/main/contributing.md
|
| 272 |
+
|
| 273 |
+
[support]: https://github.com/micromark/.github/blob/main/support.md
|
| 274 |
+
|
| 275 |
+
[coc]: https://github.com/micromark/.github/blob/main/code-of-conduct.md
|
| 276 |
+
|
| 277 |
+
[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c
|
| 278 |
+
|
| 279 |
+
[typescript]: https://www.typescriptlang.org
|
| 280 |
+
|
| 281 |
+
[development]: https://nodejs.org/api/packages.html#packages_resolving_user_conditions
|
| 282 |
+
|
| 283 |
+
[micromark]: https://github.com/micromark/micromark
|
| 284 |
+
|
| 285 |
+
[micromark-html-extension]: https://github.com/micromark/micromark#htmlextension
|
| 286 |
+
|
| 287 |
+
[micromark-extension]: https://github.com/micromark/micromark#syntaxextension
|
| 288 |
+
|
| 289 |
+
[micromark-extension-gfm]: https://github.com/micromark/micromark-extension-gfm
|
| 290 |
+
|
| 291 |
+
[mdast-util-gfm-task-list-item]: https://github.com/syntax-tree/mdast-util-gfm-task-list-item
|
| 292 |
+
|
| 293 |
+
[mdast-util-gfm]: https://github.com/syntax-tree/mdast-util-gfm
|
| 294 |
+
|
| 295 |
+
[remark-gfm]: https://github.com/remarkjs/remark-gfm
|
| 296 |
+
|
| 297 |
+
[task list items]: https://github.github.com/gfm/#task-list-items-extension-
|
| 298 |
+
|
| 299 |
+
[github-markdown-css]: https://github.com/sindresorhus/github-markdown-css
|
| 300 |
+
|
| 301 |
+
[html-input-checkbox]: https://html.spec.whatwg.org/multipage/input.html#checkbox-state-\(type=checkbox\)
|
| 302 |
+
|
| 303 |
+
[api-gfm-task-list-item]: #gfmtasklistitem
|
| 304 |
+
|
| 305 |
+
[api-gfm-task-list-item-html]: #gfmtasklistitemhtml
|
node_modules/micromark-factory-destination/dev/index.d.ts
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* Parse destinations.
|
| 3 |
+
*
|
| 4 |
+
* ###### Examples
|
| 5 |
+
*
|
| 6 |
+
* ```markdown
|
| 7 |
+
* <a>
|
| 8 |
+
* <a\>b>
|
| 9 |
+
* <a b>
|
| 10 |
+
* <a)>
|
| 11 |
+
* a
|
| 12 |
+
* a\)b
|
| 13 |
+
* a(b)c
|
| 14 |
+
* a(b)
|
| 15 |
+
* ```
|
| 16 |
+
*
|
| 17 |
+
* @param {Effects} effects
|
| 18 |
+
* Context.
|
| 19 |
+
* @param {State} ok
|
| 20 |
+
* State switched to when successful.
|
| 21 |
+
* @param {State} nok
|
| 22 |
+
* State switched to when unsuccessful.
|
| 23 |
+
* @param {TokenType} type
|
| 24 |
+
* Type for whole (`<a>` or `b`).
|
| 25 |
+
* @param {TokenType} literalType
|
| 26 |
+
* Type when enclosed (`<a>`).
|
| 27 |
+
* @param {TokenType} literalMarkerType
|
| 28 |
+
* Type for enclosing (`<` and `>`).
|
| 29 |
+
* @param {TokenType} rawType
|
| 30 |
+
* Type when not enclosed (`b`).
|
| 31 |
+
* @param {TokenType} stringType
|
| 32 |
+
* Type for the value (`a` or `b`).
|
| 33 |
+
* @param {number | undefined} [max=Infinity]
|
| 34 |
+
* Depth of nested parens (inclusive).
|
| 35 |
+
* @returns {State}
|
| 36 |
+
* Start state.
|
| 37 |
+
*/
|
| 38 |
+
export function factoryDestination(effects: Effects, ok: State, nok: State, type: TokenType, literalType: TokenType, literalMarkerType: TokenType, rawType: TokenType, stringType: TokenType, max?: number | undefined): State;
|
| 39 |
+
import type { Effects } from 'micromark-util-types';
|
| 40 |
+
import type { State } from 'micromark-util-types';
|
| 41 |
+
import type { TokenType } from 'micromark-util-types';
|
| 42 |
+
//# sourceMappingURL=index.d.ts.map
|
node_modules/micromark-factory-destination/dev/index.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":"AAWA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,4CArBW,OAAO,MAEP,KAAK,OAEL,KAAK,QAEL,SAAS,eAET,SAAS,qBAET,SAAS,WAET,SAAS,cAET,SAAS,QAET,MAAM,GAAG,SAAS,GAEhB,KAAK,CAiNjB;6BA7P2C,sBAAsB;2BAAtB,sBAAsB;+BAAtB,sBAAsB"}
|
node_modules/micromark-factory-destination/dev/index.js
ADDED
|
@@ -0,0 +1,255 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* @import {Effects, State, TokenType} from 'micromark-util-types'
|
| 3 |
+
*/
|
| 4 |
+
|
| 5 |
+
import {
|
| 6 |
+
asciiControl,
|
| 7 |
+
markdownLineEndingOrSpace,
|
| 8 |
+
markdownLineEnding
|
| 9 |
+
} from 'micromark-util-character'
|
| 10 |
+
import {codes, constants, types} from 'micromark-util-symbol'
|
| 11 |
+
|
| 12 |
+
/**
|
| 13 |
+
* Parse destinations.
|
| 14 |
+
*
|
| 15 |
+
* ###### Examples
|
| 16 |
+
*
|
| 17 |
+
* ```markdown
|
| 18 |
+
* <a>
|
| 19 |
+
* <a\>b>
|
| 20 |
+
* <a b>
|
| 21 |
+
* <a)>
|
| 22 |
+
* a
|
| 23 |
+
* a\)b
|
| 24 |
+
* a(b)c
|
| 25 |
+
* a(b)
|
| 26 |
+
* ```
|
| 27 |
+
*
|
| 28 |
+
* @param {Effects} effects
|
| 29 |
+
* Context.
|
| 30 |
+
* @param {State} ok
|
| 31 |
+
* State switched to when successful.
|
| 32 |
+
* @param {State} nok
|
| 33 |
+
* State switched to when unsuccessful.
|
| 34 |
+
* @param {TokenType} type
|
| 35 |
+
* Type for whole (`<a>` or `b`).
|
| 36 |
+
* @param {TokenType} literalType
|
| 37 |
+
* Type when enclosed (`<a>`).
|
| 38 |
+
* @param {TokenType} literalMarkerType
|
| 39 |
+
* Type for enclosing (`<` and `>`).
|
| 40 |
+
* @param {TokenType} rawType
|
| 41 |
+
* Type when not enclosed (`b`).
|
| 42 |
+
* @param {TokenType} stringType
|
| 43 |
+
* Type for the value (`a` or `b`).
|
| 44 |
+
* @param {number | undefined} [max=Infinity]
|
| 45 |
+
* Depth of nested parens (inclusive).
|
| 46 |
+
* @returns {State}
|
| 47 |
+
* Start state.
|
| 48 |
+
*/
|
| 49 |
+
export function factoryDestination(
|
| 50 |
+
effects,
|
| 51 |
+
ok,
|
| 52 |
+
nok,
|
| 53 |
+
type,
|
| 54 |
+
literalType,
|
| 55 |
+
literalMarkerType,
|
| 56 |
+
rawType,
|
| 57 |
+
stringType,
|
| 58 |
+
max
|
| 59 |
+
) {
|
| 60 |
+
const limit = max || Number.POSITIVE_INFINITY
|
| 61 |
+
let balance = 0
|
| 62 |
+
|
| 63 |
+
return start
|
| 64 |
+
|
| 65 |
+
/**
|
| 66 |
+
* Start of destination.
|
| 67 |
+
*
|
| 68 |
+
* ```markdown
|
| 69 |
+
* > | <aa>
|
| 70 |
+
* ^
|
| 71 |
+
* > | aa
|
| 72 |
+
* ^
|
| 73 |
+
* ```
|
| 74 |
+
*
|
| 75 |
+
* @type {State}
|
| 76 |
+
*/
|
| 77 |
+
function start(code) {
|
| 78 |
+
if (code === codes.lessThan) {
|
| 79 |
+
effects.enter(type)
|
| 80 |
+
effects.enter(literalType)
|
| 81 |
+
effects.enter(literalMarkerType)
|
| 82 |
+
effects.consume(code)
|
| 83 |
+
effects.exit(literalMarkerType)
|
| 84 |
+
return enclosedBefore
|
| 85 |
+
}
|
| 86 |
+
|
| 87 |
+
// ASCII control, space, closing paren.
|
| 88 |
+
if (
|
| 89 |
+
code === codes.eof ||
|
| 90 |
+
code === codes.space ||
|
| 91 |
+
code === codes.rightParenthesis ||
|
| 92 |
+
asciiControl(code)
|
| 93 |
+
) {
|
| 94 |
+
return nok(code)
|
| 95 |
+
}
|
| 96 |
+
|
| 97 |
+
effects.enter(type)
|
| 98 |
+
effects.enter(rawType)
|
| 99 |
+
effects.enter(stringType)
|
| 100 |
+
effects.enter(types.chunkString, {contentType: constants.contentTypeString})
|
| 101 |
+
return raw(code)
|
| 102 |
+
}
|
| 103 |
+
|
| 104 |
+
/**
|
| 105 |
+
* After `<`, at an enclosed destination.
|
| 106 |
+
*
|
| 107 |
+
* ```markdown
|
| 108 |
+
* > | <aa>
|
| 109 |
+
* ^
|
| 110 |
+
* ```
|
| 111 |
+
*
|
| 112 |
+
* @type {State}
|
| 113 |
+
*/
|
| 114 |
+
function enclosedBefore(code) {
|
| 115 |
+
if (code === codes.greaterThan) {
|
| 116 |
+
effects.enter(literalMarkerType)
|
| 117 |
+
effects.consume(code)
|
| 118 |
+
effects.exit(literalMarkerType)
|
| 119 |
+
effects.exit(literalType)
|
| 120 |
+
effects.exit(type)
|
| 121 |
+
return ok
|
| 122 |
+
}
|
| 123 |
+
|
| 124 |
+
effects.enter(stringType)
|
| 125 |
+
effects.enter(types.chunkString, {contentType: constants.contentTypeString})
|
| 126 |
+
return enclosed(code)
|
| 127 |
+
}
|
| 128 |
+
|
| 129 |
+
/**
|
| 130 |
+
* In enclosed destination.
|
| 131 |
+
*
|
| 132 |
+
* ```markdown
|
| 133 |
+
* > | <aa>
|
| 134 |
+
* ^
|
| 135 |
+
* ```
|
| 136 |
+
*
|
| 137 |
+
* @type {State}
|
| 138 |
+
*/
|
| 139 |
+
function enclosed(code) {
|
| 140 |
+
if (code === codes.greaterThan) {
|
| 141 |
+
effects.exit(types.chunkString)
|
| 142 |
+
effects.exit(stringType)
|
| 143 |
+
return enclosedBefore(code)
|
| 144 |
+
}
|
| 145 |
+
|
| 146 |
+
if (
|
| 147 |
+
code === codes.eof ||
|
| 148 |
+
code === codes.lessThan ||
|
| 149 |
+
markdownLineEnding(code)
|
| 150 |
+
) {
|
| 151 |
+
return nok(code)
|
| 152 |
+
}
|
| 153 |
+
|
| 154 |
+
effects.consume(code)
|
| 155 |
+
return code === codes.backslash ? enclosedEscape : enclosed
|
| 156 |
+
}
|
| 157 |
+
|
| 158 |
+
/**
|
| 159 |
+
* After `\`, at a special character.
|
| 160 |
+
*
|
| 161 |
+
* ```markdown
|
| 162 |
+
* > | <a\*a>
|
| 163 |
+
* ^
|
| 164 |
+
* ```
|
| 165 |
+
*
|
| 166 |
+
* @type {State}
|
| 167 |
+
*/
|
| 168 |
+
function enclosedEscape(code) {
|
| 169 |
+
if (
|
| 170 |
+
code === codes.lessThan ||
|
| 171 |
+
code === codes.greaterThan ||
|
| 172 |
+
code === codes.backslash
|
| 173 |
+
) {
|
| 174 |
+
effects.consume(code)
|
| 175 |
+
return enclosed
|
| 176 |
+
}
|
| 177 |
+
|
| 178 |
+
return enclosed(code)
|
| 179 |
+
}
|
| 180 |
+
|
| 181 |
+
/**
|
| 182 |
+
* In raw destination.
|
| 183 |
+
*
|
| 184 |
+
* ```markdown
|
| 185 |
+
* > | aa
|
| 186 |
+
* ^
|
| 187 |
+
* ```
|
| 188 |
+
*
|
| 189 |
+
* @type {State}
|
| 190 |
+
*/
|
| 191 |
+
function raw(code) {
|
| 192 |
+
if (
|
| 193 |
+
!balance &&
|
| 194 |
+
(code === codes.eof ||
|
| 195 |
+
code === codes.rightParenthesis ||
|
| 196 |
+
markdownLineEndingOrSpace(code))
|
| 197 |
+
) {
|
| 198 |
+
effects.exit(types.chunkString)
|
| 199 |
+
effects.exit(stringType)
|
| 200 |
+
effects.exit(rawType)
|
| 201 |
+
effects.exit(type)
|
| 202 |
+
return ok(code)
|
| 203 |
+
}
|
| 204 |
+
|
| 205 |
+
if (balance < limit && code === codes.leftParenthesis) {
|
| 206 |
+
effects.consume(code)
|
| 207 |
+
balance++
|
| 208 |
+
return raw
|
| 209 |
+
}
|
| 210 |
+
|
| 211 |
+
if (code === codes.rightParenthesis) {
|
| 212 |
+
effects.consume(code)
|
| 213 |
+
balance--
|
| 214 |
+
return raw
|
| 215 |
+
}
|
| 216 |
+
|
| 217 |
+
// ASCII control (but *not* `\0`) and space and `(`.
|
| 218 |
+
// Note: in `markdown-rs`, `\0` exists in codes, in `micromark-js` it
|
| 219 |
+
// doesn’t.
|
| 220 |
+
if (
|
| 221 |
+
code === codes.eof ||
|
| 222 |
+
code === codes.space ||
|
| 223 |
+
code === codes.leftParenthesis ||
|
| 224 |
+
asciiControl(code)
|
| 225 |
+
) {
|
| 226 |
+
return nok(code)
|
| 227 |
+
}
|
| 228 |
+
|
| 229 |
+
effects.consume(code)
|
| 230 |
+
return code === codes.backslash ? rawEscape : raw
|
| 231 |
+
}
|
| 232 |
+
|
| 233 |
+
/**
|
| 234 |
+
* After `\`, at special character.
|
| 235 |
+
*
|
| 236 |
+
* ```markdown
|
| 237 |
+
* > | a\*a
|
| 238 |
+
* ^
|
| 239 |
+
* ```
|
| 240 |
+
*
|
| 241 |
+
* @type {State}
|
| 242 |
+
*/
|
| 243 |
+
function rawEscape(code) {
|
| 244 |
+
if (
|
| 245 |
+
code === codes.leftParenthesis ||
|
| 246 |
+
code === codes.rightParenthesis ||
|
| 247 |
+
code === codes.backslash
|
| 248 |
+
) {
|
| 249 |
+
effects.consume(code)
|
| 250 |
+
return raw
|
| 251 |
+
}
|
| 252 |
+
|
| 253 |
+
return raw(code)
|
| 254 |
+
}
|
| 255 |
+
}
|
node_modules/micromark-factory-destination/index.d.ts
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* Parse destinations.
|
| 3 |
+
*
|
| 4 |
+
* ###### Examples
|
| 5 |
+
*
|
| 6 |
+
* ```markdown
|
| 7 |
+
* <a>
|
| 8 |
+
* <a\>b>
|
| 9 |
+
* <a b>
|
| 10 |
+
* <a)>
|
| 11 |
+
* a
|
| 12 |
+
* a\)b
|
| 13 |
+
* a(b)c
|
| 14 |
+
* a(b)
|
| 15 |
+
* ```
|
| 16 |
+
*
|
| 17 |
+
* @param {Effects} effects
|
| 18 |
+
* Context.
|
| 19 |
+
* @param {State} ok
|
| 20 |
+
* State switched to when successful.
|
| 21 |
+
* @param {State} nok
|
| 22 |
+
* State switched to when unsuccessful.
|
| 23 |
+
* @param {TokenType} type
|
| 24 |
+
* Type for whole (`<a>` or `b`).
|
| 25 |
+
* @param {TokenType} literalType
|
| 26 |
+
* Type when enclosed (`<a>`).
|
| 27 |
+
* @param {TokenType} literalMarkerType
|
| 28 |
+
* Type for enclosing (`<` and `>`).
|
| 29 |
+
* @param {TokenType} rawType
|
| 30 |
+
* Type when not enclosed (`b`).
|
| 31 |
+
* @param {TokenType} stringType
|
| 32 |
+
* Type for the value (`a` or `b`).
|
| 33 |
+
* @param {number | undefined} [max=Infinity]
|
| 34 |
+
* Depth of nested parens (inclusive).
|
| 35 |
+
* @returns {State}
|
| 36 |
+
* Start state.
|
| 37 |
+
*/
|
| 38 |
+
export function factoryDestination(effects: Effects, ok: State, nok: State, type: TokenType, literalType: TokenType, literalMarkerType: TokenType, rawType: TokenType, stringType: TokenType, max?: number | undefined): State;
|
| 39 |
+
import type { Effects } from 'micromark-util-types';
|
| 40 |
+
import type { State } from 'micromark-util-types';
|
| 41 |
+
import type { TokenType } from 'micromark-util-types';
|
| 42 |
+
//# sourceMappingURL=index.d.ts.map
|
node_modules/micromark-factory-destination/index.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":"AAWA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,4CArBW,OAAO,MAEP,KAAK,OAEL,KAAK,QAEL,SAAS,eAET,SAAS,qBAET,SAAS,WAET,SAAS,cAET,SAAS,QAET,MAAM,GAAG,SAAS,GAEhB,KAAK,CAiNjB;6BA7P2C,sBAAsB;2BAAtB,sBAAsB;+BAAtB,sBAAsB"}
|
node_modules/micromark-factory-destination/index.js
ADDED
|
@@ -0,0 +1,206 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* @import {Effects, State, TokenType} from 'micromark-util-types'
|
| 3 |
+
*/
|
| 4 |
+
|
| 5 |
+
import { asciiControl, markdownLineEndingOrSpace, markdownLineEnding } from 'micromark-util-character';
|
| 6 |
+
/**
|
| 7 |
+
* Parse destinations.
|
| 8 |
+
*
|
| 9 |
+
* ###### Examples
|
| 10 |
+
*
|
| 11 |
+
* ```markdown
|
| 12 |
+
* <a>
|
| 13 |
+
* <a\>b>
|
| 14 |
+
* <a b>
|
| 15 |
+
* <a)>
|
| 16 |
+
* a
|
| 17 |
+
* a\)b
|
| 18 |
+
* a(b)c
|
| 19 |
+
* a(b)
|
| 20 |
+
* ```
|
| 21 |
+
*
|
| 22 |
+
* @param {Effects} effects
|
| 23 |
+
* Context.
|
| 24 |
+
* @param {State} ok
|
| 25 |
+
* State switched to when successful.
|
| 26 |
+
* @param {State} nok
|
| 27 |
+
* State switched to when unsuccessful.
|
| 28 |
+
* @param {TokenType} type
|
| 29 |
+
* Type for whole (`<a>` or `b`).
|
| 30 |
+
* @param {TokenType} literalType
|
| 31 |
+
* Type when enclosed (`<a>`).
|
| 32 |
+
* @param {TokenType} literalMarkerType
|
| 33 |
+
* Type for enclosing (`<` and `>`).
|
| 34 |
+
* @param {TokenType} rawType
|
| 35 |
+
* Type when not enclosed (`b`).
|
| 36 |
+
* @param {TokenType} stringType
|
| 37 |
+
* Type for the value (`a` or `b`).
|
| 38 |
+
* @param {number | undefined} [max=Infinity]
|
| 39 |
+
* Depth of nested parens (inclusive).
|
| 40 |
+
* @returns {State}
|
| 41 |
+
* Start state.
|
| 42 |
+
*/
|
| 43 |
+
export function factoryDestination(effects, ok, nok, type, literalType, literalMarkerType, rawType, stringType, max) {
|
| 44 |
+
const limit = max || Number.POSITIVE_INFINITY;
|
| 45 |
+
let balance = 0;
|
| 46 |
+
return start;
|
| 47 |
+
|
| 48 |
+
/**
|
| 49 |
+
* Start of destination.
|
| 50 |
+
*
|
| 51 |
+
* ```markdown
|
| 52 |
+
* > | <aa>
|
| 53 |
+
* ^
|
| 54 |
+
* > | aa
|
| 55 |
+
* ^
|
| 56 |
+
* ```
|
| 57 |
+
*
|
| 58 |
+
* @type {State}
|
| 59 |
+
*/
|
| 60 |
+
function start(code) {
|
| 61 |
+
if (code === 60) {
|
| 62 |
+
effects.enter(type);
|
| 63 |
+
effects.enter(literalType);
|
| 64 |
+
effects.enter(literalMarkerType);
|
| 65 |
+
effects.consume(code);
|
| 66 |
+
effects.exit(literalMarkerType);
|
| 67 |
+
return enclosedBefore;
|
| 68 |
+
}
|
| 69 |
+
|
| 70 |
+
// ASCII control, space, closing paren.
|
| 71 |
+
if (code === null || code === 32 || code === 41 || asciiControl(code)) {
|
| 72 |
+
return nok(code);
|
| 73 |
+
}
|
| 74 |
+
effects.enter(type);
|
| 75 |
+
effects.enter(rawType);
|
| 76 |
+
effects.enter(stringType);
|
| 77 |
+
effects.enter("chunkString", {
|
| 78 |
+
contentType: "string"
|
| 79 |
+
});
|
| 80 |
+
return raw(code);
|
| 81 |
+
}
|
| 82 |
+
|
| 83 |
+
/**
|
| 84 |
+
* After `<`, at an enclosed destination.
|
| 85 |
+
*
|
| 86 |
+
* ```markdown
|
| 87 |
+
* > | <aa>
|
| 88 |
+
* ^
|
| 89 |
+
* ```
|
| 90 |
+
*
|
| 91 |
+
* @type {State}
|
| 92 |
+
*/
|
| 93 |
+
function enclosedBefore(code) {
|
| 94 |
+
if (code === 62) {
|
| 95 |
+
effects.enter(literalMarkerType);
|
| 96 |
+
effects.consume(code);
|
| 97 |
+
effects.exit(literalMarkerType);
|
| 98 |
+
effects.exit(literalType);
|
| 99 |
+
effects.exit(type);
|
| 100 |
+
return ok;
|
| 101 |
+
}
|
| 102 |
+
effects.enter(stringType);
|
| 103 |
+
effects.enter("chunkString", {
|
| 104 |
+
contentType: "string"
|
| 105 |
+
});
|
| 106 |
+
return enclosed(code);
|
| 107 |
+
}
|
| 108 |
+
|
| 109 |
+
/**
|
| 110 |
+
* In enclosed destination.
|
| 111 |
+
*
|
| 112 |
+
* ```markdown
|
| 113 |
+
* > | <aa>
|
| 114 |
+
* ^
|
| 115 |
+
* ```
|
| 116 |
+
*
|
| 117 |
+
* @type {State}
|
| 118 |
+
*/
|
| 119 |
+
function enclosed(code) {
|
| 120 |
+
if (code === 62) {
|
| 121 |
+
effects.exit("chunkString");
|
| 122 |
+
effects.exit(stringType);
|
| 123 |
+
return enclosedBefore(code);
|
| 124 |
+
}
|
| 125 |
+
if (code === null || code === 60 || markdownLineEnding(code)) {
|
| 126 |
+
return nok(code);
|
| 127 |
+
}
|
| 128 |
+
effects.consume(code);
|
| 129 |
+
return code === 92 ? enclosedEscape : enclosed;
|
| 130 |
+
}
|
| 131 |
+
|
| 132 |
+
/**
|
| 133 |
+
* After `\`, at a special character.
|
| 134 |
+
*
|
| 135 |
+
* ```markdown
|
| 136 |
+
* > | <a\*a>
|
| 137 |
+
* ^
|
| 138 |
+
* ```
|
| 139 |
+
*
|
| 140 |
+
* @type {State}
|
| 141 |
+
*/
|
| 142 |
+
function enclosedEscape(code) {
|
| 143 |
+
if (code === 60 || code === 62 || code === 92) {
|
| 144 |
+
effects.consume(code);
|
| 145 |
+
return enclosed;
|
| 146 |
+
}
|
| 147 |
+
return enclosed(code);
|
| 148 |
+
}
|
| 149 |
+
|
| 150 |
+
/**
|
| 151 |
+
* In raw destination.
|
| 152 |
+
*
|
| 153 |
+
* ```markdown
|
| 154 |
+
* > | aa
|
| 155 |
+
* ^
|
| 156 |
+
* ```
|
| 157 |
+
*
|
| 158 |
+
* @type {State}
|
| 159 |
+
*/
|
| 160 |
+
function raw(code) {
|
| 161 |
+
if (!balance && (code === null || code === 41 || markdownLineEndingOrSpace(code))) {
|
| 162 |
+
effects.exit("chunkString");
|
| 163 |
+
effects.exit(stringType);
|
| 164 |
+
effects.exit(rawType);
|
| 165 |
+
effects.exit(type);
|
| 166 |
+
return ok(code);
|
| 167 |
+
}
|
| 168 |
+
if (balance < limit && code === 40) {
|
| 169 |
+
effects.consume(code);
|
| 170 |
+
balance++;
|
| 171 |
+
return raw;
|
| 172 |
+
}
|
| 173 |
+
if (code === 41) {
|
| 174 |
+
effects.consume(code);
|
| 175 |
+
balance--;
|
| 176 |
+
return raw;
|
| 177 |
+
}
|
| 178 |
+
|
| 179 |
+
// ASCII control (but *not* `\0`) and space and `(`.
|
| 180 |
+
// Note: in `markdown-rs`, `\0` exists in codes, in `micromark-js` it
|
| 181 |
+
// doesn’t.
|
| 182 |
+
if (code === null || code === 32 || code === 40 || asciiControl(code)) {
|
| 183 |
+
return nok(code);
|
| 184 |
+
}
|
| 185 |
+
effects.consume(code);
|
| 186 |
+
return code === 92 ? rawEscape : raw;
|
| 187 |
+
}
|
| 188 |
+
|
| 189 |
+
/**
|
| 190 |
+
* After `\`, at special character.
|
| 191 |
+
*
|
| 192 |
+
* ```markdown
|
| 193 |
+
* > | a\*a
|
| 194 |
+
* ^
|
| 195 |
+
* ```
|
| 196 |
+
*
|
| 197 |
+
* @type {State}
|
| 198 |
+
*/
|
| 199 |
+
function rawEscape(code) {
|
| 200 |
+
if (code === 40 || code === 41 || code === 92) {
|
| 201 |
+
effects.consume(code);
|
| 202 |
+
return raw;
|
| 203 |
+
}
|
| 204 |
+
return raw(code);
|
| 205 |
+
}
|
| 206 |
+
}
|
node_modules/micromark-factory-destination/license
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
(The MIT License)
|
| 2 |
+
|
| 3 |
+
Copyright (c) Titus Wormer <tituswormer@gmail.com>
|
| 4 |
+
|
| 5 |
+
Permission is hereby granted, free of charge, to any person obtaining
|
| 6 |
+
a copy of this software and associated documentation files (the
|
| 7 |
+
'Software'), to deal in the Software without restriction, including
|
| 8 |
+
without limitation the rights to use, copy, modify, merge, publish,
|
| 9 |
+
distribute, sublicense, and/or sell copies of the Software, and to
|
| 10 |
+
permit persons to whom the Software is furnished to do so, subject to
|
| 11 |
+
the following conditions:
|
| 12 |
+
|
| 13 |
+
The above copyright notice and this permission notice shall be
|
| 14 |
+
included in all copies or substantial portions of the Software.
|
| 15 |
+
|
| 16 |
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
| 17 |
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
| 18 |
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
| 19 |
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
| 20 |
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
| 21 |
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
| 22 |
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
node_modules/micromark-factory-destination/package.json
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"name": "micromark-factory-destination",
|
| 3 |
+
"version": "2.0.1",
|
| 4 |
+
"description": "micromark factory to parse destinations (found in resources, definitions)",
|
| 5 |
+
"license": "MIT",
|
| 6 |
+
"keywords": [
|
| 7 |
+
"micromark",
|
| 8 |
+
"factory",
|
| 9 |
+
"destination"
|
| 10 |
+
],
|
| 11 |
+
"repository": "https://github.com/micromark/micromark/tree/main/packages/micromark-factory-destination",
|
| 12 |
+
"bugs": "https://github.com/micromark/micromark/issues",
|
| 13 |
+
"funding": [
|
| 14 |
+
{
|
| 15 |
+
"type": "GitHub Sponsors",
|
| 16 |
+
"url": "https://github.com/sponsors/unifiedjs"
|
| 17 |
+
},
|
| 18 |
+
{
|
| 19 |
+
"type": "OpenCollective",
|
| 20 |
+
"url": "https://opencollective.com/unified"
|
| 21 |
+
}
|
| 22 |
+
],
|
| 23 |
+
"author": "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)",
|
| 24 |
+
"contributors": [
|
| 25 |
+
"Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)"
|
| 26 |
+
],
|
| 27 |
+
"sideEffects": false,
|
| 28 |
+
"type": "module",
|
| 29 |
+
"files": [
|
| 30 |
+
"dev/",
|
| 31 |
+
"index.d.ts.map",
|
| 32 |
+
"index.d.ts",
|
| 33 |
+
"index.js"
|
| 34 |
+
],
|
| 35 |
+
"exports": {
|
| 36 |
+
"development": "./dev/index.js",
|
| 37 |
+
"default": "./index.js"
|
| 38 |
+
},
|
| 39 |
+
"dependencies": {
|
| 40 |
+
"micromark-util-character": "^2.0.0",
|
| 41 |
+
"micromark-util-symbol": "^2.0.0",
|
| 42 |
+
"micromark-util-types": "^2.0.0"
|
| 43 |
+
},
|
| 44 |
+
"scripts": {
|
| 45 |
+
"build": "micromark-build"
|
| 46 |
+
},
|
| 47 |
+
"xo": {
|
| 48 |
+
"envs": [
|
| 49 |
+
"shared-node-browser"
|
| 50 |
+
],
|
| 51 |
+
"prettier": true,
|
| 52 |
+
"rules": {
|
| 53 |
+
"max-params": "off",
|
| 54 |
+
"unicorn/prefer-code-point": "off"
|
| 55 |
+
}
|
| 56 |
+
}
|
| 57 |
+
}
|
node_modules/micromark-factory-destination/readme.md
ADDED
|
@@ -0,0 +1,234 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# micromark-factory-destination
|
| 2 |
+
|
| 3 |
+
[![Build][build-badge]][build]
|
| 4 |
+
[![Coverage][coverage-badge]][coverage]
|
| 5 |
+
[![Downloads][downloads-badge]][downloads]
|
| 6 |
+
[![Size][bundle-size-badge]][bundle-size]
|
| 7 |
+
[![Sponsors][sponsors-badge]][opencollective]
|
| 8 |
+
[![Backers][backers-badge]][opencollective]
|
| 9 |
+
[![Chat][chat-badge]][chat]
|
| 10 |
+
|
| 11 |
+
[micromark][] factory to parse destinations (found in resources, definitions).
|
| 12 |
+
|
| 13 |
+
## Contents
|
| 14 |
+
|
| 15 |
+
* [What is this?](#what-is-this)
|
| 16 |
+
* [When should I use this?](#when-should-i-use-this)
|
| 17 |
+
* [Install](#install)
|
| 18 |
+
* [Use](#use)
|
| 19 |
+
* [API](#api)
|
| 20 |
+
* [`factoryDestination(…)`](#factorydestination)
|
| 21 |
+
* [Types](#types)
|
| 22 |
+
* [Compatibility](#compatibility)
|
| 23 |
+
* [Security](#security)
|
| 24 |
+
* [Contribute](#contribute)
|
| 25 |
+
* [License](#license)
|
| 26 |
+
|
| 27 |
+
## What is this?
|
| 28 |
+
|
| 29 |
+
This package exposes states to parse destinations.
|
| 30 |
+
|
| 31 |
+
## When should I use this?
|
| 32 |
+
|
| 33 |
+
This package is useful when you are making your own micromark extensions.
|
| 34 |
+
|
| 35 |
+
## Install
|
| 36 |
+
|
| 37 |
+
This package is [ESM only][esm].
|
| 38 |
+
In Node.js (version 16+), install with [npm][]:
|
| 39 |
+
|
| 40 |
+
```sh
|
| 41 |
+
npm install micromark-factory-destination
|
| 42 |
+
```
|
| 43 |
+
|
| 44 |
+
In Deno with [`esm.sh`][esmsh]:
|
| 45 |
+
|
| 46 |
+
```js
|
| 47 |
+
import {factoryDestination} from 'https://esm.sh/micromark-factory-destination@1'
|
| 48 |
+
```
|
| 49 |
+
|
| 50 |
+
In browsers with [`esm.sh`][esmsh]:
|
| 51 |
+
|
| 52 |
+
```html
|
| 53 |
+
<script type="module">
|
| 54 |
+
import {factoryDestination} from 'https://esm.sh/micromark-factory-destination@1?bundle'
|
| 55 |
+
</script>
|
| 56 |
+
```
|
| 57 |
+
|
| 58 |
+
## Use
|
| 59 |
+
|
| 60 |
+
```js
|
| 61 |
+
import {factoryDestination} from 'micromark-factory-destination'
|
| 62 |
+
import {codes, types} from 'micromark-util-symbol'
|
| 63 |
+
|
| 64 |
+
// A micromark tokenizer that uses the factory:
|
| 65 |
+
/**
|
| 66 |
+
* @this {TokenizeContext}
|
| 67 |
+
* Context.
|
| 68 |
+
* @type {Tokenizer}
|
| 69 |
+
*/
|
| 70 |
+
function tokenizeResource(effects, ok, nok) {
|
| 71 |
+
return start
|
| 72 |
+
|
| 73 |
+
// …
|
| 74 |
+
|
| 75 |
+
/** @type {State} */
|
| 76 |
+
function open(code) {
|
| 77 |
+
if (code === codes.rightParenthesis) {
|
| 78 |
+
return end(code)
|
| 79 |
+
}
|
| 80 |
+
|
| 81 |
+
return factoryDestination(
|
| 82 |
+
effects,
|
| 83 |
+
destinationAfter,
|
| 84 |
+
nok,
|
| 85 |
+
types.resourceDestination,
|
| 86 |
+
types.resourceDestinationLiteral,
|
| 87 |
+
types.resourceDestinationLiteralMarker,
|
| 88 |
+
types.resourceDestinationRaw,
|
| 89 |
+
types.resourceDestinationString,
|
| 90 |
+
constants.linkResourceDestinationBalanceMax
|
| 91 |
+
)(code)
|
| 92 |
+
}
|
| 93 |
+
|
| 94 |
+
// …
|
| 95 |
+
}
|
| 96 |
+
```
|
| 97 |
+
|
| 98 |
+
## API
|
| 99 |
+
|
| 100 |
+
This module exports the identifier
|
| 101 |
+
[`factoryDestination`][api-factory-destination].
|
| 102 |
+
There is no default export.
|
| 103 |
+
|
| 104 |
+
### `factoryDestination(…)`
|
| 105 |
+
|
| 106 |
+
Parse destinations.
|
| 107 |
+
|
| 108 |
+
###### Examples
|
| 109 |
+
|
| 110 |
+
```markdown
|
| 111 |
+
<a>
|
| 112 |
+
<a\>b>
|
| 113 |
+
<a b>
|
| 114 |
+
<a)>
|
| 115 |
+
a
|
| 116 |
+
a\)b
|
| 117 |
+
a(b)c
|
| 118 |
+
a(b)
|
| 119 |
+
```
|
| 120 |
+
|
| 121 |
+
###### Parameters
|
| 122 |
+
|
| 123 |
+
* `effects` (`Effects`)
|
| 124 |
+
— context
|
| 125 |
+
* `ok` (`State`)
|
| 126 |
+
— state switched to when successful
|
| 127 |
+
* `nok` (`State`)
|
| 128 |
+
— state switched to when unsuccessful
|
| 129 |
+
* `type` (`string`)
|
| 130 |
+
— type for whole (`<a>` or `b`)
|
| 131 |
+
* `literalType` (`string`)
|
| 132 |
+
— type when enclosed (`<a>`)
|
| 133 |
+
* `literalMarkerType` (`string`)
|
| 134 |
+
— type for enclosing (`<` and `>`)
|
| 135 |
+
* `rawType` (`string`)
|
| 136 |
+
— type when not enclosed (`b`)
|
| 137 |
+
* `stringType` (`string`)
|
| 138 |
+
— type for the value (`a` or `b`)
|
| 139 |
+
* `max` (`number`, default: `Infinity`)
|
| 140 |
+
— depth of nested parens (inclusive)
|
| 141 |
+
|
| 142 |
+
###### Returns
|
| 143 |
+
|
| 144 |
+
Start state (`State`).
|
| 145 |
+
|
| 146 |
+
## Types
|
| 147 |
+
|
| 148 |
+
This package is fully typed with [TypeScript][].
|
| 149 |
+
It exports no additional types.
|
| 150 |
+
|
| 151 |
+
## Compatibility
|
| 152 |
+
|
| 153 |
+
Projects maintained by the unified collective are compatible with maintained
|
| 154 |
+
versions of Node.js.
|
| 155 |
+
|
| 156 |
+
When we cut a new major release, we drop support for unmaintained versions of
|
| 157 |
+
Node.
|
| 158 |
+
This means we try to keep the current release line,
|
| 159 |
+
`micromark-factory-destination@2`, compatible with Node.js 16.
|
| 160 |
+
This package works with `micromark@3`.
|
| 161 |
+
|
| 162 |
+
## Security
|
| 163 |
+
|
| 164 |
+
This package is safe.
|
| 165 |
+
See [`security.md`][securitymd] in [`micromark/.github`][health] for how to
|
| 166 |
+
submit a security report.
|
| 167 |
+
|
| 168 |
+
## Contribute
|
| 169 |
+
|
| 170 |
+
See [`contributing.md`][contributing] in [`micromark/.github`][health] for ways
|
| 171 |
+
to get started.
|
| 172 |
+
See [`support.md`][support] for ways to get help.
|
| 173 |
+
|
| 174 |
+
This project has a [code of conduct][coc].
|
| 175 |
+
By interacting with this repository, organisation, or community you agree to
|
| 176 |
+
abide by its terms.
|
| 177 |
+
|
| 178 |
+
## License
|
| 179 |
+
|
| 180 |
+
[MIT][license] © [Titus Wormer][author]
|
| 181 |
+
|
| 182 |
+
<!-- Definitions -->
|
| 183 |
+
|
| 184 |
+
[build-badge]: https://github.com/micromark/micromark/workflows/main/badge.svg
|
| 185 |
+
|
| 186 |
+
[build]: https://github.com/micromark/micromark/actions
|
| 187 |
+
|
| 188 |
+
[coverage-badge]: https://img.shields.io/codecov/c/github/micromark/micromark.svg
|
| 189 |
+
|
| 190 |
+
[coverage]: https://codecov.io/github/micromark/micromark
|
| 191 |
+
|
| 192 |
+
[downloads-badge]: https://img.shields.io/npm/dm/micromark-factory-destination.svg
|
| 193 |
+
|
| 194 |
+
[downloads]: https://www.npmjs.com/package/micromark-factory-destination
|
| 195 |
+
|
| 196 |
+
[bundle-size-badge]: https://img.shields.io/badge/dynamic/json?label=minzipped%20size&query=$.size.compressedSize&url=https://deno.bundlejs.com/?q=micromark-factory-destination
|
| 197 |
+
|
| 198 |
+
[bundle-size]: https://bundlejs.com/?q=micromark-factory-destination
|
| 199 |
+
|
| 200 |
+
[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg
|
| 201 |
+
|
| 202 |
+
[backers-badge]: https://opencollective.com/unified/backers/badge.svg
|
| 203 |
+
|
| 204 |
+
[opencollective]: https://opencollective.com/unified
|
| 205 |
+
|
| 206 |
+
[npm]: https://docs.npmjs.com/cli/install
|
| 207 |
+
|
| 208 |
+
[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c
|
| 209 |
+
|
| 210 |
+
[esmsh]: https://esm.sh
|
| 211 |
+
|
| 212 |
+
[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg
|
| 213 |
+
|
| 214 |
+
[chat]: https://github.com/micromark/micromark/discussions
|
| 215 |
+
|
| 216 |
+
[license]: https://github.com/micromark/micromark/blob/main/license
|
| 217 |
+
|
| 218 |
+
[author]: https://wooorm.com
|
| 219 |
+
|
| 220 |
+
[health]: https://github.com/micromark/.github
|
| 221 |
+
|
| 222 |
+
[securitymd]: https://github.com/micromark/.github/blob/main/security.md
|
| 223 |
+
|
| 224 |
+
[contributing]: https://github.com/micromark/.github/blob/main/contributing.md
|
| 225 |
+
|
| 226 |
+
[support]: https://github.com/micromark/.github/blob/main/support.md
|
| 227 |
+
|
| 228 |
+
[coc]: https://github.com/micromark/.github/blob/main/code-of-conduct.md
|
| 229 |
+
|
| 230 |
+
[typescript]: https://www.typescriptlang.org
|
| 231 |
+
|
| 232 |
+
[micromark]: https://github.com/micromark/micromark
|
| 233 |
+
|
| 234 |
+
[api-factory-destination]: #factorydestination
|
node_modules/micromark-factory-label/dev/index.d.ts
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* Parse labels.
|
| 3 |
+
*
|
| 4 |
+
* > 👉 **Note**: labels in markdown are capped at 999 characters in the string.
|
| 5 |
+
*
|
| 6 |
+
* ###### Examples
|
| 7 |
+
*
|
| 8 |
+
* ```markdown
|
| 9 |
+
* [a]
|
| 10 |
+
* [a
|
| 11 |
+
* b]
|
| 12 |
+
* [a\]b]
|
| 13 |
+
* ```
|
| 14 |
+
*
|
| 15 |
+
* @this {TokenizeContext}
|
| 16 |
+
* Tokenize context.
|
| 17 |
+
* @param {Effects} effects
|
| 18 |
+
* Context.
|
| 19 |
+
* @param {State} ok
|
| 20 |
+
* State switched to when successful.
|
| 21 |
+
* @param {State} nok
|
| 22 |
+
* State switched to when unsuccessful.
|
| 23 |
+
* @param {TokenType} type
|
| 24 |
+
* Type of the whole label (`[a]`).
|
| 25 |
+
* @param {TokenType} markerType
|
| 26 |
+
* Type for the markers (`[` and `]`).
|
| 27 |
+
* @param {TokenType} stringType
|
| 28 |
+
* Type for the identifier (`a`).
|
| 29 |
+
* @returns {State}
|
| 30 |
+
* Start state.
|
| 31 |
+
*/
|
| 32 |
+
export function factoryLabel(this: TokenizeContext, effects: Effects, ok: State, nok: State, type: TokenType, markerType: TokenType, stringType: TokenType): State;
|
| 33 |
+
import type { Effects } from 'micromark-util-types';
|
| 34 |
+
import type { State } from 'micromark-util-types';
|
| 35 |
+
import type { TokenType } from 'micromark-util-types';
|
| 36 |
+
import type { TokenizeContext } from 'micromark-util-types';
|
| 37 |
+
//# sourceMappingURL=index.d.ts.map
|
node_modules/micromark-factory-label/dev/index.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":"AAaA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,6DAfW,OAAO,MAEP,KAAK,OAEL,KAAK,QAEL,SAAS,cAET,SAAS,cAET,SAAS,GAEP,KAAK,CAkIjB;6BArKS,sBAAsB;2BAAtB,sBAAsB;+BAAtB,sBAAsB;qCAAtB,sBAAsB"}
|
node_modules/micromark-factory-label/dev/index.js
ADDED
|
@@ -0,0 +1,172 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* @import {
|
| 3 |
+
* Effects,
|
| 4 |
+
* State,
|
| 5 |
+
* TokenizeContext,
|
| 6 |
+
* TokenType
|
| 7 |
+
* } from 'micromark-util-types'
|
| 8 |
+
*/
|
| 9 |
+
|
| 10 |
+
import {ok as assert} from 'devlop'
|
| 11 |
+
import {markdownLineEnding, markdownSpace} from 'micromark-util-character'
|
| 12 |
+
import {codes, constants, types} from 'micromark-util-symbol'
|
| 13 |
+
|
| 14 |
+
/**
|
| 15 |
+
* Parse labels.
|
| 16 |
+
*
|
| 17 |
+
* > 👉 **Note**: labels in markdown are capped at 999 characters in the string.
|
| 18 |
+
*
|
| 19 |
+
* ###### Examples
|
| 20 |
+
*
|
| 21 |
+
* ```markdown
|
| 22 |
+
* [a]
|
| 23 |
+
* [a
|
| 24 |
+
* b]
|
| 25 |
+
* [a\]b]
|
| 26 |
+
* ```
|
| 27 |
+
*
|
| 28 |
+
* @this {TokenizeContext}
|
| 29 |
+
* Tokenize context.
|
| 30 |
+
* @param {Effects} effects
|
| 31 |
+
* Context.
|
| 32 |
+
* @param {State} ok
|
| 33 |
+
* State switched to when successful.
|
| 34 |
+
* @param {State} nok
|
| 35 |
+
* State switched to when unsuccessful.
|
| 36 |
+
* @param {TokenType} type
|
| 37 |
+
* Type of the whole label (`[a]`).
|
| 38 |
+
* @param {TokenType} markerType
|
| 39 |
+
* Type for the markers (`[` and `]`).
|
| 40 |
+
* @param {TokenType} stringType
|
| 41 |
+
* Type for the identifier (`a`).
|
| 42 |
+
* @returns {State}
|
| 43 |
+
* Start state.
|
| 44 |
+
*/
|
| 45 |
+
export function factoryLabel(effects, ok, nok, type, markerType, stringType) {
|
| 46 |
+
const self = this
|
| 47 |
+
let size = 0
|
| 48 |
+
/** @type {boolean} */
|
| 49 |
+
let seen
|
| 50 |
+
|
| 51 |
+
return start
|
| 52 |
+
|
| 53 |
+
/**
|
| 54 |
+
* Start of label.
|
| 55 |
+
*
|
| 56 |
+
* ```markdown
|
| 57 |
+
* > | [a]
|
| 58 |
+
* ^
|
| 59 |
+
* ```
|
| 60 |
+
*
|
| 61 |
+
* @type {State}
|
| 62 |
+
*/
|
| 63 |
+
function start(code) {
|
| 64 |
+
assert(code === codes.leftSquareBracket, 'expected `[`')
|
| 65 |
+
effects.enter(type)
|
| 66 |
+
effects.enter(markerType)
|
| 67 |
+
effects.consume(code)
|
| 68 |
+
effects.exit(markerType)
|
| 69 |
+
effects.enter(stringType)
|
| 70 |
+
return atBreak
|
| 71 |
+
}
|
| 72 |
+
|
| 73 |
+
/**
|
| 74 |
+
* In label, at something, before something else.
|
| 75 |
+
*
|
| 76 |
+
* ```markdown
|
| 77 |
+
* > | [a]
|
| 78 |
+
* ^
|
| 79 |
+
* ```
|
| 80 |
+
*
|
| 81 |
+
* @type {State}
|
| 82 |
+
*/
|
| 83 |
+
function atBreak(code) {
|
| 84 |
+
if (
|
| 85 |
+
size > constants.linkReferenceSizeMax ||
|
| 86 |
+
code === codes.eof ||
|
| 87 |
+
code === codes.leftSquareBracket ||
|
| 88 |
+
(code === codes.rightSquareBracket && !seen) ||
|
| 89 |
+
// To do: remove in the future once we’ve switched from
|
| 90 |
+
// `micromark-extension-footnote` to `micromark-extension-gfm-footnote`,
|
| 91 |
+
// which doesn’t need this.
|
| 92 |
+
// Hidden footnotes hook.
|
| 93 |
+
/* c8 ignore next 3 */
|
| 94 |
+
(code === codes.caret &&
|
| 95 |
+
!size &&
|
| 96 |
+
'_hiddenFootnoteSupport' in self.parser.constructs)
|
| 97 |
+
) {
|
| 98 |
+
return nok(code)
|
| 99 |
+
}
|
| 100 |
+
|
| 101 |
+
if (code === codes.rightSquareBracket) {
|
| 102 |
+
effects.exit(stringType)
|
| 103 |
+
effects.enter(markerType)
|
| 104 |
+
effects.consume(code)
|
| 105 |
+
effects.exit(markerType)
|
| 106 |
+
effects.exit(type)
|
| 107 |
+
return ok
|
| 108 |
+
}
|
| 109 |
+
|
| 110 |
+
// To do: indent? Link chunks and EOLs together?
|
| 111 |
+
if (markdownLineEnding(code)) {
|
| 112 |
+
effects.enter(types.lineEnding)
|
| 113 |
+
effects.consume(code)
|
| 114 |
+
effects.exit(types.lineEnding)
|
| 115 |
+
return atBreak
|
| 116 |
+
}
|
| 117 |
+
|
| 118 |
+
effects.enter(types.chunkString, {contentType: constants.contentTypeString})
|
| 119 |
+
return labelInside(code)
|
| 120 |
+
}
|
| 121 |
+
|
| 122 |
+
/**
|
| 123 |
+
* In label, in text.
|
| 124 |
+
*
|
| 125 |
+
* ```markdown
|
| 126 |
+
* > | [a]
|
| 127 |
+
* ^
|
| 128 |
+
* ```
|
| 129 |
+
*
|
| 130 |
+
* @type {State}
|
| 131 |
+
*/
|
| 132 |
+
function labelInside(code) {
|
| 133 |
+
if (
|
| 134 |
+
code === codes.eof ||
|
| 135 |
+
code === codes.leftSquareBracket ||
|
| 136 |
+
code === codes.rightSquareBracket ||
|
| 137 |
+
markdownLineEnding(code) ||
|
| 138 |
+
size++ > constants.linkReferenceSizeMax
|
| 139 |
+
) {
|
| 140 |
+
effects.exit(types.chunkString)
|
| 141 |
+
return atBreak(code)
|
| 142 |
+
}
|
| 143 |
+
|
| 144 |
+
effects.consume(code)
|
| 145 |
+
if (!seen) seen = !markdownSpace(code)
|
| 146 |
+
return code === codes.backslash ? labelEscape : labelInside
|
| 147 |
+
}
|
| 148 |
+
|
| 149 |
+
/**
|
| 150 |
+
* After `\`, at a special character.
|
| 151 |
+
*
|
| 152 |
+
* ```markdown
|
| 153 |
+
* > | [a\*a]
|
| 154 |
+
* ^
|
| 155 |
+
* ```
|
| 156 |
+
*
|
| 157 |
+
* @type {State}
|
| 158 |
+
*/
|
| 159 |
+
function labelEscape(code) {
|
| 160 |
+
if (
|
| 161 |
+
code === codes.leftSquareBracket ||
|
| 162 |
+
code === codes.backslash ||
|
| 163 |
+
code === codes.rightSquareBracket
|
| 164 |
+
) {
|
| 165 |
+
effects.consume(code)
|
| 166 |
+
size++
|
| 167 |
+
return labelInside
|
| 168 |
+
}
|
| 169 |
+
|
| 170 |
+
return labelInside(code)
|
| 171 |
+
}
|
| 172 |
+
}
|
node_modules/micromark-factory-label/index.d.ts
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* Parse labels.
|
| 3 |
+
*
|
| 4 |
+
* > 👉 **Note**: labels in markdown are capped at 999 characters in the string.
|
| 5 |
+
*
|
| 6 |
+
* ###### Examples
|
| 7 |
+
*
|
| 8 |
+
* ```markdown
|
| 9 |
+
* [a]
|
| 10 |
+
* [a
|
| 11 |
+
* b]
|
| 12 |
+
* [a\]b]
|
| 13 |
+
* ```
|
| 14 |
+
*
|
| 15 |
+
* @this {TokenizeContext}
|
| 16 |
+
* Tokenize context.
|
| 17 |
+
* @param {Effects} effects
|
| 18 |
+
* Context.
|
| 19 |
+
* @param {State} ok
|
| 20 |
+
* State switched to when successful.
|
| 21 |
+
* @param {State} nok
|
| 22 |
+
* State switched to when unsuccessful.
|
| 23 |
+
* @param {TokenType} type
|
| 24 |
+
* Type of the whole label (`[a]`).
|
| 25 |
+
* @param {TokenType} markerType
|
| 26 |
+
* Type for the markers (`[` and `]`).
|
| 27 |
+
* @param {TokenType} stringType
|
| 28 |
+
* Type for the identifier (`a`).
|
| 29 |
+
* @returns {State}
|
| 30 |
+
* Start state.
|
| 31 |
+
*/
|
| 32 |
+
export function factoryLabel(this: TokenizeContext, effects: Effects, ok: State, nok: State, type: TokenType, markerType: TokenType, stringType: TokenType): State;
|
| 33 |
+
import type { Effects } from 'micromark-util-types';
|
| 34 |
+
import type { State } from 'micromark-util-types';
|
| 35 |
+
import type { TokenType } from 'micromark-util-types';
|
| 36 |
+
import type { TokenizeContext } from 'micromark-util-types';
|
| 37 |
+
//# sourceMappingURL=index.d.ts.map
|
node_modules/micromark-factory-label/index.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":"AAaA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,6DAfW,OAAO,MAEP,KAAK,OAEL,KAAK,QAEL,SAAS,cAET,SAAS,cAET,SAAS,GAEP,KAAK,CAkIjB;6BArKS,sBAAsB;2BAAtB,sBAAsB;+BAAtB,sBAAsB;qCAAtB,sBAAsB"}
|
node_modules/micromark-factory-label/index.js
ADDED
|
@@ -0,0 +1,148 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* @import {
|
| 3 |
+
* Effects,
|
| 4 |
+
* State,
|
| 5 |
+
* TokenizeContext,
|
| 6 |
+
* TokenType
|
| 7 |
+
* } from 'micromark-util-types'
|
| 8 |
+
*/
|
| 9 |
+
|
| 10 |
+
import { markdownLineEnding, markdownSpace } from 'micromark-util-character';
|
| 11 |
+
/**
|
| 12 |
+
* Parse labels.
|
| 13 |
+
*
|
| 14 |
+
* > 👉 **Note**: labels in markdown are capped at 999 characters in the string.
|
| 15 |
+
*
|
| 16 |
+
* ###### Examples
|
| 17 |
+
*
|
| 18 |
+
* ```markdown
|
| 19 |
+
* [a]
|
| 20 |
+
* [a
|
| 21 |
+
* b]
|
| 22 |
+
* [a\]b]
|
| 23 |
+
* ```
|
| 24 |
+
*
|
| 25 |
+
* @this {TokenizeContext}
|
| 26 |
+
* Tokenize context.
|
| 27 |
+
* @param {Effects} effects
|
| 28 |
+
* Context.
|
| 29 |
+
* @param {State} ok
|
| 30 |
+
* State switched to when successful.
|
| 31 |
+
* @param {State} nok
|
| 32 |
+
* State switched to when unsuccessful.
|
| 33 |
+
* @param {TokenType} type
|
| 34 |
+
* Type of the whole label (`[a]`).
|
| 35 |
+
* @param {TokenType} markerType
|
| 36 |
+
* Type for the markers (`[` and `]`).
|
| 37 |
+
* @param {TokenType} stringType
|
| 38 |
+
* Type for the identifier (`a`).
|
| 39 |
+
* @returns {State}
|
| 40 |
+
* Start state.
|
| 41 |
+
*/
|
| 42 |
+
export function factoryLabel(effects, ok, nok, type, markerType, stringType) {
|
| 43 |
+
const self = this;
|
| 44 |
+
let size = 0;
|
| 45 |
+
/** @type {boolean} */
|
| 46 |
+
let seen;
|
| 47 |
+
return start;
|
| 48 |
+
|
| 49 |
+
/**
|
| 50 |
+
* Start of label.
|
| 51 |
+
*
|
| 52 |
+
* ```markdown
|
| 53 |
+
* > | [a]
|
| 54 |
+
* ^
|
| 55 |
+
* ```
|
| 56 |
+
*
|
| 57 |
+
* @type {State}
|
| 58 |
+
*/
|
| 59 |
+
function start(code) {
|
| 60 |
+
effects.enter(type);
|
| 61 |
+
effects.enter(markerType);
|
| 62 |
+
effects.consume(code);
|
| 63 |
+
effects.exit(markerType);
|
| 64 |
+
effects.enter(stringType);
|
| 65 |
+
return atBreak;
|
| 66 |
+
}
|
| 67 |
+
|
| 68 |
+
/**
|
| 69 |
+
* In label, at something, before something else.
|
| 70 |
+
*
|
| 71 |
+
* ```markdown
|
| 72 |
+
* > | [a]
|
| 73 |
+
* ^
|
| 74 |
+
* ```
|
| 75 |
+
*
|
| 76 |
+
* @type {State}
|
| 77 |
+
*/
|
| 78 |
+
function atBreak(code) {
|
| 79 |
+
if (size > 999 || code === null || code === 91 || code === 93 && !seen ||
|
| 80 |
+
// To do: remove in the future once we’ve switched from
|
| 81 |
+
// `micromark-extension-footnote` to `micromark-extension-gfm-footnote`,
|
| 82 |
+
// which doesn’t need this.
|
| 83 |
+
// Hidden footnotes hook.
|
| 84 |
+
/* c8 ignore next 3 */
|
| 85 |
+
code === 94 && !size && '_hiddenFootnoteSupport' in self.parser.constructs) {
|
| 86 |
+
return nok(code);
|
| 87 |
+
}
|
| 88 |
+
if (code === 93) {
|
| 89 |
+
effects.exit(stringType);
|
| 90 |
+
effects.enter(markerType);
|
| 91 |
+
effects.consume(code);
|
| 92 |
+
effects.exit(markerType);
|
| 93 |
+
effects.exit(type);
|
| 94 |
+
return ok;
|
| 95 |
+
}
|
| 96 |
+
|
| 97 |
+
// To do: indent? Link chunks and EOLs together?
|
| 98 |
+
if (markdownLineEnding(code)) {
|
| 99 |
+
effects.enter("lineEnding");
|
| 100 |
+
effects.consume(code);
|
| 101 |
+
effects.exit("lineEnding");
|
| 102 |
+
return atBreak;
|
| 103 |
+
}
|
| 104 |
+
effects.enter("chunkString", {
|
| 105 |
+
contentType: "string"
|
| 106 |
+
});
|
| 107 |
+
return labelInside(code);
|
| 108 |
+
}
|
| 109 |
+
|
| 110 |
+
/**
|
| 111 |
+
* In label, in text.
|
| 112 |
+
*
|
| 113 |
+
* ```markdown
|
| 114 |
+
* > | [a]
|
| 115 |
+
* ^
|
| 116 |
+
* ```
|
| 117 |
+
*
|
| 118 |
+
* @type {State}
|
| 119 |
+
*/
|
| 120 |
+
function labelInside(code) {
|
| 121 |
+
if (code === null || code === 91 || code === 93 || markdownLineEnding(code) || size++ > 999) {
|
| 122 |
+
effects.exit("chunkString");
|
| 123 |
+
return atBreak(code);
|
| 124 |
+
}
|
| 125 |
+
effects.consume(code);
|
| 126 |
+
if (!seen) seen = !markdownSpace(code);
|
| 127 |
+
return code === 92 ? labelEscape : labelInside;
|
| 128 |
+
}
|
| 129 |
+
|
| 130 |
+
/**
|
| 131 |
+
* After `\`, at a special character.
|
| 132 |
+
*
|
| 133 |
+
* ```markdown
|
| 134 |
+
* > | [a\*a]
|
| 135 |
+
* ^
|
| 136 |
+
* ```
|
| 137 |
+
*
|
| 138 |
+
* @type {State}
|
| 139 |
+
*/
|
| 140 |
+
function labelEscape(code) {
|
| 141 |
+
if (code === 91 || code === 92 || code === 93) {
|
| 142 |
+
effects.consume(code);
|
| 143 |
+
size++;
|
| 144 |
+
return labelInside;
|
| 145 |
+
}
|
| 146 |
+
return labelInside(code);
|
| 147 |
+
}
|
| 148 |
+
}
|
node_modules/micromark-factory-label/license
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
(The MIT License)
|
| 2 |
+
|
| 3 |
+
Copyright (c) Titus Wormer <tituswormer@gmail.com>
|
| 4 |
+
|
| 5 |
+
Permission is hereby granted, free of charge, to any person obtaining
|
| 6 |
+
a copy of this software and associated documentation files (the
|
| 7 |
+
'Software'), to deal in the Software without restriction, including
|
| 8 |
+
without limitation the rights to use, copy, modify, merge, publish,
|
| 9 |
+
distribute, sublicense, and/or sell copies of the Software, and to
|
| 10 |
+
permit persons to whom the Software is furnished to do so, subject to
|
| 11 |
+
the following conditions:
|
| 12 |
+
|
| 13 |
+
The above copyright notice and this permission notice shall be
|
| 14 |
+
included in all copies or substantial portions of the Software.
|
| 15 |
+
|
| 16 |
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
| 17 |
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
| 18 |
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
| 19 |
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
| 20 |
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
| 21 |
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
| 22 |
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
node_modules/micromark-factory-label/package.json
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"name": "micromark-factory-label",
|
| 3 |
+
"version": "2.0.1",
|
| 4 |
+
"description": "micromark factory to parse labels (found in media, definitions)",
|
| 5 |
+
"license": "MIT",
|
| 6 |
+
"keywords": [
|
| 7 |
+
"micromark",
|
| 8 |
+
"factory",
|
| 9 |
+
"label"
|
| 10 |
+
],
|
| 11 |
+
"repository": "https://github.com/micromark/micromark/tree/main/packages/micromark-factory-label",
|
| 12 |
+
"bugs": "https://github.com/micromark/micromark/issues",
|
| 13 |
+
"funding": [
|
| 14 |
+
{
|
| 15 |
+
"type": "GitHub Sponsors",
|
| 16 |
+
"url": "https://github.com/sponsors/unifiedjs"
|
| 17 |
+
},
|
| 18 |
+
{
|
| 19 |
+
"type": "OpenCollective",
|
| 20 |
+
"url": "https://opencollective.com/unified"
|
| 21 |
+
}
|
| 22 |
+
],
|
| 23 |
+
"author": "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)",
|
| 24 |
+
"contributors": [
|
| 25 |
+
"Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)"
|
| 26 |
+
],
|
| 27 |
+
"sideEffects": false,
|
| 28 |
+
"type": "module",
|
| 29 |
+
"files": [
|
| 30 |
+
"dev/",
|
| 31 |
+
"index.d.ts.map",
|
| 32 |
+
"index.d.ts",
|
| 33 |
+
"index.js"
|
| 34 |
+
],
|
| 35 |
+
"exports": {
|
| 36 |
+
"development": "./dev/index.js",
|
| 37 |
+
"default": "./index.js"
|
| 38 |
+
},
|
| 39 |
+
"dependencies": {
|
| 40 |
+
"devlop": "^1.0.0",
|
| 41 |
+
"micromark-util-character": "^2.0.0",
|
| 42 |
+
"micromark-util-symbol": "^2.0.0",
|
| 43 |
+
"micromark-util-types": "^2.0.0"
|
| 44 |
+
},
|
| 45 |
+
"scripts": {
|
| 46 |
+
"build": "micromark-build"
|
| 47 |
+
},
|
| 48 |
+
"xo": {
|
| 49 |
+
"envs": [
|
| 50 |
+
"shared-node-browser"
|
| 51 |
+
],
|
| 52 |
+
"prettier": true,
|
| 53 |
+
"rules": {
|
| 54 |
+
"logical-assignment-operators": "off",
|
| 55 |
+
"max-params": "off",
|
| 56 |
+
"unicorn/no-this-assignment": "off",
|
| 57 |
+
"unicorn/prefer-code-point": "off"
|
| 58 |
+
}
|
| 59 |
+
}
|
| 60 |
+
}
|
node_modules/micromark-factory-label/readme.md
ADDED
|
@@ -0,0 +1,224 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# micromark-factory-label
|
| 2 |
+
|
| 3 |
+
[![Build][build-badge]][build]
|
| 4 |
+
[![Coverage][coverage-badge]][coverage]
|
| 5 |
+
[![Downloads][downloads-badge]][downloads]
|
| 6 |
+
[![Size][bundle-size-badge]][bundle-size]
|
| 7 |
+
[![Sponsors][sponsors-badge]][opencollective]
|
| 8 |
+
[![Backers][backers-badge]][opencollective]
|
| 9 |
+
[![Chat][chat-badge]][chat]
|
| 10 |
+
|
| 11 |
+
[micromark][] factory to parse labels (found in media, definitions).
|
| 12 |
+
|
| 13 |
+
## Contents
|
| 14 |
+
|
| 15 |
+
* [What is this?](#what-is-this)
|
| 16 |
+
* [When should I use this?](#when-should-i-use-this)
|
| 17 |
+
* [Install](#install)
|
| 18 |
+
* [Use](#use)
|
| 19 |
+
* [API](#api)
|
| 20 |
+
* [`factoryLabel(…)`](#factorylabel)
|
| 21 |
+
* [Types](#types)
|
| 22 |
+
* [Compatibility](#compatibility)
|
| 23 |
+
* [Security](#security)
|
| 24 |
+
* [Contribute](#contribute)
|
| 25 |
+
* [License](#license)
|
| 26 |
+
|
| 27 |
+
## What is this?
|
| 28 |
+
|
| 29 |
+
This package exposes states to parse labels.
|
| 30 |
+
|
| 31 |
+
## When should I use this?
|
| 32 |
+
|
| 33 |
+
This package is useful when you are making your own micromark extensions.
|
| 34 |
+
|
| 35 |
+
## Install
|
| 36 |
+
|
| 37 |
+
This package is [ESM only][esm].
|
| 38 |
+
In Node.js (version 16+), install with [npm][]:
|
| 39 |
+
|
| 40 |
+
```sh
|
| 41 |
+
npm install micromark-factory-label
|
| 42 |
+
```
|
| 43 |
+
|
| 44 |
+
In Deno with [`esm.sh`][esmsh]:
|
| 45 |
+
|
| 46 |
+
```js
|
| 47 |
+
import {factoryLabel} from 'https://esm.sh/micromark-factory-label@1'
|
| 48 |
+
```
|
| 49 |
+
|
| 50 |
+
In browsers with [`esm.sh`][esmsh]:
|
| 51 |
+
|
| 52 |
+
```html
|
| 53 |
+
<script type="module">
|
| 54 |
+
import {factoryLabel} from 'https://esm.sh/micromark-factory-label@1?bundle'
|
| 55 |
+
</script>
|
| 56 |
+
```
|
| 57 |
+
|
| 58 |
+
## Use
|
| 59 |
+
|
| 60 |
+
```js
|
| 61 |
+
import {ok as assert} from 'devlop'
|
| 62 |
+
import {factoryLabel} from 'micromark-factory-label'
|
| 63 |
+
import {codes, types} from 'micromark-util-symbol'
|
| 64 |
+
|
| 65 |
+
// A micromark tokenizer that uses the factory:
|
| 66 |
+
/**
|
| 67 |
+
* @this {TokenizeContext}
|
| 68 |
+
* Context.
|
| 69 |
+
* @type {Tokenizer}
|
| 70 |
+
*/
|
| 71 |
+
function tokenizeDefinition(effects, ok, nok) {
|
| 72 |
+
return start
|
| 73 |
+
|
| 74 |
+
// …
|
| 75 |
+
|
| 76 |
+
/** @type {State} */
|
| 77 |
+
function start(code) {
|
| 78 |
+
assert(code === codes.leftSquareBracket, 'expected `[`')
|
| 79 |
+
effects.enter(types.definition)
|
| 80 |
+
return factoryLabel.call(
|
| 81 |
+
self,
|
| 82 |
+
effects,
|
| 83 |
+
labelAfter,
|
| 84 |
+
nok,
|
| 85 |
+
types.definitionLabel,
|
| 86 |
+
types.definitionLabelMarker,
|
| 87 |
+
types.definitionLabelString
|
| 88 |
+
)(code)
|
| 89 |
+
}
|
| 90 |
+
|
| 91 |
+
// …
|
| 92 |
+
}
|
| 93 |
+
```
|
| 94 |
+
|
| 95 |
+
## API
|
| 96 |
+
|
| 97 |
+
This module exports the identifier [`factoryLabel`][api-factory-label].
|
| 98 |
+
There is no default export.
|
| 99 |
+
|
| 100 |
+
### `factoryLabel(…)`
|
| 101 |
+
|
| 102 |
+
Parse labels.
|
| 103 |
+
|
| 104 |
+
> 👉 **Note**: labels in markdown are capped at 999 characters in the string.
|
| 105 |
+
|
| 106 |
+
###### Examples
|
| 107 |
+
|
| 108 |
+
```markdown
|
| 109 |
+
[a]
|
| 110 |
+
[a
|
| 111 |
+
b]
|
| 112 |
+
[a\]b]
|
| 113 |
+
```
|
| 114 |
+
|
| 115 |
+
###### Parameters
|
| 116 |
+
|
| 117 |
+
* `this` (`TokenizeContext`)
|
| 118 |
+
— tokenize context
|
| 119 |
+
* `effects` (`Effects`)
|
| 120 |
+
— context
|
| 121 |
+
* `ok` (`State`)
|
| 122 |
+
— state switched to when successful
|
| 123 |
+
* `nok` (`State`)
|
| 124 |
+
— state switched to when unsuccessful
|
| 125 |
+
* `type` (`string`)
|
| 126 |
+
— type of the whole label (`[a]`)
|
| 127 |
+
* `markerType` (`string`)
|
| 128 |
+
— type for the markers (`[` and `]`)
|
| 129 |
+
* `stringType` (`string`)
|
| 130 |
+
— type for the identifier (`a`)
|
| 131 |
+
|
| 132 |
+
###### Returns
|
| 133 |
+
|
| 134 |
+
Start state (`State`).
|
| 135 |
+
|
| 136 |
+
## Types
|
| 137 |
+
|
| 138 |
+
This package is fully typed with [TypeScript][].
|
| 139 |
+
It exports no additional types.
|
| 140 |
+
|
| 141 |
+
## Compatibility
|
| 142 |
+
|
| 143 |
+
Projects maintained by the unified collective are compatible with maintained
|
| 144 |
+
versions of Node.js.
|
| 145 |
+
|
| 146 |
+
When we cut a new major release, we drop support for unmaintained versions of
|
| 147 |
+
Node.
|
| 148 |
+
This means we try to keep the current release line,
|
| 149 |
+
`micromark-factory-label@2`, compatible with Node.js 16.
|
| 150 |
+
This package works with `micromark@3`.
|
| 151 |
+
|
| 152 |
+
## Security
|
| 153 |
+
|
| 154 |
+
This package is safe.
|
| 155 |
+
See [`security.md`][securitymd] in [`micromark/.github`][health] for how to
|
| 156 |
+
submit a security report.
|
| 157 |
+
|
| 158 |
+
## Contribute
|
| 159 |
+
|
| 160 |
+
See [`contributing.md`][contributing] in [`micromark/.github`][health] for ways
|
| 161 |
+
to get started.
|
| 162 |
+
See [`support.md`][support] for ways to get help.
|
| 163 |
+
|
| 164 |
+
This project has a [code of conduct][coc].
|
| 165 |
+
By interacting with this repository, organisation, or community you agree to
|
| 166 |
+
abide by its terms.
|
| 167 |
+
|
| 168 |
+
## License
|
| 169 |
+
|
| 170 |
+
[MIT][license] © [Titus Wormer][author]
|
| 171 |
+
|
| 172 |
+
<!-- Definitions -->
|
| 173 |
+
|
| 174 |
+
[build-badge]: https://github.com/micromark/micromark/workflows/main/badge.svg
|
| 175 |
+
|
| 176 |
+
[build]: https://github.com/micromark/micromark/actions
|
| 177 |
+
|
| 178 |
+
[coverage-badge]: https://img.shields.io/codecov/c/github/micromark/micromark.svg
|
| 179 |
+
|
| 180 |
+
[coverage]: https://codecov.io/github/micromark/micromark
|
| 181 |
+
|
| 182 |
+
[downloads-badge]: https://img.shields.io/npm/dm/micromark-factory-label.svg
|
| 183 |
+
|
| 184 |
+
[downloads]: https://www.npmjs.com/package/micromark-factory-label
|
| 185 |
+
|
| 186 |
+
[bundle-size-badge]: https://img.shields.io/badge/dynamic/json?label=minzipped%20size&query=$.size.compressedSize&url=https://deno.bundlejs.com/?q=micromark-factory-label
|
| 187 |
+
|
| 188 |
+
[bundle-size]: https://bundlejs.com/?q=micromark-factory-label
|
| 189 |
+
|
| 190 |
+
[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg
|
| 191 |
+
|
| 192 |
+
[backers-badge]: https://opencollective.com/unified/backers/badge.svg
|
| 193 |
+
|
| 194 |
+
[opencollective]: https://opencollective.com/unified
|
| 195 |
+
|
| 196 |
+
[npm]: https://docs.npmjs.com/cli/install
|
| 197 |
+
|
| 198 |
+
[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c
|
| 199 |
+
|
| 200 |
+
[esmsh]: https://esm.sh
|
| 201 |
+
|
| 202 |
+
[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg
|
| 203 |
+
|
| 204 |
+
[chat]: https://github.com/micromark/micromark/discussions
|
| 205 |
+
|
| 206 |
+
[license]: https://github.com/micromark/micromark/blob/main/license
|
| 207 |
+
|
| 208 |
+
[author]: https://wooorm.com
|
| 209 |
+
|
| 210 |
+
[health]: https://github.com/micromark/.github
|
| 211 |
+
|
| 212 |
+
[securitymd]: https://github.com/micromark/.github/blob/main/security.md
|
| 213 |
+
|
| 214 |
+
[contributing]: https://github.com/micromark/.github/blob/main/contributing.md
|
| 215 |
+
|
| 216 |
+
[support]: https://github.com/micromark/.github/blob/main/support.md
|
| 217 |
+
|
| 218 |
+
[coc]: https://github.com/micromark/.github/blob/main/code-of-conduct.md
|
| 219 |
+
|
| 220 |
+
[typescript]: https://www.typescriptlang.org
|
| 221 |
+
|
| 222 |
+
[micromark]: https://github.com/micromark/micromark
|
| 223 |
+
|
| 224 |
+
[api-factory-label]: #factorylabel
|
node_modules/micromark-factory-space/dev/index.d.ts
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* Parse spaces and tabs.
|
| 3 |
+
*
|
| 4 |
+
* There is no `nok` parameter:
|
| 5 |
+
*
|
| 6 |
+
* * spaces in markdown are often optional, in which case this factory can be
|
| 7 |
+
* used and `ok` will be switched to whether spaces were found or not
|
| 8 |
+
* * one line ending or space can be detected with `markdownSpace(code)` right
|
| 9 |
+
* before using `factorySpace`
|
| 10 |
+
*
|
| 11 |
+
* ###### Examples
|
| 12 |
+
*
|
| 13 |
+
* Where `␉` represents a tab (plus how much it expands) and `␠` represents a
|
| 14 |
+
* single space.
|
| 15 |
+
*
|
| 16 |
+
* ```markdown
|
| 17 |
+
* ␉
|
| 18 |
+
* ␠␠␠␠
|
| 19 |
+
* ␉␠
|
| 20 |
+
* ```
|
| 21 |
+
*
|
| 22 |
+
* @param {Effects} effects
|
| 23 |
+
* Context.
|
| 24 |
+
* @param {State} ok
|
| 25 |
+
* State switched to when successful.
|
| 26 |
+
* @param {TokenType} type
|
| 27 |
+
* Type (`' \t'`).
|
| 28 |
+
* @param {number | undefined} [max=Infinity]
|
| 29 |
+
* Max (exclusive).
|
| 30 |
+
* @returns {State}
|
| 31 |
+
* Start state.
|
| 32 |
+
*/
|
| 33 |
+
export function factorySpace(effects: Effects, ok: State, type: TokenType, max?: number | undefined): State;
|
| 34 |
+
import type { Effects } from 'micromark-util-types';
|
| 35 |
+
import type { State } from 'micromark-util-types';
|
| 36 |
+
import type { TokenType } from 'micromark-util-types';
|
| 37 |
+
//# sourceMappingURL=index.d.ts.map
|
node_modules/micromark-factory-space/dev/index.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":"AAQA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,sCAXW,OAAO,MAEP,KAAK,QAEL,SAAS,QAET,MAAM,GAAG,SAAS,GAEhB,KAAK,CA6BjB;6BAjE2C,sBAAsB;2BAAtB,sBAAsB;+BAAtB,sBAAsB"}
|
node_modules/micromark-factory-space/dev/index.js
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* @import {Effects, State, TokenType} from 'micromark-util-types'
|
| 3 |
+
*/
|
| 4 |
+
|
| 5 |
+
import {markdownSpace} from 'micromark-util-character'
|
| 6 |
+
|
| 7 |
+
// To do: implement `spaceOrTab`, `spaceOrTabMinMax`, `spaceOrTabWithOptions`.
|
| 8 |
+
|
| 9 |
+
/**
|
| 10 |
+
* Parse spaces and tabs.
|
| 11 |
+
*
|
| 12 |
+
* There is no `nok` parameter:
|
| 13 |
+
*
|
| 14 |
+
* * spaces in markdown are often optional, in which case this factory can be
|
| 15 |
+
* used and `ok` will be switched to whether spaces were found or not
|
| 16 |
+
* * one line ending or space can be detected with `markdownSpace(code)` right
|
| 17 |
+
* before using `factorySpace`
|
| 18 |
+
*
|
| 19 |
+
* ###### Examples
|
| 20 |
+
*
|
| 21 |
+
* Where `␉` represents a tab (plus how much it expands) and `␠` represents a
|
| 22 |
+
* single space.
|
| 23 |
+
*
|
| 24 |
+
* ```markdown
|
| 25 |
+
* ␉
|
| 26 |
+
* ␠␠␠␠
|
| 27 |
+
* ␉␠
|
| 28 |
+
* ```
|
| 29 |
+
*
|
| 30 |
+
* @param {Effects} effects
|
| 31 |
+
* Context.
|
| 32 |
+
* @param {State} ok
|
| 33 |
+
* State switched to when successful.
|
| 34 |
+
* @param {TokenType} type
|
| 35 |
+
* Type (`' \t'`).
|
| 36 |
+
* @param {number | undefined} [max=Infinity]
|
| 37 |
+
* Max (exclusive).
|
| 38 |
+
* @returns {State}
|
| 39 |
+
* Start state.
|
| 40 |
+
*/
|
| 41 |
+
export function factorySpace(effects, ok, type, max) {
|
| 42 |
+
const limit = max ? max - 1 : Number.POSITIVE_INFINITY
|
| 43 |
+
let size = 0
|
| 44 |
+
|
| 45 |
+
return start
|
| 46 |
+
|
| 47 |
+
/** @type {State} */
|
| 48 |
+
function start(code) {
|
| 49 |
+
if (markdownSpace(code)) {
|
| 50 |
+
effects.enter(type)
|
| 51 |
+
return prefix(code)
|
| 52 |
+
}
|
| 53 |
+
|
| 54 |
+
return ok(code)
|
| 55 |
+
}
|
| 56 |
+
|
| 57 |
+
/** @type {State} */
|
| 58 |
+
function prefix(code) {
|
| 59 |
+
if (markdownSpace(code) && size++ < limit) {
|
| 60 |
+
effects.consume(code)
|
| 61 |
+
return prefix
|
| 62 |
+
}
|
| 63 |
+
|
| 64 |
+
effects.exit(type)
|
| 65 |
+
return ok(code)
|
| 66 |
+
}
|
| 67 |
+
}
|
node_modules/micromark-factory-space/index.d.ts
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* Parse spaces and tabs.
|
| 3 |
+
*
|
| 4 |
+
* There is no `nok` parameter:
|
| 5 |
+
*
|
| 6 |
+
* * spaces in markdown are often optional, in which case this factory can be
|
| 7 |
+
* used and `ok` will be switched to whether spaces were found or not
|
| 8 |
+
* * one line ending or space can be detected with `markdownSpace(code)` right
|
| 9 |
+
* before using `factorySpace`
|
| 10 |
+
*
|
| 11 |
+
* ###### Examples
|
| 12 |
+
*
|
| 13 |
+
* Where `␉` represents a tab (plus how much it expands) and `␠` represents a
|
| 14 |
+
* single space.
|
| 15 |
+
*
|
| 16 |
+
* ```markdown
|
| 17 |
+
* ␉
|
| 18 |
+
* ␠␠␠␠
|
| 19 |
+
* ␉␠
|
| 20 |
+
* ```
|
| 21 |
+
*
|
| 22 |
+
* @param {Effects} effects
|
| 23 |
+
* Context.
|
| 24 |
+
* @param {State} ok
|
| 25 |
+
* State switched to when successful.
|
| 26 |
+
* @param {TokenType} type
|
| 27 |
+
* Type (`' \t'`).
|
| 28 |
+
* @param {number | undefined} [max=Infinity]
|
| 29 |
+
* Max (exclusive).
|
| 30 |
+
* @returns {State}
|
| 31 |
+
* Start state.
|
| 32 |
+
*/
|
| 33 |
+
export function factorySpace(effects: Effects, ok: State, type: TokenType, max?: number | undefined): State;
|
| 34 |
+
import type { Effects } from 'micromark-util-types';
|
| 35 |
+
import type { State } from 'micromark-util-types';
|
| 36 |
+
import type { TokenType } from 'micromark-util-types';
|
| 37 |
+
//# sourceMappingURL=index.d.ts.map
|
node_modules/micromark-factory-space/index.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":"AAQA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,sCAXW,OAAO,MAEP,KAAK,QAEL,SAAS,QAET,MAAM,GAAG,SAAS,GAEhB,KAAK,CA6BjB;6BAjE2C,sBAAsB;2BAAtB,sBAAsB;+BAAtB,sBAAsB"}
|
node_modules/micromark-factory-space/index.js
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* @import {Effects, State, TokenType} from 'micromark-util-types'
|
| 3 |
+
*/
|
| 4 |
+
|
| 5 |
+
import { markdownSpace } from 'micromark-util-character';
|
| 6 |
+
|
| 7 |
+
// To do: implement `spaceOrTab`, `spaceOrTabMinMax`, `spaceOrTabWithOptions`.
|
| 8 |
+
|
| 9 |
+
/**
|
| 10 |
+
* Parse spaces and tabs.
|
| 11 |
+
*
|
| 12 |
+
* There is no `nok` parameter:
|
| 13 |
+
*
|
| 14 |
+
* * spaces in markdown are often optional, in which case this factory can be
|
| 15 |
+
* used and `ok` will be switched to whether spaces were found or not
|
| 16 |
+
* * one line ending or space can be detected with `markdownSpace(code)` right
|
| 17 |
+
* before using `factorySpace`
|
| 18 |
+
*
|
| 19 |
+
* ###### Examples
|
| 20 |
+
*
|
| 21 |
+
* Where `␉` represents a tab (plus how much it expands) and `␠` represents a
|
| 22 |
+
* single space.
|
| 23 |
+
*
|
| 24 |
+
* ```markdown
|
| 25 |
+
* ␉
|
| 26 |
+
* ␠␠␠␠
|
| 27 |
+
* ␉␠
|
| 28 |
+
* ```
|
| 29 |
+
*
|
| 30 |
+
* @param {Effects} effects
|
| 31 |
+
* Context.
|
| 32 |
+
* @param {State} ok
|
| 33 |
+
* State switched to when successful.
|
| 34 |
+
* @param {TokenType} type
|
| 35 |
+
* Type (`' \t'`).
|
| 36 |
+
* @param {number | undefined} [max=Infinity]
|
| 37 |
+
* Max (exclusive).
|
| 38 |
+
* @returns {State}
|
| 39 |
+
* Start state.
|
| 40 |
+
*/
|
| 41 |
+
export function factorySpace(effects, ok, type, max) {
|
| 42 |
+
const limit = max ? max - 1 : Number.POSITIVE_INFINITY;
|
| 43 |
+
let size = 0;
|
| 44 |
+
return start;
|
| 45 |
+
|
| 46 |
+
/** @type {State} */
|
| 47 |
+
function start(code) {
|
| 48 |
+
if (markdownSpace(code)) {
|
| 49 |
+
effects.enter(type);
|
| 50 |
+
return prefix(code);
|
| 51 |
+
}
|
| 52 |
+
return ok(code);
|
| 53 |
+
}
|
| 54 |
+
|
| 55 |
+
/** @type {State} */
|
| 56 |
+
function prefix(code) {
|
| 57 |
+
if (markdownSpace(code) && size++ < limit) {
|
| 58 |
+
effects.consume(code);
|
| 59 |
+
return prefix;
|
| 60 |
+
}
|
| 61 |
+
effects.exit(type);
|
| 62 |
+
return ok(code);
|
| 63 |
+
}
|
| 64 |
+
}
|
node_modules/micromark-factory-space/license
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
(The MIT License)
|
| 2 |
+
|
| 3 |
+
Copyright (c) Titus Wormer <tituswormer@gmail.com>
|
| 4 |
+
|
| 5 |
+
Permission is hereby granted, free of charge, to any person obtaining
|
| 6 |
+
a copy of this software and associated documentation files (the
|
| 7 |
+
'Software'), to deal in the Software without restriction, including
|
| 8 |
+
without limitation the rights to use, copy, modify, merge, publish,
|
| 9 |
+
distribute, sublicense, and/or sell copies of the Software, and to
|
| 10 |
+
permit persons to whom the Software is furnished to do so, subject to
|
| 11 |
+
the following conditions:
|
| 12 |
+
|
| 13 |
+
The above copyright notice and this permission notice shall be
|
| 14 |
+
included in all copies or substantial portions of the Software.
|
| 15 |
+
|
| 16 |
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
| 17 |
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
| 18 |
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
| 19 |
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
| 20 |
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
| 21 |
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
| 22 |
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
node_modules/micromark-factory-space/package.json
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"name": "micromark-factory-space",
|
| 3 |
+
"version": "2.0.1",
|
| 4 |
+
"description": "micromark factory to parse markdown space (found in lots of places)",
|
| 5 |
+
"license": "MIT",
|
| 6 |
+
"keywords": [
|
| 7 |
+
"micromark",
|
| 8 |
+
"factory",
|
| 9 |
+
"space"
|
| 10 |
+
],
|
| 11 |
+
"repository": "https://github.com/micromark/micromark/tree/main/packages/micromark-factory-space",
|
| 12 |
+
"bugs": "https://github.com/micromark/micromark/issues",
|
| 13 |
+
"funding": [
|
| 14 |
+
{
|
| 15 |
+
"type": "GitHub Sponsors",
|
| 16 |
+
"url": "https://github.com/sponsors/unifiedjs"
|
| 17 |
+
},
|
| 18 |
+
{
|
| 19 |
+
"type": "OpenCollective",
|
| 20 |
+
"url": "https://opencollective.com/unified"
|
| 21 |
+
}
|
| 22 |
+
],
|
| 23 |
+
"author": "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)",
|
| 24 |
+
"contributors": [
|
| 25 |
+
"Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)"
|
| 26 |
+
],
|
| 27 |
+
"sideEffects": false,
|
| 28 |
+
"type": "module",
|
| 29 |
+
"files": [
|
| 30 |
+
"dev/",
|
| 31 |
+
"index.d.ts.map",
|
| 32 |
+
"index.d.ts",
|
| 33 |
+
"index.js"
|
| 34 |
+
],
|
| 35 |
+
"exports": {
|
| 36 |
+
"development": "./dev/index.js",
|
| 37 |
+
"default": "./index.js"
|
| 38 |
+
},
|
| 39 |
+
"dependencies": {
|
| 40 |
+
"micromark-util-character": "^2.0.0",
|
| 41 |
+
"micromark-util-types": "^2.0.0"
|
| 42 |
+
},
|
| 43 |
+
"scripts": {
|
| 44 |
+
"build": "micromark-build"
|
| 45 |
+
},
|
| 46 |
+
"xo": {
|
| 47 |
+
"envs": [
|
| 48 |
+
"shared-node-browser"
|
| 49 |
+
],
|
| 50 |
+
"prettier": true,
|
| 51 |
+
"rules": {
|
| 52 |
+
"unicorn/prefer-code-point": "off"
|
| 53 |
+
}
|
| 54 |
+
}
|
| 55 |
+
}
|
node_modules/micromark-factory-space/readme.md
ADDED
|
@@ -0,0 +1,225 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# micromark-factory-space
|
| 2 |
+
|
| 3 |
+
[![Build][build-badge]][build]
|
| 4 |
+
[![Coverage][coverage-badge]][coverage]
|
| 5 |
+
[![Downloads][downloads-badge]][downloads]
|
| 6 |
+
[![Size][bundle-size-badge]][bundle-size]
|
| 7 |
+
[![Sponsors][sponsors-badge]][opencollective]
|
| 8 |
+
[![Backers][backers-badge]][opencollective]
|
| 9 |
+
[![Chat][chat-badge]][chat]
|
| 10 |
+
|
| 11 |
+
[micromark][] factory to parse [markdown space][markdown-space] (found in lots
|
| 12 |
+
of places).
|
| 13 |
+
|
| 14 |
+
## Contents
|
| 15 |
+
|
| 16 |
+
* [What is this?](#what-is-this)
|
| 17 |
+
* [When should I use this?](#when-should-i-use-this)
|
| 18 |
+
* [Install](#install)
|
| 19 |
+
* [Use](#use)
|
| 20 |
+
* [API](#api)
|
| 21 |
+
* [`factorySpace(…)`](#factoryspace)
|
| 22 |
+
* [Types](#types)
|
| 23 |
+
* [Compatibility](#compatibility)
|
| 24 |
+
* [Security](#security)
|
| 25 |
+
* [Contribute](#contribute)
|
| 26 |
+
* [License](#license)
|
| 27 |
+
|
| 28 |
+
## What is this?
|
| 29 |
+
|
| 30 |
+
This package exposes states to parse spaces and/or tabs.
|
| 31 |
+
|
| 32 |
+
## When should I use this?
|
| 33 |
+
|
| 34 |
+
This package is useful when you are making your own micromark extensions.
|
| 35 |
+
|
| 36 |
+
## Install
|
| 37 |
+
|
| 38 |
+
This package is [ESM only][esm].
|
| 39 |
+
In Node.js (version 16+), install with [npm][]:
|
| 40 |
+
|
| 41 |
+
```sh
|
| 42 |
+
npm install micromark-factory-space
|
| 43 |
+
```
|
| 44 |
+
|
| 45 |
+
In Deno with [`esm.sh`][esmsh]:
|
| 46 |
+
|
| 47 |
+
```js
|
| 48 |
+
import {factorySpace} from 'https://esm.sh/micromark-factory-space@1'
|
| 49 |
+
```
|
| 50 |
+
|
| 51 |
+
In browsers with [`esm.sh`][esmsh]:
|
| 52 |
+
|
| 53 |
+
```html
|
| 54 |
+
<script type="module">
|
| 55 |
+
import {factorySpace} from 'https://esm.sh/micromark-factory-space@1?bundle'
|
| 56 |
+
</script>
|
| 57 |
+
```
|
| 58 |
+
|
| 59 |
+
## Use
|
| 60 |
+
|
| 61 |
+
```js
|
| 62 |
+
import {factorySpace} from 'micromark-factory-space'
|
| 63 |
+
import {codes, types} from 'micromark-util-symbol'
|
| 64 |
+
|
| 65 |
+
// A micromark tokenizer that uses the factory:
|
| 66 |
+
/**
|
| 67 |
+
* @this {TokenizeContext}
|
| 68 |
+
* Context.
|
| 69 |
+
* @type {Tokenizer}
|
| 70 |
+
*/
|
| 71 |
+
function tokenizeCodeFenced(effects, ok, nok) {
|
| 72 |
+
return start
|
| 73 |
+
|
| 74 |
+
// …
|
| 75 |
+
|
| 76 |
+
/** @type {State} */
|
| 77 |
+
function info(code) {
|
| 78 |
+
if (code === codes.eof || markdownLineEndingOrSpace(code)) {
|
| 79 |
+
effects.exit(types.chunkString)
|
| 80 |
+
effects.exit(types.codeFencedFenceInfo)
|
| 81 |
+
return factorySpace(effects, infoAfter, types.whitespace)(code)
|
| 82 |
+
}
|
| 83 |
+
|
| 84 |
+
if (code === codes.graveAccent && code === marker) return nok(code)
|
| 85 |
+
effects.consume(code)
|
| 86 |
+
return info
|
| 87 |
+
}
|
| 88 |
+
|
| 89 |
+
// …
|
| 90 |
+
}
|
| 91 |
+
```
|
| 92 |
+
|
| 93 |
+
## API
|
| 94 |
+
|
| 95 |
+
This module exports the identifier [`factorySpace`][api-factory-space].
|
| 96 |
+
There is no default export.
|
| 97 |
+
|
| 98 |
+
### `factorySpace(…)`
|
| 99 |
+
|
| 100 |
+
Parse spaces and tabs.
|
| 101 |
+
|
| 102 |
+
There is no `nok` parameter:
|
| 103 |
+
|
| 104 |
+
* spaces in markdown are often optional, in which case this factory can be
|
| 105 |
+
used and `ok` will be switched to whether spaces were found or not
|
| 106 |
+
* one line ending or space can be detected with `markdownSpace(code)` right
|
| 107 |
+
before using `factorySpace`
|
| 108 |
+
|
| 109 |
+
###### Examples
|
| 110 |
+
|
| 111 |
+
Where `␉` represents a tab (plus how much it expands) and `␠` represents a
|
| 112 |
+
single space.
|
| 113 |
+
|
| 114 |
+
```markdown
|
| 115 |
+
␉
|
| 116 |
+
␠␠␠␠
|
| 117 |
+
␉␠
|
| 118 |
+
```
|
| 119 |
+
|
| 120 |
+
###### Parameters
|
| 121 |
+
|
| 122 |
+
* `effects` (`Effects`)
|
| 123 |
+
— context
|
| 124 |
+
* `ok` (`State`)
|
| 125 |
+
— state switched to when successful
|
| 126 |
+
* `type` (`string`)
|
| 127 |
+
— type (`' \t'`)
|
| 128 |
+
* `max` (`number`, default: `Infinity`)
|
| 129 |
+
— max (exclusive)
|
| 130 |
+
|
| 131 |
+
###### Returns
|
| 132 |
+
|
| 133 |
+
Start state (`State`).
|
| 134 |
+
|
| 135 |
+
## Types
|
| 136 |
+
|
| 137 |
+
This package is fully typed with [TypeScript][].
|
| 138 |
+
It exports no additional types.
|
| 139 |
+
|
| 140 |
+
## Compatibility
|
| 141 |
+
|
| 142 |
+
Projects maintained by the unified collective are compatible with maintained
|
| 143 |
+
versions of Node.js.
|
| 144 |
+
|
| 145 |
+
When we cut a new major release, we drop support for unmaintained versions of
|
| 146 |
+
Node.
|
| 147 |
+
This means we try to keep the current release line,
|
| 148 |
+
`micromark-factory-space@2`, compatible with Node.js 16.
|
| 149 |
+
This package works with `micromark@3`.
|
| 150 |
+
|
| 151 |
+
## Security
|
| 152 |
+
|
| 153 |
+
This package is safe.
|
| 154 |
+
See [`security.md`][securitymd] in [`micromark/.github`][health] for how to
|
| 155 |
+
submit a security report.
|
| 156 |
+
|
| 157 |
+
## Contribute
|
| 158 |
+
|
| 159 |
+
See [`contributing.md`][contributing] in [`micromark/.github`][health] for ways
|
| 160 |
+
to get started.
|
| 161 |
+
See [`support.md`][support] for ways to get help.
|
| 162 |
+
|
| 163 |
+
This project has a [code of conduct][coc].
|
| 164 |
+
By interacting with this repository, organisation, or community you agree to
|
| 165 |
+
abide by its terms.
|
| 166 |
+
|
| 167 |
+
## License
|
| 168 |
+
|
| 169 |
+
[MIT][license] © [Titus Wormer][author]
|
| 170 |
+
|
| 171 |
+
<!-- Definitions -->
|
| 172 |
+
|
| 173 |
+
[build-badge]: https://github.com/micromark/micromark/workflows/main/badge.svg
|
| 174 |
+
|
| 175 |
+
[build]: https://github.com/micromark/micromark/actions
|
| 176 |
+
|
| 177 |
+
[coverage-badge]: https://img.shields.io/codecov/c/github/micromark/micromark.svg
|
| 178 |
+
|
| 179 |
+
[coverage]: https://codecov.io/github/micromark/micromark
|
| 180 |
+
|
| 181 |
+
[downloads-badge]: https://img.shields.io/npm/dm/micromark-factory-space.svg
|
| 182 |
+
|
| 183 |
+
[downloads]: https://www.npmjs.com/package/micromark-factory-space
|
| 184 |
+
|
| 185 |
+
[bundle-size-badge]: https://img.shields.io/badge/dynamic/json?label=minzipped%20size&query=$.size.compressedSize&url=https://deno.bundlejs.com/?q=micromark-factory-space
|
| 186 |
+
|
| 187 |
+
[bundle-size]: https://bundlejs.com/?q=micromark-factory-space
|
| 188 |
+
|
| 189 |
+
[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg
|
| 190 |
+
|
| 191 |
+
[backers-badge]: https://opencollective.com/unified/backers/badge.svg
|
| 192 |
+
|
| 193 |
+
[opencollective]: https://opencollective.com/unified
|
| 194 |
+
|
| 195 |
+
[npm]: https://docs.npmjs.com/cli/install
|
| 196 |
+
|
| 197 |
+
[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c
|
| 198 |
+
|
| 199 |
+
[esmsh]: https://esm.sh
|
| 200 |
+
|
| 201 |
+
[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg
|
| 202 |
+
|
| 203 |
+
[chat]: https://github.com/micromark/micromark/discussions
|
| 204 |
+
|
| 205 |
+
[license]: https://github.com/micromark/micromark/blob/main/license
|
| 206 |
+
|
| 207 |
+
[author]: https://wooorm.com
|
| 208 |
+
|
| 209 |
+
[health]: https://github.com/micromark/.github
|
| 210 |
+
|
| 211 |
+
[securitymd]: https://github.com/micromark/.github/blob/main/security.md
|
| 212 |
+
|
| 213 |
+
[contributing]: https://github.com/micromark/.github/blob/main/contributing.md
|
| 214 |
+
|
| 215 |
+
[support]: https://github.com/micromark/.github/blob/main/support.md
|
| 216 |
+
|
| 217 |
+
[coc]: https://github.com/micromark/.github/blob/main/code-of-conduct.md
|
| 218 |
+
|
| 219 |
+
[markdown-space]: https://github.com/micromark/micromark/tree/main/packages/micromark-util-character#markdownspacecode
|
| 220 |
+
|
| 221 |
+
[typescript]: https://www.typescriptlang.org
|
| 222 |
+
|
| 223 |
+
[micromark]: https://github.com/micromark/micromark
|
| 224 |
+
|
| 225 |
+
[api-factory-space]: #factoryspace
|
node_modules/micromark-factory-title/dev/index.d.ts
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* Parse titles.
|
| 3 |
+
*
|
| 4 |
+
* ###### Examples
|
| 5 |
+
*
|
| 6 |
+
* ```markdown
|
| 7 |
+
* "a"
|
| 8 |
+
* 'b'
|
| 9 |
+
* (c)
|
| 10 |
+
* "a
|
| 11 |
+
* b"
|
| 12 |
+
* 'a
|
| 13 |
+
* b'
|
| 14 |
+
* (a\)b)
|
| 15 |
+
* ```
|
| 16 |
+
*
|
| 17 |
+
* @param {Effects} effects
|
| 18 |
+
* Context.
|
| 19 |
+
* @param {State} ok
|
| 20 |
+
* State switched to when successful.
|
| 21 |
+
* @param {State} nok
|
| 22 |
+
* State switched to when unsuccessful.
|
| 23 |
+
* @param {TokenType} type
|
| 24 |
+
* Type of the whole title (`"a"`, `'b'`, `(c)`).
|
| 25 |
+
* @param {TokenType} markerType
|
| 26 |
+
* Type for the markers (`"`, `'`, `(`, and `)`).
|
| 27 |
+
* @param {TokenType} stringType
|
| 28 |
+
* Type for the value (`a`).
|
| 29 |
+
* @returns {State}
|
| 30 |
+
* Start state.
|
| 31 |
+
*/
|
| 32 |
+
export function factoryTitle(effects: Effects, ok: State, nok: State, type: TokenType, markerType: TokenType, stringType: TokenType): State;
|
| 33 |
+
import type { Effects } from 'micromark-util-types';
|
| 34 |
+
import type { State } from 'micromark-util-types';
|
| 35 |
+
import type { TokenType } from 'micromark-util-types';
|
| 36 |
+
//# sourceMappingURL=index.d.ts.map
|
node_modules/micromark-factory-title/dev/index.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":"AAaA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,sCAfW,OAAO,MAEP,KAAK,OAEL,KAAK,QAEL,SAAS,cAET,SAAS,cAET,SAAS,GAEP,KAAK,CA+HjB;6BAlKS,sBAAsB;2BAAtB,sBAAsB;+BAAtB,sBAAsB"}
|
node_modules/micromark-factory-title/dev/index.js
ADDED
|
@@ -0,0 +1,169 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* @import {
|
| 3 |
+
* Code,
|
| 4 |
+
* Effects,
|
| 5 |
+
* State,
|
| 6 |
+
* TokenType
|
| 7 |
+
* } from 'micromark-util-types'
|
| 8 |
+
*/
|
| 9 |
+
|
| 10 |
+
import {factorySpace} from 'micromark-factory-space'
|
| 11 |
+
import {markdownLineEnding} from 'micromark-util-character'
|
| 12 |
+
import {codes, constants, types} from 'micromark-util-symbol'
|
| 13 |
+
|
| 14 |
+
/**
|
| 15 |
+
* Parse titles.
|
| 16 |
+
*
|
| 17 |
+
* ###### Examples
|
| 18 |
+
*
|
| 19 |
+
* ```markdown
|
| 20 |
+
* "a"
|
| 21 |
+
* 'b'
|
| 22 |
+
* (c)
|
| 23 |
+
* "a
|
| 24 |
+
* b"
|
| 25 |
+
* 'a
|
| 26 |
+
* b'
|
| 27 |
+
* (a\)b)
|
| 28 |
+
* ```
|
| 29 |
+
*
|
| 30 |
+
* @param {Effects} effects
|
| 31 |
+
* Context.
|
| 32 |
+
* @param {State} ok
|
| 33 |
+
* State switched to when successful.
|
| 34 |
+
* @param {State} nok
|
| 35 |
+
* State switched to when unsuccessful.
|
| 36 |
+
* @param {TokenType} type
|
| 37 |
+
* Type of the whole title (`"a"`, `'b'`, `(c)`).
|
| 38 |
+
* @param {TokenType} markerType
|
| 39 |
+
* Type for the markers (`"`, `'`, `(`, and `)`).
|
| 40 |
+
* @param {TokenType} stringType
|
| 41 |
+
* Type for the value (`a`).
|
| 42 |
+
* @returns {State}
|
| 43 |
+
* Start state.
|
| 44 |
+
*/
|
| 45 |
+
export function factoryTitle(effects, ok, nok, type, markerType, stringType) {
|
| 46 |
+
/** @type {NonNullable<Code>} */
|
| 47 |
+
let marker
|
| 48 |
+
|
| 49 |
+
return start
|
| 50 |
+
|
| 51 |
+
/**
|
| 52 |
+
* Start of title.
|
| 53 |
+
*
|
| 54 |
+
* ```markdown
|
| 55 |
+
* > | "a"
|
| 56 |
+
* ^
|
| 57 |
+
* ```
|
| 58 |
+
*
|
| 59 |
+
* @type {State}
|
| 60 |
+
*/
|
| 61 |
+
function start(code) {
|
| 62 |
+
if (
|
| 63 |
+
code === codes.quotationMark ||
|
| 64 |
+
code === codes.apostrophe ||
|
| 65 |
+
code === codes.leftParenthesis
|
| 66 |
+
) {
|
| 67 |
+
effects.enter(type)
|
| 68 |
+
effects.enter(markerType)
|
| 69 |
+
effects.consume(code)
|
| 70 |
+
effects.exit(markerType)
|
| 71 |
+
marker = code === codes.leftParenthesis ? codes.rightParenthesis : code
|
| 72 |
+
return begin
|
| 73 |
+
}
|
| 74 |
+
|
| 75 |
+
return nok(code)
|
| 76 |
+
}
|
| 77 |
+
|
| 78 |
+
/**
|
| 79 |
+
* After opening marker.
|
| 80 |
+
*
|
| 81 |
+
* This is also used at the closing marker.
|
| 82 |
+
*
|
| 83 |
+
* ```markdown
|
| 84 |
+
* > | "a"
|
| 85 |
+
* ^
|
| 86 |
+
* ```
|
| 87 |
+
*
|
| 88 |
+
* @type {State}
|
| 89 |
+
*/
|
| 90 |
+
function begin(code) {
|
| 91 |
+
if (code === marker) {
|
| 92 |
+
effects.enter(markerType)
|
| 93 |
+
effects.consume(code)
|
| 94 |
+
effects.exit(markerType)
|
| 95 |
+
effects.exit(type)
|
| 96 |
+
return ok
|
| 97 |
+
}
|
| 98 |
+
|
| 99 |
+
effects.enter(stringType)
|
| 100 |
+
return atBreak(code)
|
| 101 |
+
}
|
| 102 |
+
|
| 103 |
+
/**
|
| 104 |
+
* At something, before something else.
|
| 105 |
+
*
|
| 106 |
+
* ```markdown
|
| 107 |
+
* > | "a"
|
| 108 |
+
* ^
|
| 109 |
+
* ```
|
| 110 |
+
*
|
| 111 |
+
* @type {State}
|
| 112 |
+
*/
|
| 113 |
+
function atBreak(code) {
|
| 114 |
+
if (code === marker) {
|
| 115 |
+
effects.exit(stringType)
|
| 116 |
+
return begin(marker)
|
| 117 |
+
}
|
| 118 |
+
|
| 119 |
+
if (code === codes.eof) {
|
| 120 |
+
return nok(code)
|
| 121 |
+
}
|
| 122 |
+
|
| 123 |
+
// Note: blank lines can’t exist in content.
|
| 124 |
+
if (markdownLineEnding(code)) {
|
| 125 |
+
// To do: use `space_or_tab_eol_with_options`, connect.
|
| 126 |
+
effects.enter(types.lineEnding)
|
| 127 |
+
effects.consume(code)
|
| 128 |
+
effects.exit(types.lineEnding)
|
| 129 |
+
return factorySpace(effects, atBreak, types.linePrefix)
|
| 130 |
+
}
|
| 131 |
+
|
| 132 |
+
effects.enter(types.chunkString, {contentType: constants.contentTypeString})
|
| 133 |
+
return inside(code)
|
| 134 |
+
}
|
| 135 |
+
|
| 136 |
+
/**
|
| 137 |
+
*
|
| 138 |
+
*
|
| 139 |
+
* @type {State}
|
| 140 |
+
*/
|
| 141 |
+
function inside(code) {
|
| 142 |
+
if (code === marker || code === codes.eof || markdownLineEnding(code)) {
|
| 143 |
+
effects.exit(types.chunkString)
|
| 144 |
+
return atBreak(code)
|
| 145 |
+
}
|
| 146 |
+
|
| 147 |
+
effects.consume(code)
|
| 148 |
+
return code === codes.backslash ? escape : inside
|
| 149 |
+
}
|
| 150 |
+
|
| 151 |
+
/**
|
| 152 |
+
* After `\`, at a special character.
|
| 153 |
+
*
|
| 154 |
+
* ```markdown
|
| 155 |
+
* > | "a\*b"
|
| 156 |
+
* ^
|
| 157 |
+
* ```
|
| 158 |
+
*
|
| 159 |
+
* @type {State}
|
| 160 |
+
*/
|
| 161 |
+
function escape(code) {
|
| 162 |
+
if (code === marker || code === codes.backslash) {
|
| 163 |
+
effects.consume(code)
|
| 164 |
+
return inside
|
| 165 |
+
}
|
| 166 |
+
|
| 167 |
+
return inside(code)
|
| 168 |
+
}
|
| 169 |
+
}
|
node_modules/micromark-factory-title/index.d.ts
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* Parse titles.
|
| 3 |
+
*
|
| 4 |
+
* ###### Examples
|
| 5 |
+
*
|
| 6 |
+
* ```markdown
|
| 7 |
+
* "a"
|
| 8 |
+
* 'b'
|
| 9 |
+
* (c)
|
| 10 |
+
* "a
|
| 11 |
+
* b"
|
| 12 |
+
* 'a
|
| 13 |
+
* b'
|
| 14 |
+
* (a\)b)
|
| 15 |
+
* ```
|
| 16 |
+
*
|
| 17 |
+
* @param {Effects} effects
|
| 18 |
+
* Context.
|
| 19 |
+
* @param {State} ok
|
| 20 |
+
* State switched to when successful.
|
| 21 |
+
* @param {State} nok
|
| 22 |
+
* State switched to when unsuccessful.
|
| 23 |
+
* @param {TokenType} type
|
| 24 |
+
* Type of the whole title (`"a"`, `'b'`, `(c)`).
|
| 25 |
+
* @param {TokenType} markerType
|
| 26 |
+
* Type for the markers (`"`, `'`, `(`, and `)`).
|
| 27 |
+
* @param {TokenType} stringType
|
| 28 |
+
* Type for the value (`a`).
|
| 29 |
+
* @returns {State}
|
| 30 |
+
* Start state.
|
| 31 |
+
*/
|
| 32 |
+
export function factoryTitle(effects: Effects, ok: State, nok: State, type: TokenType, markerType: TokenType, stringType: TokenType): State;
|
| 33 |
+
import type { Effects } from 'micromark-util-types';
|
| 34 |
+
import type { State } from 'micromark-util-types';
|
| 35 |
+
import type { TokenType } from 'micromark-util-types';
|
| 36 |
+
//# sourceMappingURL=index.d.ts.map
|
node_modules/micromark-factory-title/index.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":"AAaA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,sCAfW,OAAO,MAEP,KAAK,OAEL,KAAK,QAEL,SAAS,cAET,SAAS,cAET,SAAS,GAEP,KAAK,CA+HjB;6BAlKS,sBAAsB;2BAAtB,sBAAsB;+BAAtB,sBAAsB"}
|
node_modules/micromark-factory-title/index.js
ADDED
|
@@ -0,0 +1,158 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* @import {
|
| 3 |
+
* Code,
|
| 4 |
+
* Effects,
|
| 5 |
+
* State,
|
| 6 |
+
* TokenType
|
| 7 |
+
* } from 'micromark-util-types'
|
| 8 |
+
*/
|
| 9 |
+
|
| 10 |
+
import { factorySpace } from 'micromark-factory-space';
|
| 11 |
+
import { markdownLineEnding } from 'micromark-util-character';
|
| 12 |
+
/**
|
| 13 |
+
* Parse titles.
|
| 14 |
+
*
|
| 15 |
+
* ###### Examples
|
| 16 |
+
*
|
| 17 |
+
* ```markdown
|
| 18 |
+
* "a"
|
| 19 |
+
* 'b'
|
| 20 |
+
* (c)
|
| 21 |
+
* "a
|
| 22 |
+
* b"
|
| 23 |
+
* 'a
|
| 24 |
+
* b'
|
| 25 |
+
* (a\)b)
|
| 26 |
+
* ```
|
| 27 |
+
*
|
| 28 |
+
* @param {Effects} effects
|
| 29 |
+
* Context.
|
| 30 |
+
* @param {State} ok
|
| 31 |
+
* State switched to when successful.
|
| 32 |
+
* @param {State} nok
|
| 33 |
+
* State switched to when unsuccessful.
|
| 34 |
+
* @param {TokenType} type
|
| 35 |
+
* Type of the whole title (`"a"`, `'b'`, `(c)`).
|
| 36 |
+
* @param {TokenType} markerType
|
| 37 |
+
* Type for the markers (`"`, `'`, `(`, and `)`).
|
| 38 |
+
* @param {TokenType} stringType
|
| 39 |
+
* Type for the value (`a`).
|
| 40 |
+
* @returns {State}
|
| 41 |
+
* Start state.
|
| 42 |
+
*/
|
| 43 |
+
export function factoryTitle(effects, ok, nok, type, markerType, stringType) {
|
| 44 |
+
/** @type {NonNullable<Code>} */
|
| 45 |
+
let marker;
|
| 46 |
+
return start;
|
| 47 |
+
|
| 48 |
+
/**
|
| 49 |
+
* Start of title.
|
| 50 |
+
*
|
| 51 |
+
* ```markdown
|
| 52 |
+
* > | "a"
|
| 53 |
+
* ^
|
| 54 |
+
* ```
|
| 55 |
+
*
|
| 56 |
+
* @type {State}
|
| 57 |
+
*/
|
| 58 |
+
function start(code) {
|
| 59 |
+
if (code === 34 || code === 39 || code === 40) {
|
| 60 |
+
effects.enter(type);
|
| 61 |
+
effects.enter(markerType);
|
| 62 |
+
effects.consume(code);
|
| 63 |
+
effects.exit(markerType);
|
| 64 |
+
marker = code === 40 ? 41 : code;
|
| 65 |
+
return begin;
|
| 66 |
+
}
|
| 67 |
+
return nok(code);
|
| 68 |
+
}
|
| 69 |
+
|
| 70 |
+
/**
|
| 71 |
+
* After opening marker.
|
| 72 |
+
*
|
| 73 |
+
* This is also used at the closing marker.
|
| 74 |
+
*
|
| 75 |
+
* ```markdown
|
| 76 |
+
* > | "a"
|
| 77 |
+
* ^
|
| 78 |
+
* ```
|
| 79 |
+
*
|
| 80 |
+
* @type {State}
|
| 81 |
+
*/
|
| 82 |
+
function begin(code) {
|
| 83 |
+
if (code === marker) {
|
| 84 |
+
effects.enter(markerType);
|
| 85 |
+
effects.consume(code);
|
| 86 |
+
effects.exit(markerType);
|
| 87 |
+
effects.exit(type);
|
| 88 |
+
return ok;
|
| 89 |
+
}
|
| 90 |
+
effects.enter(stringType);
|
| 91 |
+
return atBreak(code);
|
| 92 |
+
}
|
| 93 |
+
|
| 94 |
+
/**
|
| 95 |
+
* At something, before something else.
|
| 96 |
+
*
|
| 97 |
+
* ```markdown
|
| 98 |
+
* > | "a"
|
| 99 |
+
* ^
|
| 100 |
+
* ```
|
| 101 |
+
*
|
| 102 |
+
* @type {State}
|
| 103 |
+
*/
|
| 104 |
+
function atBreak(code) {
|
| 105 |
+
if (code === marker) {
|
| 106 |
+
effects.exit(stringType);
|
| 107 |
+
return begin(marker);
|
| 108 |
+
}
|
| 109 |
+
if (code === null) {
|
| 110 |
+
return nok(code);
|
| 111 |
+
}
|
| 112 |
+
|
| 113 |
+
// Note: blank lines can’t exist in content.
|
| 114 |
+
if (markdownLineEnding(code)) {
|
| 115 |
+
// To do: use `space_or_tab_eol_with_options`, connect.
|
| 116 |
+
effects.enter("lineEnding");
|
| 117 |
+
effects.consume(code);
|
| 118 |
+
effects.exit("lineEnding");
|
| 119 |
+
return factorySpace(effects, atBreak, "linePrefix");
|
| 120 |
+
}
|
| 121 |
+
effects.enter("chunkString", {
|
| 122 |
+
contentType: "string"
|
| 123 |
+
});
|
| 124 |
+
return inside(code);
|
| 125 |
+
}
|
| 126 |
+
|
| 127 |
+
/**
|
| 128 |
+
*
|
| 129 |
+
*
|
| 130 |
+
* @type {State}
|
| 131 |
+
*/
|
| 132 |
+
function inside(code) {
|
| 133 |
+
if (code === marker || code === null || markdownLineEnding(code)) {
|
| 134 |
+
effects.exit("chunkString");
|
| 135 |
+
return atBreak(code);
|
| 136 |
+
}
|
| 137 |
+
effects.consume(code);
|
| 138 |
+
return code === 92 ? escape : inside;
|
| 139 |
+
}
|
| 140 |
+
|
| 141 |
+
/**
|
| 142 |
+
* After `\`, at a special character.
|
| 143 |
+
*
|
| 144 |
+
* ```markdown
|
| 145 |
+
* > | "a\*b"
|
| 146 |
+
* ^
|
| 147 |
+
* ```
|
| 148 |
+
*
|
| 149 |
+
* @type {State}
|
| 150 |
+
*/
|
| 151 |
+
function escape(code) {
|
| 152 |
+
if (code === marker || code === 92) {
|
| 153 |
+
effects.consume(code);
|
| 154 |
+
return inside;
|
| 155 |
+
}
|
| 156 |
+
return inside(code);
|
| 157 |
+
}
|
| 158 |
+
}
|
node_modules/micromark-factory-title/license
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
(The MIT License)
|
| 2 |
+
|
| 3 |
+
Copyright (c) Titus Wormer <tituswormer@gmail.com>
|
| 4 |
+
|
| 5 |
+
Permission is hereby granted, free of charge, to any person obtaining
|
| 6 |
+
a copy of this software and associated documentation files (the
|
| 7 |
+
'Software'), to deal in the Software without restriction, including
|
| 8 |
+
without limitation the rights to use, copy, modify, merge, publish,
|
| 9 |
+
distribute, sublicense, and/or sell copies of the Software, and to
|
| 10 |
+
permit persons to whom the Software is furnished to do so, subject to
|
| 11 |
+
the following conditions:
|
| 12 |
+
|
| 13 |
+
The above copyright notice and this permission notice shall be
|
| 14 |
+
included in all copies or substantial portions of the Software.
|
| 15 |
+
|
| 16 |
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
| 17 |
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
| 18 |
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
| 19 |
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
| 20 |
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
| 21 |
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
| 22 |
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
node_modules/micromark-factory-title/package.json
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"name": "micromark-factory-title",
|
| 3 |
+
"version": "2.0.1",
|
| 4 |
+
"description": "micromark factory to parse markdown titles (found in resources, definitions)",
|
| 5 |
+
"license": "MIT",
|
| 6 |
+
"keywords": [
|
| 7 |
+
"micromark",
|
| 8 |
+
"factory",
|
| 9 |
+
"title"
|
| 10 |
+
],
|
| 11 |
+
"repository": "https://github.com/micromark/micromark/tree/main/packages/micromark-factory-title",
|
| 12 |
+
"bugs": "https://github.com/micromark/micromark/issues",
|
| 13 |
+
"funding": [
|
| 14 |
+
{
|
| 15 |
+
"type": "GitHub Sponsors",
|
| 16 |
+
"url": "https://github.com/sponsors/unifiedjs"
|
| 17 |
+
},
|
| 18 |
+
{
|
| 19 |
+
"type": "OpenCollective",
|
| 20 |
+
"url": "https://opencollective.com/unified"
|
| 21 |
+
}
|
| 22 |
+
],
|
| 23 |
+
"author": "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)",
|
| 24 |
+
"contributors": [
|
| 25 |
+
"Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)"
|
| 26 |
+
],
|
| 27 |
+
"sideEffects": false,
|
| 28 |
+
"type": "module",
|
| 29 |
+
"files": [
|
| 30 |
+
"dev/",
|
| 31 |
+
"index.d.ts.map",
|
| 32 |
+
"index.d.ts",
|
| 33 |
+
"index.js"
|
| 34 |
+
],
|
| 35 |
+
"exports": {
|
| 36 |
+
"development": "./dev/index.js",
|
| 37 |
+
"default": "./index.js"
|
| 38 |
+
},
|
| 39 |
+
"dependencies": {
|
| 40 |
+
"micromark-factory-space": "^2.0.0",
|
| 41 |
+
"micromark-util-character": "^2.0.0",
|
| 42 |
+
"micromark-util-symbol": "^2.0.0",
|
| 43 |
+
"micromark-util-types": "^2.0.0"
|
| 44 |
+
},
|
| 45 |
+
"scripts": {
|
| 46 |
+
"build": "micromark-build"
|
| 47 |
+
},
|
| 48 |
+
"xo": {
|
| 49 |
+
"envs": [
|
| 50 |
+
"shared-node-browser"
|
| 51 |
+
],
|
| 52 |
+
"prettier": true,
|
| 53 |
+
"rules": {
|
| 54 |
+
"max-params": "off",
|
| 55 |
+
"unicorn/prefer-code-point": "off"
|
| 56 |
+
}
|
| 57 |
+
}
|
| 58 |
+
}
|
node_modules/micromark-factory-title/readme.md
ADDED
|
@@ -0,0 +1,229 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# micromark-factory-title
|
| 2 |
+
|
| 3 |
+
[![Build][build-badge]][build]
|
| 4 |
+
[![Coverage][coverage-badge]][coverage]
|
| 5 |
+
[![Downloads][downloads-badge]][downloads]
|
| 6 |
+
[![Size][bundle-size-badge]][bundle-size]
|
| 7 |
+
[![Sponsors][sponsors-badge]][opencollective]
|
| 8 |
+
[![Backers][backers-badge]][opencollective]
|
| 9 |
+
[![Chat][chat-badge]][chat]
|
| 10 |
+
|
| 11 |
+
[micromark][] factory to parse markdown titles (found in resources,
|
| 12 |
+
definitions).
|
| 13 |
+
|
| 14 |
+
## Contents
|
| 15 |
+
|
| 16 |
+
* [What is this?](#what-is-this)
|
| 17 |
+
* [When should I use this?](#when-should-i-use-this)
|
| 18 |
+
* [Install](#install)
|
| 19 |
+
* [Use](#use)
|
| 20 |
+
* [API](#api)
|
| 21 |
+
* [`factoryTitle(…)`](#factorytitle)
|
| 22 |
+
* [Types](#types)
|
| 23 |
+
* [Compatibility](#compatibility)
|
| 24 |
+
* [Security](#security)
|
| 25 |
+
* [Contribute](#contribute)
|
| 26 |
+
* [License](#license)
|
| 27 |
+
|
| 28 |
+
## What is this?
|
| 29 |
+
|
| 30 |
+
This package exposes states to parse titles.
|
| 31 |
+
|
| 32 |
+
## When should I use this?
|
| 33 |
+
|
| 34 |
+
This package is useful when you are making your own micromark extensions.
|
| 35 |
+
|
| 36 |
+
## Install
|
| 37 |
+
|
| 38 |
+
This package is [ESM only][esm].
|
| 39 |
+
In Node.js (version 16+), install with [npm][]:
|
| 40 |
+
|
| 41 |
+
```sh
|
| 42 |
+
npm install micromark-factory-title
|
| 43 |
+
```
|
| 44 |
+
|
| 45 |
+
In Deno with [`esm.sh`][esmsh]:
|
| 46 |
+
|
| 47 |
+
```js
|
| 48 |
+
import {factorySpace} from 'https://esm.sh/micromark-factory-title@1'
|
| 49 |
+
```
|
| 50 |
+
|
| 51 |
+
In browsers with [`esm.sh`][esmsh]:
|
| 52 |
+
|
| 53 |
+
```html
|
| 54 |
+
<script type="module">
|
| 55 |
+
import {factorySpace} from 'https://esm.sh/micromark-factory-title@1?bundle'
|
| 56 |
+
</script>
|
| 57 |
+
```
|
| 58 |
+
|
| 59 |
+
## Use
|
| 60 |
+
|
| 61 |
+
```js
|
| 62 |
+
import {factoryTitle} from 'micromark-factory-title'
|
| 63 |
+
import {codes, types} from 'micromark-util-symbol'
|
| 64 |
+
|
| 65 |
+
// A micromark tokenizer that uses the factory:
|
| 66 |
+
/**
|
| 67 |
+
* @this {TokenizeContext}
|
| 68 |
+
* Context.
|
| 69 |
+
* @type {Tokenizer}
|
| 70 |
+
*/
|
| 71 |
+
function tokenizeDefinition(effects, ok, nok) {
|
| 72 |
+
return start
|
| 73 |
+
|
| 74 |
+
// …
|
| 75 |
+
|
| 76 |
+
/** @type {State} */
|
| 77 |
+
function before(code) {
|
| 78 |
+
if (
|
| 79 |
+
code === codes.quotationMark ||
|
| 80 |
+
code === codes.apostrophe ||
|
| 81 |
+
code === codes.leftParenthesis
|
| 82 |
+
) {
|
| 83 |
+
return factoryTitle(
|
| 84 |
+
effects,
|
| 85 |
+
factorySpace(effects, after, types.whitespace),
|
| 86 |
+
nok,
|
| 87 |
+
types.definitionTitle,
|
| 88 |
+
types.definitionTitleMarker,
|
| 89 |
+
types.definitionTitleString
|
| 90 |
+
)(code)
|
| 91 |
+
}
|
| 92 |
+
|
| 93 |
+
return nok(code)
|
| 94 |
+
}
|
| 95 |
+
|
| 96 |
+
// …
|
| 97 |
+
}
|
| 98 |
+
```
|
| 99 |
+
|
| 100 |
+
## API
|
| 101 |
+
|
| 102 |
+
This module exports the identifier [`factoryTitle`][api-factory-title].
|
| 103 |
+
There is no default export.
|
| 104 |
+
|
| 105 |
+
### `factoryTitle(…)`
|
| 106 |
+
|
| 107 |
+
Parse titles.
|
| 108 |
+
|
| 109 |
+
###### Examples
|
| 110 |
+
|
| 111 |
+
```markdown
|
| 112 |
+
"a"
|
| 113 |
+
'b'
|
| 114 |
+
(c)
|
| 115 |
+
"a
|
| 116 |
+
b"
|
| 117 |
+
'a
|
| 118 |
+
b'
|
| 119 |
+
(a\)b)
|
| 120 |
+
```
|
| 121 |
+
|
| 122 |
+
###### Parameters
|
| 123 |
+
|
| 124 |
+
* `effects` (`Effects`)
|
| 125 |
+
— context
|
| 126 |
+
* `ok` (`State`)
|
| 127 |
+
— state switched to when successful
|
| 128 |
+
* `nok` (`State`)
|
| 129 |
+
— state switched to when unsuccessful
|
| 130 |
+
* `type` (`string`)
|
| 131 |
+
— type of the whole title (`"a"`, `'b'`, `(c)`)
|
| 132 |
+
* `markerType` (`string`)
|
| 133 |
+
— type for the markers (`"`, `'`, `(`, and `)`)
|
| 134 |
+
* `stringType` (`string`)
|
| 135 |
+
— type for the value (`a`)
|
| 136 |
+
|
| 137 |
+
###### Returns
|
| 138 |
+
|
| 139 |
+
Start state (`State`).
|
| 140 |
+
|
| 141 |
+
## Types
|
| 142 |
+
|
| 143 |
+
This package is fully typed with [TypeScript][].
|
| 144 |
+
It exports no additional types.
|
| 145 |
+
|
| 146 |
+
## Compatibility
|
| 147 |
+
|
| 148 |
+
Projects maintained by the unified collective are compatible with maintained
|
| 149 |
+
versions of Node.js.
|
| 150 |
+
|
| 151 |
+
When we cut a new major release, we drop support for unmaintained versions of
|
| 152 |
+
Node.
|
| 153 |
+
This means we try to keep the current release line,
|
| 154 |
+
`micromark-factory-title@2`, compatible with Node.js 16.
|
| 155 |
+
This package works with `micromark@3`.
|
| 156 |
+
|
| 157 |
+
## Security
|
| 158 |
+
|
| 159 |
+
This package is safe.
|
| 160 |
+
See [`security.md`][securitymd] in [`micromark/.github`][health] for how to
|
| 161 |
+
submit a security report.
|
| 162 |
+
|
| 163 |
+
## Contribute
|
| 164 |
+
|
| 165 |
+
See [`contributing.md`][contributing] in [`micromark/.github`][health] for ways
|
| 166 |
+
to get started.
|
| 167 |
+
See [`support.md`][support] for ways to get help.
|
| 168 |
+
|
| 169 |
+
This project has a [code of conduct][coc].
|
| 170 |
+
By interacting with this repository, organisation, or community you agree to
|
| 171 |
+
abide by its terms.
|
| 172 |
+
|
| 173 |
+
## License
|
| 174 |
+
|
| 175 |
+
[MIT][license] © [Titus Wormer][author]
|
| 176 |
+
|
| 177 |
+
<!-- Definitions -->
|
| 178 |
+
|
| 179 |
+
[build-badge]: https://github.com/micromark/micromark/workflows/main/badge.svg
|
| 180 |
+
|
| 181 |
+
[build]: https://github.com/micromark/micromark/actions
|
| 182 |
+
|
| 183 |
+
[coverage-badge]: https://img.shields.io/codecov/c/github/micromark/micromark.svg
|
| 184 |
+
|
| 185 |
+
[coverage]: https://codecov.io/github/micromark/micromark
|
| 186 |
+
|
| 187 |
+
[downloads-badge]: https://img.shields.io/npm/dm/micromark-factory-title.svg
|
| 188 |
+
|
| 189 |
+
[downloads]: https://www.npmjs.com/package/micromark-factory-title
|
| 190 |
+
|
| 191 |
+
[bundle-size-badge]: https://img.shields.io/badge/dynamic/json?label=minzipped%20size&query=$.size.compressedSize&url=https://deno.bundlejs.com/?q=micromark-factory-title
|
| 192 |
+
|
| 193 |
+
[bundle-size]: https://bundlejs.com/?q=micromark-factory-title
|
| 194 |
+
|
| 195 |
+
[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg
|
| 196 |
+
|
| 197 |
+
[backers-badge]: https://opencollective.com/unified/backers/badge.svg
|
| 198 |
+
|
| 199 |
+
[opencollective]: https://opencollective.com/unified
|
| 200 |
+
|
| 201 |
+
[npm]: https://docs.npmjs.com/cli/install
|
| 202 |
+
|
| 203 |
+
[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c
|
| 204 |
+
|
| 205 |
+
[esmsh]: https://esm.sh
|
| 206 |
+
|
| 207 |
+
[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg
|
| 208 |
+
|
| 209 |
+
[chat]: https://github.com/micromark/micromark/discussions
|
| 210 |
+
|
| 211 |
+
[license]: https://github.com/micromark/micromark/blob/main/license
|
| 212 |
+
|
| 213 |
+
[author]: https://wooorm.com
|
| 214 |
+
|
| 215 |
+
[health]: https://github.com/micromark/.github
|
| 216 |
+
|
| 217 |
+
[securitymd]: https://github.com/micromark/.github/blob/main/security.md
|
| 218 |
+
|
| 219 |
+
[contributing]: https://github.com/micromark/.github/blob/main/contributing.md
|
| 220 |
+
|
| 221 |
+
[support]: https://github.com/micromark/.github/blob/main/support.md
|
| 222 |
+
|
| 223 |
+
[coc]: https://github.com/micromark/.github/blob/main/code-of-conduct.md
|
| 224 |
+
|
| 225 |
+
[typescript]: https://www.typescriptlang.org
|
| 226 |
+
|
| 227 |
+
[micromark]: https://github.com/micromark/micromark
|
| 228 |
+
|
| 229 |
+
[api-factory-title]: #factorytitle
|
node_modules/micromark-factory-whitespace/dev/index.d.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* Parse spaces and tabs.
|
| 3 |
+
*
|
| 4 |
+
* There is no `nok` parameter:
|
| 5 |
+
*
|
| 6 |
+
* * line endings or spaces in markdown are often optional, in which case this
|
| 7 |
+
* factory can be used and `ok` will be switched to whether spaces were found
|
| 8 |
+
* or not
|
| 9 |
+
* * one line ending or space can be detected with
|
| 10 |
+
* `markdownLineEndingOrSpace(code)` right before using `factoryWhitespace`
|
| 11 |
+
*
|
| 12 |
+
* @param {Effects} effects
|
| 13 |
+
* Context.
|
| 14 |
+
* @param {State} ok
|
| 15 |
+
* State switched to when successful.
|
| 16 |
+
* @returns {State}
|
| 17 |
+
* Start state.
|
| 18 |
+
*/
|
| 19 |
+
export function factoryWhitespace(effects: Effects, ok: State): State;
|
| 20 |
+
import type { Effects } from 'micromark-util-types';
|
| 21 |
+
import type { State } from 'micromark-util-types';
|
| 22 |
+
//# sourceMappingURL=index.d.ts.map
|
node_modules/micromark-factory-whitespace/dev/index.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":"AAQA;;;;;;;;;;;;;;;;;GAiBG;AACH,2CAPW,OAAO,MAEP,KAAK,GAEH,KAAK,CA6BjB;6BAnDgC,sBAAsB;2BAAtB,sBAAsB"}
|
node_modules/micromark-factory-whitespace/dev/index.js
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* @import {Effects, State} from 'micromark-util-types'
|
| 3 |
+
*/
|
| 4 |
+
|
| 5 |
+
import {factorySpace} from 'micromark-factory-space'
|
| 6 |
+
import {markdownLineEnding, markdownSpace} from 'micromark-util-character'
|
| 7 |
+
import {types} from 'micromark-util-symbol'
|
| 8 |
+
|
| 9 |
+
/**
|
| 10 |
+
* Parse spaces and tabs.
|
| 11 |
+
*
|
| 12 |
+
* There is no `nok` parameter:
|
| 13 |
+
*
|
| 14 |
+
* * line endings or spaces in markdown are often optional, in which case this
|
| 15 |
+
* factory can be used and `ok` will be switched to whether spaces were found
|
| 16 |
+
* or not
|
| 17 |
+
* * one line ending or space can be detected with
|
| 18 |
+
* `markdownLineEndingOrSpace(code)` right before using `factoryWhitespace`
|
| 19 |
+
*
|
| 20 |
+
* @param {Effects} effects
|
| 21 |
+
* Context.
|
| 22 |
+
* @param {State} ok
|
| 23 |
+
* State switched to when successful.
|
| 24 |
+
* @returns {State}
|
| 25 |
+
* Start state.
|
| 26 |
+
*/
|
| 27 |
+
export function factoryWhitespace(effects, ok) {
|
| 28 |
+
/** @type {boolean} */
|
| 29 |
+
let seen
|
| 30 |
+
|
| 31 |
+
return start
|
| 32 |
+
|
| 33 |
+
/** @type {State} */
|
| 34 |
+
function start(code) {
|
| 35 |
+
if (markdownLineEnding(code)) {
|
| 36 |
+
effects.enter(types.lineEnding)
|
| 37 |
+
effects.consume(code)
|
| 38 |
+
effects.exit(types.lineEnding)
|
| 39 |
+
seen = true
|
| 40 |
+
return start
|
| 41 |
+
}
|
| 42 |
+
|
| 43 |
+
if (markdownSpace(code)) {
|
| 44 |
+
return factorySpace(
|
| 45 |
+
effects,
|
| 46 |
+
start,
|
| 47 |
+
seen ? types.linePrefix : types.lineSuffix
|
| 48 |
+
)(code)
|
| 49 |
+
}
|
| 50 |
+
|
| 51 |
+
return ok(code)
|
| 52 |
+
}
|
| 53 |
+
}
|
node_modules/micromark-factory-whitespace/index.d.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* Parse spaces and tabs.
|
| 3 |
+
*
|
| 4 |
+
* There is no `nok` parameter:
|
| 5 |
+
*
|
| 6 |
+
* * line endings or spaces in markdown are often optional, in which case this
|
| 7 |
+
* factory can be used and `ok` will be switched to whether spaces were found
|
| 8 |
+
* or not
|
| 9 |
+
* * one line ending or space can be detected with
|
| 10 |
+
* `markdownLineEndingOrSpace(code)` right before using `factoryWhitespace`
|
| 11 |
+
*
|
| 12 |
+
* @param {Effects} effects
|
| 13 |
+
* Context.
|
| 14 |
+
* @param {State} ok
|
| 15 |
+
* State switched to when successful.
|
| 16 |
+
* @returns {State}
|
| 17 |
+
* Start state.
|
| 18 |
+
*/
|
| 19 |
+
export function factoryWhitespace(effects: Effects, ok: State): State;
|
| 20 |
+
import type { Effects } from 'micromark-util-types';
|
| 21 |
+
import type { State } from 'micromark-util-types';
|
| 22 |
+
//# sourceMappingURL=index.d.ts.map
|
node_modules/micromark-factory-whitespace/index.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":"AAQA;;;;;;;;;;;;;;;;;GAiBG;AACH,2CAPW,OAAO,MAEP,KAAK,GAEH,KAAK,CA6BjB;6BAnDgC,sBAAsB;2BAAtB,sBAAsB"}
|
node_modules/micromark-factory-whitespace/index.js
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* @import {Effects, State} from 'micromark-util-types'
|
| 3 |
+
*/
|
| 4 |
+
|
| 5 |
+
import { factorySpace } from 'micromark-factory-space';
|
| 6 |
+
import { markdownLineEnding, markdownSpace } from 'micromark-util-character';
|
| 7 |
+
/**
|
| 8 |
+
* Parse spaces and tabs.
|
| 9 |
+
*
|
| 10 |
+
* There is no `nok` parameter:
|
| 11 |
+
*
|
| 12 |
+
* * line endings or spaces in markdown are often optional, in which case this
|
| 13 |
+
* factory can be used and `ok` will be switched to whether spaces were found
|
| 14 |
+
* or not
|
| 15 |
+
* * one line ending or space can be detected with
|
| 16 |
+
* `markdownLineEndingOrSpace(code)` right before using `factoryWhitespace`
|
| 17 |
+
*
|
| 18 |
+
* @param {Effects} effects
|
| 19 |
+
* Context.
|
| 20 |
+
* @param {State} ok
|
| 21 |
+
* State switched to when successful.
|
| 22 |
+
* @returns {State}
|
| 23 |
+
* Start state.
|
| 24 |
+
*/
|
| 25 |
+
export function factoryWhitespace(effects, ok) {
|
| 26 |
+
/** @type {boolean} */
|
| 27 |
+
let seen;
|
| 28 |
+
return start;
|
| 29 |
+
|
| 30 |
+
/** @type {State} */
|
| 31 |
+
function start(code) {
|
| 32 |
+
if (markdownLineEnding(code)) {
|
| 33 |
+
effects.enter("lineEnding");
|
| 34 |
+
effects.consume(code);
|
| 35 |
+
effects.exit("lineEnding");
|
| 36 |
+
seen = true;
|
| 37 |
+
return start;
|
| 38 |
+
}
|
| 39 |
+
if (markdownSpace(code)) {
|
| 40 |
+
return factorySpace(effects, start, seen ? "linePrefix" : "lineSuffix")(code);
|
| 41 |
+
}
|
| 42 |
+
return ok(code);
|
| 43 |
+
}
|
| 44 |
+
}
|
node_modules/micromark-factory-whitespace/license
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
(The MIT License)
|
| 2 |
+
|
| 3 |
+
Copyright (c) Titus Wormer <tituswormer@gmail.com>
|
| 4 |
+
|
| 5 |
+
Permission is hereby granted, free of charge, to any person obtaining
|
| 6 |
+
a copy of this software and associated documentation files (the
|
| 7 |
+
'Software'), to deal in the Software without restriction, including
|
| 8 |
+
without limitation the rights to use, copy, modify, merge, publish,
|
| 9 |
+
distribute, sublicense, and/or sell copies of the Software, and to
|
| 10 |
+
permit persons to whom the Software is furnished to do so, subject to
|
| 11 |
+
the following conditions:
|
| 12 |
+
|
| 13 |
+
The above copyright notice and this permission notice shall be
|
| 14 |
+
included in all copies or substantial portions of the Software.
|
| 15 |
+
|
| 16 |
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
| 17 |
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
| 18 |
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
| 19 |
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
| 20 |
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
| 21 |
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
| 22 |
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
node_modules/micromark-factory-whitespace/package.json
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"name": "micromark-factory-whitespace",
|
| 3 |
+
"version": "2.0.1",
|
| 4 |
+
"description": "micromark factory to parse markdown whitespace (found in lots of places)",
|
| 5 |
+
"license": "MIT",
|
| 6 |
+
"keywords": [
|
| 7 |
+
"micromark",
|
| 8 |
+
"factory",
|
| 9 |
+
"whitespace"
|
| 10 |
+
],
|
| 11 |
+
"repository": "https://github.com/micromark/micromark/tree/main/packages/micromark-factory-whitespace",
|
| 12 |
+
"bugs": "https://github.com/micromark/micromark/issues",
|
| 13 |
+
"funding": [
|
| 14 |
+
{
|
| 15 |
+
"type": "GitHub Sponsors",
|
| 16 |
+
"url": "https://github.com/sponsors/unifiedjs"
|
| 17 |
+
},
|
| 18 |
+
{
|
| 19 |
+
"type": "OpenCollective",
|
| 20 |
+
"url": "https://opencollective.com/unified"
|
| 21 |
+
}
|
| 22 |
+
],
|
| 23 |
+
"author": "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)",
|
| 24 |
+
"contributors": [
|
| 25 |
+
"Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)"
|
| 26 |
+
],
|
| 27 |
+
"sideEffects": false,
|
| 28 |
+
"type": "module",
|
| 29 |
+
"files": [
|
| 30 |
+
"dev/",
|
| 31 |
+
"index.d.ts.map",
|
| 32 |
+
"index.d.ts",
|
| 33 |
+
"index.js"
|
| 34 |
+
],
|
| 35 |
+
"exports": {
|
| 36 |
+
"development": "./dev/index.js",
|
| 37 |
+
"default": "./index.js"
|
| 38 |
+
},
|
| 39 |
+
"dependencies": {
|
| 40 |
+
"micromark-factory-space": "^2.0.0",
|
| 41 |
+
"micromark-util-character": "^2.0.0",
|
| 42 |
+
"micromark-util-symbol": "^2.0.0",
|
| 43 |
+
"micromark-util-types": "^2.0.0"
|
| 44 |
+
},
|
| 45 |
+
"scripts": {
|
| 46 |
+
"build": "micromark-build"
|
| 47 |
+
},
|
| 48 |
+
"xo": {
|
| 49 |
+
"envs": [
|
| 50 |
+
"shared-node-browser"
|
| 51 |
+
],
|
| 52 |
+
"prettier": true,
|
| 53 |
+
"rules": {
|
| 54 |
+
"unicorn/prefer-code-point": "off"
|
| 55 |
+
}
|
| 56 |
+
}
|
| 57 |
+
}
|
node_modules/micromark-factory-whitespace/readme.md
ADDED
|
@@ -0,0 +1,205 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# micromark-factory-whitespace
|
| 2 |
+
|
| 3 |
+
[![Build][build-badge]][build]
|
| 4 |
+
[![Coverage][coverage-badge]][coverage]
|
| 5 |
+
[![Downloads][downloads-badge]][downloads]
|
| 6 |
+
[![Size][bundle-size-badge]][bundle-size]
|
| 7 |
+
[![Sponsors][sponsors-badge]][opencollective]
|
| 8 |
+
[![Backers][backers-badge]][opencollective]
|
| 9 |
+
[![Chat][chat-badge]][chat]
|
| 10 |
+
|
| 11 |
+
[micromark][] factory to parse [markdown line endings or spaces][ws] (found in
|
| 12 |
+
lots of places).
|
| 13 |
+
|
| 14 |
+
## Contents
|
| 15 |
+
|
| 16 |
+
* [What is this?](#what-is-this)
|
| 17 |
+
* [When should I use this?](#when-should-i-use-this)
|
| 18 |
+
* [Install](#install)
|
| 19 |
+
* [Use](#use)
|
| 20 |
+
* [API](#api)
|
| 21 |
+
* [`factoryWhitespace(…)`](#factorywhitespace)
|
| 22 |
+
* [Types](#types)
|
| 23 |
+
* [Compatibility](#compatibility)
|
| 24 |
+
* [Security](#security)
|
| 25 |
+
* [Contribute](#contribute)
|
| 26 |
+
* [License](#license)
|
| 27 |
+
|
| 28 |
+
## What is this?
|
| 29 |
+
|
| 30 |
+
This package exposes states to parse whitespace.
|
| 31 |
+
|
| 32 |
+
## When should I use this?
|
| 33 |
+
|
| 34 |
+
This package is useful when you are making your own micromark extensions.
|
| 35 |
+
|
| 36 |
+
## Install
|
| 37 |
+
|
| 38 |
+
This package is [ESM only][esm].
|
| 39 |
+
In Node.js (version 16+), install with [npm][]:
|
| 40 |
+
|
| 41 |
+
```sh
|
| 42 |
+
npm install micromark-factory-whitespace
|
| 43 |
+
```
|
| 44 |
+
|
| 45 |
+
In Deno with [`esm.sh`][esmsh]:
|
| 46 |
+
|
| 47 |
+
```js
|
| 48 |
+
import {factoryWhitespace} from 'https://esm.sh/micromark-factory-whitespace@1'
|
| 49 |
+
```
|
| 50 |
+
|
| 51 |
+
In browsers with [`esm.sh`][esmsh]:
|
| 52 |
+
|
| 53 |
+
```html
|
| 54 |
+
<script type="module">
|
| 55 |
+
import {factoryWhitespace} from 'https://esm.sh/micromark-factory-whitespace@1?bundle'
|
| 56 |
+
</script>
|
| 57 |
+
```
|
| 58 |
+
|
| 59 |
+
## Use
|
| 60 |
+
|
| 61 |
+
```js
|
| 62 |
+
import {factoryWhitespace} from 'micromark-factory-whitespace'
|
| 63 |
+
import {codes, types} from 'micromark-util-symbol'
|
| 64 |
+
|
| 65 |
+
// A micromark tokenizer that uses the factory:
|
| 66 |
+
/**
|
| 67 |
+
* @this {TokenizeContext}
|
| 68 |
+
* Context.
|
| 69 |
+
* @type {Tokenizer}
|
| 70 |
+
*/
|
| 71 |
+
function tokenizeTitle(effects, ok, nok) {
|
| 72 |
+
return start
|
| 73 |
+
|
| 74 |
+
/** @type {State} */
|
| 75 |
+
function start(code) {
|
| 76 |
+
return markdownLineEndingOrSpace(code)
|
| 77 |
+
? factoryWhitespace(effects, before)(code)
|
| 78 |
+
: nok(code)
|
| 79 |
+
}
|
| 80 |
+
|
| 81 |
+
// …
|
| 82 |
+
}
|
| 83 |
+
```
|
| 84 |
+
|
| 85 |
+
## API
|
| 86 |
+
|
| 87 |
+
This module exports the identifier
|
| 88 |
+
[`factoryWhitespace`][api-factory-whitespace].
|
| 89 |
+
There is no default export.
|
| 90 |
+
|
| 91 |
+
### `factoryWhitespace(…)`
|
| 92 |
+
|
| 93 |
+
Parse spaces and tabs.
|
| 94 |
+
|
| 95 |
+
There is no `nok` parameter:
|
| 96 |
+
|
| 97 |
+
* line endings or spaces in markdown are often optional, in which case this
|
| 98 |
+
factory can be used and `ok` will be switched to whether spaces were found
|
| 99 |
+
or not
|
| 100 |
+
* one line ending or space can be detected with
|
| 101 |
+
[`markdownLineEndingOrSpace(code)`][ws] right before using
|
| 102 |
+
`factoryWhitespace`
|
| 103 |
+
|
| 104 |
+
###### Parameters
|
| 105 |
+
|
| 106 |
+
* `effects` (`Effects`)
|
| 107 |
+
— context
|
| 108 |
+
* `ok` (`State`)
|
| 109 |
+
— state switched to when successful
|
| 110 |
+
|
| 111 |
+
###### Returns
|
| 112 |
+
|
| 113 |
+
Start state (`State`).
|
| 114 |
+
|
| 115 |
+
## Types
|
| 116 |
+
|
| 117 |
+
This package is fully typed with [TypeScript][].
|
| 118 |
+
It exports no additional types.
|
| 119 |
+
|
| 120 |
+
## Compatibility
|
| 121 |
+
|
| 122 |
+
Projects maintained by the unified collective are compatible with maintained
|
| 123 |
+
versions of Node.js.
|
| 124 |
+
|
| 125 |
+
When we cut a new major release, we drop support for unmaintained versions of
|
| 126 |
+
Node.
|
| 127 |
+
This means we try to keep the current release line,
|
| 128 |
+
`micromark-factory-whitespace@2`, compatible with Node.js 16.
|
| 129 |
+
This package works with `micromark@3`.
|
| 130 |
+
|
| 131 |
+
## Security
|
| 132 |
+
|
| 133 |
+
This package is safe.
|
| 134 |
+
See [`security.md`][securitymd] in [`micromark/.github`][health] for how to
|
| 135 |
+
submit a security report.
|
| 136 |
+
|
| 137 |
+
## Contribute
|
| 138 |
+
|
| 139 |
+
See [`contributing.md`][contributing] in [`micromark/.github`][health] for ways
|
| 140 |
+
to get started.
|
| 141 |
+
See [`support.md`][support] for ways to get help.
|
| 142 |
+
|
| 143 |
+
This project has a [code of conduct][coc].
|
| 144 |
+
By interacting with this repository, organisation, or community you agree to
|
| 145 |
+
abide by its terms.
|
| 146 |
+
|
| 147 |
+
## License
|
| 148 |
+
|
| 149 |
+
[MIT][license] © [Titus Wormer][author]
|
| 150 |
+
|
| 151 |
+
<!-- Definitions -->
|
| 152 |
+
|
| 153 |
+
[build-badge]: https://github.com/micromark/micromark/workflows/main/badge.svg
|
| 154 |
+
|
| 155 |
+
[build]: https://github.com/micromark/micromark/actions
|
| 156 |
+
|
| 157 |
+
[coverage-badge]: https://img.shields.io/codecov/c/github/micromark/micromark.svg
|
| 158 |
+
|
| 159 |
+
[coverage]: https://codecov.io/github/micromark/micromark
|
| 160 |
+
|
| 161 |
+
[downloads-badge]: https://img.shields.io/npm/dm/micromark-factory-whitespace.svg
|
| 162 |
+
|
| 163 |
+
[downloads]: https://www.npmjs.com/package/micromark-factory-whitespace
|
| 164 |
+
|
| 165 |
+
[bundle-size-badge]: https://img.shields.io/badge/dynamic/json?label=minzipped%20size&query=$.size.compressedSize&url=https://deno.bundlejs.com/?q=micromark-factory-whitespace
|
| 166 |
+
|
| 167 |
+
[bundle-size]: https://bundlejs.com/?q=micromark-factory-whitespace
|
| 168 |
+
|
| 169 |
+
[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg
|
| 170 |
+
|
| 171 |
+
[backers-badge]: https://opencollective.com/unified/backers/badge.svg
|
| 172 |
+
|
| 173 |
+
[opencollective]: https://opencollective.com/unified
|
| 174 |
+
|
| 175 |
+
[npm]: https://docs.npmjs.com/cli/install
|
| 176 |
+
|
| 177 |
+
[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c
|
| 178 |
+
|
| 179 |
+
[esmsh]: https://esm.sh
|
| 180 |
+
|
| 181 |
+
[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg
|
| 182 |
+
|
| 183 |
+
[chat]: https://github.com/micromark/micromark/discussions
|
| 184 |
+
|
| 185 |
+
[license]: https://github.com/micromark/micromark/blob/main/license
|
| 186 |
+
|
| 187 |
+
[author]: https://wooorm.com
|
| 188 |
+
|
| 189 |
+
[health]: https://github.com/micromark/.github
|
| 190 |
+
|
| 191 |
+
[securitymd]: https://github.com/micromark/.github/blob/main/security.md
|
| 192 |
+
|
| 193 |
+
[contributing]: https://github.com/micromark/.github/blob/main/contributing.md
|
| 194 |
+
|
| 195 |
+
[support]: https://github.com/micromark/.github/blob/main/support.md
|
| 196 |
+
|
| 197 |
+
[coc]: https://github.com/micromark/.github/blob/main/code-of-conduct.md
|
| 198 |
+
|
| 199 |
+
[ws]: https://github.com/micromark/micromark/tree/main/packages/micromark-util-character#markdownlineendingorspacecode
|
| 200 |
+
|
| 201 |
+
[typescript]: https://www.typescriptlang.org
|
| 202 |
+
|
| 203 |
+
[micromark]: https://github.com/micromark/micromark
|
| 204 |
+
|
| 205 |
+
[api-factory-whitespace]: #factorywhitespace
|
node_modules/micromark-util-character/dev/index.d.ts
ADDED
|
@@ -0,0 +1,195 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* Check whether a character code is an ASCII control character.
|
| 3 |
+
*
|
| 4 |
+
* An **ASCII control** is a character in the inclusive range U+0000 NULL (NUL)
|
| 5 |
+
* to U+001F (US), or U+007F (DEL).
|
| 6 |
+
*
|
| 7 |
+
* @param {Code} code
|
| 8 |
+
* Code.
|
| 9 |
+
* @returns {boolean}
|
| 10 |
+
* Whether it matches.
|
| 11 |
+
*/
|
| 12 |
+
export function asciiControl(code: Code): boolean;
|
| 13 |
+
/**
|
| 14 |
+
* Check whether a character code is a markdown line ending.
|
| 15 |
+
*
|
| 16 |
+
* A **markdown line ending** is the virtual characters M-0003 CARRIAGE RETURN
|
| 17 |
+
* LINE FEED (CRLF), M-0004 LINE FEED (LF) and M-0005 CARRIAGE RETURN (CR).
|
| 18 |
+
*
|
| 19 |
+
* In micromark, the actual character U+000A LINE FEED (LF) and U+000D CARRIAGE
|
| 20 |
+
* RETURN (CR) are replaced by these virtual characters depending on whether
|
| 21 |
+
* they occurred together.
|
| 22 |
+
*
|
| 23 |
+
* @param {Code} code
|
| 24 |
+
* Code.
|
| 25 |
+
* @returns {boolean}
|
| 26 |
+
* Whether it matches.
|
| 27 |
+
*/
|
| 28 |
+
export function markdownLineEnding(code: Code): boolean;
|
| 29 |
+
/**
|
| 30 |
+
* Check whether a character code is a markdown line ending (see
|
| 31 |
+
* `markdownLineEnding`) or markdown space (see `markdownSpace`).
|
| 32 |
+
*
|
| 33 |
+
* @param {Code} code
|
| 34 |
+
* Code.
|
| 35 |
+
* @returns {boolean}
|
| 36 |
+
* Whether it matches.
|
| 37 |
+
*/
|
| 38 |
+
export function markdownLineEndingOrSpace(code: Code): boolean;
|
| 39 |
+
/**
|
| 40 |
+
* Check whether a character code is a markdown space.
|
| 41 |
+
*
|
| 42 |
+
* A **markdown space** is the concrete character U+0020 SPACE (SP) and the
|
| 43 |
+
* virtual characters M-0001 VIRTUAL SPACE (VS) and M-0002 HORIZONTAL TAB (HT).
|
| 44 |
+
*
|
| 45 |
+
* In micromark, the actual character U+0009 CHARACTER TABULATION (HT) is
|
| 46 |
+
* replaced by one M-0002 HORIZONTAL TAB (HT) and between 0 and 3 M-0001 VIRTUAL
|
| 47 |
+
* SPACE (VS) characters, depending on the column at which the tab occurred.
|
| 48 |
+
*
|
| 49 |
+
* @param {Code} code
|
| 50 |
+
* Code.
|
| 51 |
+
* @returns {boolean}
|
| 52 |
+
* Whether it matches.
|
| 53 |
+
*/
|
| 54 |
+
export function markdownSpace(code: Code): boolean;
|
| 55 |
+
/**
|
| 56 |
+
* Check whether the character code represents an ASCII alpha (`a` through `z`,
|
| 57 |
+
* case insensitive).
|
| 58 |
+
*
|
| 59 |
+
* An **ASCII alpha** is an ASCII upper alpha or ASCII lower alpha.
|
| 60 |
+
*
|
| 61 |
+
* An **ASCII upper alpha** is a character in the inclusive range U+0041 (`A`)
|
| 62 |
+
* to U+005A (`Z`).
|
| 63 |
+
*
|
| 64 |
+
* An **ASCII lower alpha** is a character in the inclusive range U+0061 (`a`)
|
| 65 |
+
* to U+007A (`z`).
|
| 66 |
+
*
|
| 67 |
+
* @param code
|
| 68 |
+
* Code.
|
| 69 |
+
* @returns {boolean}
|
| 70 |
+
* Whether it matches.
|
| 71 |
+
*/
|
| 72 |
+
export const asciiAlpha: (code: Code) => boolean;
|
| 73 |
+
/**
|
| 74 |
+
* Check whether the character code represents an ASCII alphanumeric (`a`
|
| 75 |
+
* through `z`, case insensitive, or `0` through `9`).
|
| 76 |
+
*
|
| 77 |
+
* An **ASCII alphanumeric** is an ASCII digit (see `asciiDigit`) or ASCII alpha
|
| 78 |
+
* (see `asciiAlpha`).
|
| 79 |
+
*
|
| 80 |
+
* @param code
|
| 81 |
+
* Code.
|
| 82 |
+
* @returns {boolean}
|
| 83 |
+
* Whether it matches.
|
| 84 |
+
*/
|
| 85 |
+
export const asciiAlphanumeric: (code: Code) => boolean;
|
| 86 |
+
/**
|
| 87 |
+
* Check whether the character code represents an ASCII atext.
|
| 88 |
+
*
|
| 89 |
+
* atext is an ASCII alphanumeric (see `asciiAlphanumeric`), or a character in
|
| 90 |
+
* the inclusive ranges U+0023 NUMBER SIGN (`#`) to U+0027 APOSTROPHE (`'`),
|
| 91 |
+
* U+002A ASTERISK (`*`), U+002B PLUS SIGN (`+`), U+002D DASH (`-`), U+002F
|
| 92 |
+
* SLASH (`/`), U+003D EQUALS TO (`=`), U+003F QUESTION MARK (`?`), U+005E
|
| 93 |
+
* CARET (`^`) to U+0060 GRAVE ACCENT (`` ` ``), or U+007B LEFT CURLY BRACE
|
| 94 |
+
* (`{`) to U+007E TILDE (`~`).
|
| 95 |
+
*
|
| 96 |
+
* See:
|
| 97 |
+
* **\[RFC5322]**:
|
| 98 |
+
* [Internet Message Format](https://tools.ietf.org/html/rfc5322).
|
| 99 |
+
* P. Resnick.
|
| 100 |
+
* IETF.
|
| 101 |
+
*
|
| 102 |
+
* @param code
|
| 103 |
+
* Code.
|
| 104 |
+
* @returns {boolean}
|
| 105 |
+
* Whether it matches.
|
| 106 |
+
*/
|
| 107 |
+
export const asciiAtext: (code: Code) => boolean;
|
| 108 |
+
/**
|
| 109 |
+
* Check whether the character code represents an ASCII digit (`0` through `9`).
|
| 110 |
+
*
|
| 111 |
+
* An **ASCII digit** is a character in the inclusive range U+0030 (`0`) to
|
| 112 |
+
* U+0039 (`9`).
|
| 113 |
+
*
|
| 114 |
+
* @param code
|
| 115 |
+
* Code.
|
| 116 |
+
* @returns {boolean}
|
| 117 |
+
* Whether it matches.
|
| 118 |
+
*/
|
| 119 |
+
export const asciiDigit: (code: Code) => boolean;
|
| 120 |
+
/**
|
| 121 |
+
* Check whether the character code represents an ASCII hex digit (`a` through
|
| 122 |
+
* `f`, case insensitive, or `0` through `9`).
|
| 123 |
+
*
|
| 124 |
+
* An **ASCII hex digit** is an ASCII digit (see `asciiDigit`), ASCII upper hex
|
| 125 |
+
* digit, or an ASCII lower hex digit.
|
| 126 |
+
*
|
| 127 |
+
* An **ASCII upper hex digit** is a character in the inclusive range U+0041
|
| 128 |
+
* (`A`) to U+0046 (`F`).
|
| 129 |
+
*
|
| 130 |
+
* An **ASCII lower hex digit** is a character in the inclusive range U+0061
|
| 131 |
+
* (`a`) to U+0066 (`f`).
|
| 132 |
+
*
|
| 133 |
+
* @param code
|
| 134 |
+
* Code.
|
| 135 |
+
* @returns {boolean}
|
| 136 |
+
* Whether it matches.
|
| 137 |
+
*/
|
| 138 |
+
export const asciiHexDigit: (code: Code) => boolean;
|
| 139 |
+
/**
|
| 140 |
+
* Check whether the character code represents ASCII punctuation.
|
| 141 |
+
*
|
| 142 |
+
* An **ASCII punctuation** is a character in the inclusive ranges U+0021
|
| 143 |
+
* EXCLAMATION MARK (`!`) to U+002F SLASH (`/`), U+003A COLON (`:`) to U+0040 AT
|
| 144 |
+
* SIGN (`@`), U+005B LEFT SQUARE BRACKET (`[`) to U+0060 GRAVE ACCENT
|
| 145 |
+
* (`` ` ``), or U+007B LEFT CURLY BRACE (`{`) to U+007E TILDE (`~`).
|
| 146 |
+
*
|
| 147 |
+
* @param code
|
| 148 |
+
* Code.
|
| 149 |
+
* @returns {boolean}
|
| 150 |
+
* Whether it matches.
|
| 151 |
+
*/
|
| 152 |
+
export const asciiPunctuation: (code: Code) => boolean;
|
| 153 |
+
/**
|
| 154 |
+
* Check whether the character code represents Unicode punctuation.
|
| 155 |
+
*
|
| 156 |
+
* A **Unicode punctuation** is a character in the Unicode `Pc` (Punctuation,
|
| 157 |
+
* Connector), `Pd` (Punctuation, Dash), `Pe` (Punctuation, Close), `Pf`
|
| 158 |
+
* (Punctuation, Final quote), `Pi` (Punctuation, Initial quote), `Po`
|
| 159 |
+
* (Punctuation, Other), or `Ps` (Punctuation, Open) categories, or an ASCII
|
| 160 |
+
* punctuation (see `asciiPunctuation`).
|
| 161 |
+
*
|
| 162 |
+
* See:
|
| 163 |
+
* **\[UNICODE]**:
|
| 164 |
+
* [The Unicode Standard](https://www.unicode.org/versions/).
|
| 165 |
+
* Unicode Consortium.
|
| 166 |
+
*
|
| 167 |
+
* @param code
|
| 168 |
+
* Code.
|
| 169 |
+
* @returns
|
| 170 |
+
* Whether it matches.
|
| 171 |
+
*/
|
| 172 |
+
export const unicodePunctuation: (code: Code) => boolean;
|
| 173 |
+
/**
|
| 174 |
+
* Check whether the character code represents Unicode whitespace.
|
| 175 |
+
*
|
| 176 |
+
* Note that this does handle micromark specific markdown whitespace characters.
|
| 177 |
+
* See `markdownLineEndingOrSpace` to check that.
|
| 178 |
+
*
|
| 179 |
+
* A **Unicode whitespace** is a character in the Unicode `Zs` (Separator,
|
| 180 |
+
* Space) category, or U+0009 CHARACTER TABULATION (HT), U+000A LINE FEED (LF),
|
| 181 |
+
* U+000C (FF), or U+000D CARRIAGE RETURN (CR) (**\[UNICODE]**).
|
| 182 |
+
*
|
| 183 |
+
* See:
|
| 184 |
+
* **\[UNICODE]**:
|
| 185 |
+
* [The Unicode Standard](https://www.unicode.org/versions/).
|
| 186 |
+
* Unicode Consortium.
|
| 187 |
+
*
|
| 188 |
+
* @param code
|
| 189 |
+
* Code.
|
| 190 |
+
* @returns
|
| 191 |
+
* Whether it matches.
|
| 192 |
+
*/
|
| 193 |
+
export const unicodeWhitespace: (code: Code) => boolean;
|
| 194 |
+
import type { Code } from 'micromark-util-types';
|
| 195 |
+
//# sourceMappingURL=index.d.ts.map
|
node_modules/micromark-util-character/dev/index.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":"AA8DA;;;;;;;;;;GAUG;AACH,mCALW,IAAI,GAEF,OAAO,CASnB;AAkDD;;;;;;;;;;;;;;GAcG;AACH,yCALW,IAAI,GAEF,OAAO,CAKnB;AAED;;;;;;;;GAQG;AACH,gDALW,IAAI,GAEF,OAAO,CAKnB;AAED;;;;;;;;;;;;;;GAcG;AACH,oCALW,IAAI,GAEF,OAAO,CASnB;AAhLD;;;;;;;;;;;;;;;;GAgBG;AACH,gCAmNoB,IAAI,KAAK,OAAO,CAnNY;AAEhD;;;;;;;;;;;GAWG;AACH,uCAqMoB,IAAI,KAAK,OAAO,CArMqB;AAEzD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,gCA8KoB,IAAI,KAAK,OAAO,CA9KuB;AAqB3D;;;;;;;;;;GAUG;AACH,gCA8IoB,IAAI,KAAK,OAAO,CA9IM;AAE1C;;;;;;;;;;;;;;;;;GAiBG;AACH,mCA0HoB,IAAI,KAAK,OAAO,CA1HiB;AAErD;;;;;;;;;;;;GAYG;AACH,sCA2GoB,IAAI,KAAK,OAAO,CA3GwB;AA2D5D;;;;;;;;;;;;;;;;;;GAkBG;AACH,wCA6BoB,IAAI,KAAK,OAAO,CA7BwB;AAE5D;;;;;;;;;;;;;;;;;;;GAmBG;AACH,uCAOoB,IAAI,KAAK,OAAO,CAPa;0BAlO1B,sBAAsB"}
|
node_modules/micromark-util-character/dev/index.js
ADDED
|
@@ -0,0 +1,252 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* @import {Code} from 'micromark-util-types'
|
| 3 |
+
*/
|
| 4 |
+
|
| 5 |
+
import {codes} from 'micromark-util-symbol'
|
| 6 |
+
|
| 7 |
+
/**
|
| 8 |
+
* Check whether the character code represents an ASCII alpha (`a` through `z`,
|
| 9 |
+
* case insensitive).
|
| 10 |
+
*
|
| 11 |
+
* An **ASCII alpha** is an ASCII upper alpha or ASCII lower alpha.
|
| 12 |
+
*
|
| 13 |
+
* An **ASCII upper alpha** is a character in the inclusive range U+0041 (`A`)
|
| 14 |
+
* to U+005A (`Z`).
|
| 15 |
+
*
|
| 16 |
+
* An **ASCII lower alpha** is a character in the inclusive range U+0061 (`a`)
|
| 17 |
+
* to U+007A (`z`).
|
| 18 |
+
*
|
| 19 |
+
* @param code
|
| 20 |
+
* Code.
|
| 21 |
+
* @returns {boolean}
|
| 22 |
+
* Whether it matches.
|
| 23 |
+
*/
|
| 24 |
+
export const asciiAlpha = regexCheck(/[A-Za-z]/)
|
| 25 |
+
|
| 26 |
+
/**
|
| 27 |
+
* Check whether the character code represents an ASCII alphanumeric (`a`
|
| 28 |
+
* through `z`, case insensitive, or `0` through `9`).
|
| 29 |
+
*
|
| 30 |
+
* An **ASCII alphanumeric** is an ASCII digit (see `asciiDigit`) or ASCII alpha
|
| 31 |
+
* (see `asciiAlpha`).
|
| 32 |
+
*
|
| 33 |
+
* @param code
|
| 34 |
+
* Code.
|
| 35 |
+
* @returns {boolean}
|
| 36 |
+
* Whether it matches.
|
| 37 |
+
*/
|
| 38 |
+
export const asciiAlphanumeric = regexCheck(/[\dA-Za-z]/)
|
| 39 |
+
|
| 40 |
+
/**
|
| 41 |
+
* Check whether the character code represents an ASCII atext.
|
| 42 |
+
*
|
| 43 |
+
* atext is an ASCII alphanumeric (see `asciiAlphanumeric`), or a character in
|
| 44 |
+
* the inclusive ranges U+0023 NUMBER SIGN (`#`) to U+0027 APOSTROPHE (`'`),
|
| 45 |
+
* U+002A ASTERISK (`*`), U+002B PLUS SIGN (`+`), U+002D DASH (`-`), U+002F
|
| 46 |
+
* SLASH (`/`), U+003D EQUALS TO (`=`), U+003F QUESTION MARK (`?`), U+005E
|
| 47 |
+
* CARET (`^`) to U+0060 GRAVE ACCENT (`` ` ``), or U+007B LEFT CURLY BRACE
|
| 48 |
+
* (`{`) to U+007E TILDE (`~`).
|
| 49 |
+
*
|
| 50 |
+
* See:
|
| 51 |
+
* **\[RFC5322]**:
|
| 52 |
+
* [Internet Message Format](https://tools.ietf.org/html/rfc5322).
|
| 53 |
+
* P. Resnick.
|
| 54 |
+
* IETF.
|
| 55 |
+
*
|
| 56 |
+
* @param code
|
| 57 |
+
* Code.
|
| 58 |
+
* @returns {boolean}
|
| 59 |
+
* Whether it matches.
|
| 60 |
+
*/
|
| 61 |
+
export const asciiAtext = regexCheck(/[#-'*+\--9=?A-Z^-~]/)
|
| 62 |
+
|
| 63 |
+
/**
|
| 64 |
+
* Check whether a character code is an ASCII control character.
|
| 65 |
+
*
|
| 66 |
+
* An **ASCII control** is a character in the inclusive range U+0000 NULL (NUL)
|
| 67 |
+
* to U+001F (US), or U+007F (DEL).
|
| 68 |
+
*
|
| 69 |
+
* @param {Code} code
|
| 70 |
+
* Code.
|
| 71 |
+
* @returns {boolean}
|
| 72 |
+
* Whether it matches.
|
| 73 |
+
*/
|
| 74 |
+
export function asciiControl(code) {
|
| 75 |
+
return (
|
| 76 |
+
// Special whitespace codes (which have negative values), C0 and Control
|
| 77 |
+
// character DEL
|
| 78 |
+
code !== null && (code < codes.space || code === codes.del)
|
| 79 |
+
)
|
| 80 |
+
}
|
| 81 |
+
|
| 82 |
+
/**
|
| 83 |
+
* Check whether the character code represents an ASCII digit (`0` through `9`).
|
| 84 |
+
*
|
| 85 |
+
* An **ASCII digit** is a character in the inclusive range U+0030 (`0`) to
|
| 86 |
+
* U+0039 (`9`).
|
| 87 |
+
*
|
| 88 |
+
* @param code
|
| 89 |
+
* Code.
|
| 90 |
+
* @returns {boolean}
|
| 91 |
+
* Whether it matches.
|
| 92 |
+
*/
|
| 93 |
+
export const asciiDigit = regexCheck(/\d/)
|
| 94 |
+
|
| 95 |
+
/**
|
| 96 |
+
* Check whether the character code represents an ASCII hex digit (`a` through
|
| 97 |
+
* `f`, case insensitive, or `0` through `9`).
|
| 98 |
+
*
|
| 99 |
+
* An **ASCII hex digit** is an ASCII digit (see `asciiDigit`), ASCII upper hex
|
| 100 |
+
* digit, or an ASCII lower hex digit.
|
| 101 |
+
*
|
| 102 |
+
* An **ASCII upper hex digit** is a character in the inclusive range U+0041
|
| 103 |
+
* (`A`) to U+0046 (`F`).
|
| 104 |
+
*
|
| 105 |
+
* An **ASCII lower hex digit** is a character in the inclusive range U+0061
|
| 106 |
+
* (`a`) to U+0066 (`f`).
|
| 107 |
+
*
|
| 108 |
+
* @param code
|
| 109 |
+
* Code.
|
| 110 |
+
* @returns {boolean}
|
| 111 |
+
* Whether it matches.
|
| 112 |
+
*/
|
| 113 |
+
export const asciiHexDigit = regexCheck(/[\dA-Fa-f]/)
|
| 114 |
+
|
| 115 |
+
/**
|
| 116 |
+
* Check whether the character code represents ASCII punctuation.
|
| 117 |
+
*
|
| 118 |
+
* An **ASCII punctuation** is a character in the inclusive ranges U+0021
|
| 119 |
+
* EXCLAMATION MARK (`!`) to U+002F SLASH (`/`), U+003A COLON (`:`) to U+0040 AT
|
| 120 |
+
* SIGN (`@`), U+005B LEFT SQUARE BRACKET (`[`) to U+0060 GRAVE ACCENT
|
| 121 |
+
* (`` ` ``), or U+007B LEFT CURLY BRACE (`{`) to U+007E TILDE (`~`).
|
| 122 |
+
*
|
| 123 |
+
* @param code
|
| 124 |
+
* Code.
|
| 125 |
+
* @returns {boolean}
|
| 126 |
+
* Whether it matches.
|
| 127 |
+
*/
|
| 128 |
+
export const asciiPunctuation = regexCheck(/[!-/:-@[-`{-~]/)
|
| 129 |
+
|
| 130 |
+
/**
|
| 131 |
+
* Check whether a character code is a markdown line ending.
|
| 132 |
+
*
|
| 133 |
+
* A **markdown line ending** is the virtual characters M-0003 CARRIAGE RETURN
|
| 134 |
+
* LINE FEED (CRLF), M-0004 LINE FEED (LF) and M-0005 CARRIAGE RETURN (CR).
|
| 135 |
+
*
|
| 136 |
+
* In micromark, the actual character U+000A LINE FEED (LF) and U+000D CARRIAGE
|
| 137 |
+
* RETURN (CR) are replaced by these virtual characters depending on whether
|
| 138 |
+
* they occurred together.
|
| 139 |
+
*
|
| 140 |
+
* @param {Code} code
|
| 141 |
+
* Code.
|
| 142 |
+
* @returns {boolean}
|
| 143 |
+
* Whether it matches.
|
| 144 |
+
*/
|
| 145 |
+
export function markdownLineEnding(code) {
|
| 146 |
+
return code !== null && code < codes.horizontalTab
|
| 147 |
+
}
|
| 148 |
+
|
| 149 |
+
/**
|
| 150 |
+
* Check whether a character code is a markdown line ending (see
|
| 151 |
+
* `markdownLineEnding`) or markdown space (see `markdownSpace`).
|
| 152 |
+
*
|
| 153 |
+
* @param {Code} code
|
| 154 |
+
* Code.
|
| 155 |
+
* @returns {boolean}
|
| 156 |
+
* Whether it matches.
|
| 157 |
+
*/
|
| 158 |
+
export function markdownLineEndingOrSpace(code) {
|
| 159 |
+
return code !== null && (code < codes.nul || code === codes.space)
|
| 160 |
+
}
|
| 161 |
+
|
| 162 |
+
/**
|
| 163 |
+
* Check whether a character code is a markdown space.
|
| 164 |
+
*
|
| 165 |
+
* A **markdown space** is the concrete character U+0020 SPACE (SP) and the
|
| 166 |
+
* virtual characters M-0001 VIRTUAL SPACE (VS) and M-0002 HORIZONTAL TAB (HT).
|
| 167 |
+
*
|
| 168 |
+
* In micromark, the actual character U+0009 CHARACTER TABULATION (HT) is
|
| 169 |
+
* replaced by one M-0002 HORIZONTAL TAB (HT) and between 0 and 3 M-0001 VIRTUAL
|
| 170 |
+
* SPACE (VS) characters, depending on the column at which the tab occurred.
|
| 171 |
+
*
|
| 172 |
+
* @param {Code} code
|
| 173 |
+
* Code.
|
| 174 |
+
* @returns {boolean}
|
| 175 |
+
* Whether it matches.
|
| 176 |
+
*/
|
| 177 |
+
export function markdownSpace(code) {
|
| 178 |
+
return (
|
| 179 |
+
code === codes.horizontalTab ||
|
| 180 |
+
code === codes.virtualSpace ||
|
| 181 |
+
code === codes.space
|
| 182 |
+
)
|
| 183 |
+
}
|
| 184 |
+
|
| 185 |
+
// Size note: removing ASCII from the regex and using `asciiPunctuation` here
|
| 186 |
+
// In fact adds to the bundle size.
|
| 187 |
+
/**
|
| 188 |
+
* Check whether the character code represents Unicode punctuation.
|
| 189 |
+
*
|
| 190 |
+
* A **Unicode punctuation** is a character in the Unicode `Pc` (Punctuation,
|
| 191 |
+
* Connector), `Pd` (Punctuation, Dash), `Pe` (Punctuation, Close), `Pf`
|
| 192 |
+
* (Punctuation, Final quote), `Pi` (Punctuation, Initial quote), `Po`
|
| 193 |
+
* (Punctuation, Other), or `Ps` (Punctuation, Open) categories, or an ASCII
|
| 194 |
+
* punctuation (see `asciiPunctuation`).
|
| 195 |
+
*
|
| 196 |
+
* See:
|
| 197 |
+
* **\[UNICODE]**:
|
| 198 |
+
* [The Unicode Standard](https://www.unicode.org/versions/).
|
| 199 |
+
* Unicode Consortium.
|
| 200 |
+
*
|
| 201 |
+
* @param code
|
| 202 |
+
* Code.
|
| 203 |
+
* @returns
|
| 204 |
+
* Whether it matches.
|
| 205 |
+
*/
|
| 206 |
+
export const unicodePunctuation = regexCheck(/\p{P}|\p{S}/u)
|
| 207 |
+
|
| 208 |
+
/**
|
| 209 |
+
* Check whether the character code represents Unicode whitespace.
|
| 210 |
+
*
|
| 211 |
+
* Note that this does handle micromark specific markdown whitespace characters.
|
| 212 |
+
* See `markdownLineEndingOrSpace` to check that.
|
| 213 |
+
*
|
| 214 |
+
* A **Unicode whitespace** is a character in the Unicode `Zs` (Separator,
|
| 215 |
+
* Space) category, or U+0009 CHARACTER TABULATION (HT), U+000A LINE FEED (LF),
|
| 216 |
+
* U+000C (FF), or U+000D CARRIAGE RETURN (CR) (**\[UNICODE]**).
|
| 217 |
+
*
|
| 218 |
+
* See:
|
| 219 |
+
* **\[UNICODE]**:
|
| 220 |
+
* [The Unicode Standard](https://www.unicode.org/versions/).
|
| 221 |
+
* Unicode Consortium.
|
| 222 |
+
*
|
| 223 |
+
* @param code
|
| 224 |
+
* Code.
|
| 225 |
+
* @returns
|
| 226 |
+
* Whether it matches.
|
| 227 |
+
*/
|
| 228 |
+
export const unicodeWhitespace = regexCheck(/\s/)
|
| 229 |
+
|
| 230 |
+
/**
|
| 231 |
+
* Create a code check from a regex.
|
| 232 |
+
*
|
| 233 |
+
* @param {RegExp} regex
|
| 234 |
+
* Expression.
|
| 235 |
+
* @returns {(code: Code) => boolean}
|
| 236 |
+
* Check.
|
| 237 |
+
*/
|
| 238 |
+
function regexCheck(regex) {
|
| 239 |
+
return check
|
| 240 |
+
|
| 241 |
+
/**
|
| 242 |
+
* Check whether a code matches the bound regex.
|
| 243 |
+
*
|
| 244 |
+
* @param {Code} code
|
| 245 |
+
* Character code.
|
| 246 |
+
* @returns {boolean}
|
| 247 |
+
* Whether the character code matches the bound regex.
|
| 248 |
+
*/
|
| 249 |
+
function check(code) {
|
| 250 |
+
return code !== null && code > -1 && regex.test(String.fromCharCode(code))
|
| 251 |
+
}
|
| 252 |
+
}
|