@tinta-lang/syntax 0.0.0-stage → 0.1.0-dev.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/THIRD_PARTY_NOTICES.txt +13651 -0
- package/dist/directive.d.ts +40 -0
- package/dist/editing.d.ts +46 -0
- package/dist/enrichment.d.ts +5 -0
- package/dist/expression.d.ts +26 -0
- package/dist/image-destinations.d.ts +3 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +10118 -0
- package/dist/parser.d.ts +40 -0
- package/dist/registry.d.ts +144 -0
- package/dist/source.d.ts +28 -0
- package/package.json +280 -3
- package/parser-provenance.json +1419 -0
- package/patches/README.md +5 -0
- package/patches/micromark.patch +84 -0
- package/vendor/@noble/hashes/LICENSE +21 -0
- package/vendor/@noble/hashes/_md.js +209 -0
- package/vendor/@noble/hashes/_u64.js +77 -0
- package/vendor/@noble/hashes/package.json +91 -0
- package/vendor/@noble/hashes/sha2.js +446 -0
- package/vendor/@noble/hashes/utils.js +687 -0
- package/vendor/character-entities/index.js +2132 -0
- package/vendor/character-entities/license +22 -0
- package/vendor/character-entities/package.json +78 -0
- package/vendor/decode-named-character-reference/index.js +19 -0
- package/vendor/decode-named-character-reference/license +22 -0
- package/vendor/decode-named-character-reference/package.json +90 -0
- package/vendor/devlop/lib/default.js +9 -0
- package/vendor/devlop/license +22 -0
- package/vendor/devlop/package.json +80 -0
- package/vendor/longest-streak/index.js +36 -0
- package/vendor/longest-streak/license +22 -0
- package/vendor/longest-streak/package.json +73 -0
- package/vendor/markdown-table/index.js +393 -0
- package/vendor/markdown-table/license +22 -0
- package/vendor/markdown-table/package.json +77 -0
- package/vendor/mdast-util-from-markdown/index.js +2 -0
- package/vendor/mdast-util-from-markdown/lib/index.js +1270 -0
- package/vendor/mdast-util-from-markdown/license +22 -0
- package/vendor/mdast-util-from-markdown/package.json +98 -0
- package/vendor/mdast-util-gfm-strikethrough/index.js +5 -0
- package/vendor/mdast-util-gfm-strikethrough/lib/index.js +133 -0
- package/vendor/mdast-util-gfm-strikethrough/license +22 -0
- package/vendor/mdast-util-gfm-strikethrough/package.json +84 -0
- package/vendor/mdast-util-gfm-table/index.js +2 -0
- package/vendor/mdast-util-gfm-table/lib/index.js +300 -0
- package/vendor/mdast-util-gfm-table/license +22 -0
- package/vendor/mdast-util-gfm-table/package.json +101 -0
- package/vendor/mdast-util-gfm-task-list-item/index.js +4 -0
- package/vendor/mdast-util-gfm-task-list-item/lib/index.js +141 -0
- package/vendor/mdast-util-gfm-task-list-item/license +22 -0
- package/vendor/mdast-util-gfm-task-list-item/package.json +90 -0
- package/vendor/mdast-util-phrasing/index.js +1 -0
- package/vendor/mdast-util-phrasing/lib/index.js +45 -0
- package/vendor/mdast-util-phrasing/license +23 -0
- package/vendor/mdast-util-phrasing/package.json +78 -0
- package/vendor/mdast-util-to-markdown/index.js +3 -0
- package/vendor/mdast-util-to-markdown/lib/configure.js +98 -0
- package/vendor/mdast-util-to-markdown/lib/handle/blockquote.js +40 -0
- package/vendor/mdast-util-to-markdown/lib/handle/break.js +41 -0
- package/vendor/mdast-util-to-markdown/lib/handle/code.js +86 -0
- package/vendor/mdast-util-to-markdown/lib/handle/definition.js +83 -0
- package/vendor/mdast-util-to-markdown/lib/handle/emphasis.js +67 -0
- package/vendor/mdast-util-to-markdown/lib/handle/heading.js +84 -0
- package/vendor/mdast-util-to-markdown/lib/handle/html.js +27 -0
- package/vendor/mdast-util-to-markdown/lib/handle/image-reference.js +78 -0
- package/vendor/mdast-util-to-markdown/lib/handle/image.js +92 -0
- package/vendor/mdast-util-to-markdown/lib/handle/index.js +45 -0
- package/vendor/mdast-util-to-markdown/lib/handle/inline-code.js +86 -0
- package/vendor/mdast-util-to-markdown/lib/handle/link-reference.js +78 -0
- package/vendor/mdast-util-to-markdown/lib/handle/link.js +129 -0
- package/vendor/mdast-util-to-markdown/lib/handle/list-item.js +73 -0
- package/vendor/mdast-util-to-markdown/lib/handle/list.js +107 -0
- package/vendor/mdast-util-to-markdown/lib/handle/paragraph.js +27 -0
- package/vendor/mdast-util-to-markdown/lib/handle/root.js +34 -0
- package/vendor/mdast-util-to-markdown/lib/handle/strong.js +67 -0
- package/vendor/mdast-util-to-markdown/lib/handle/text.js +30 -0
- package/vendor/mdast-util-to-markdown/lib/handle/thematic-break.js +27 -0
- package/vendor/mdast-util-to-markdown/lib/index.js +213 -0
- package/vendor/mdast-util-to-markdown/lib/join.js +56 -0
- package/vendor/mdast-util-to-markdown/lib/unsafe.js +160 -0
- package/vendor/mdast-util-to-markdown/lib/util/association.js +33 -0
- package/vendor/mdast-util-to-markdown/lib/util/character.js +32 -0
- package/vendor/mdast-util-to-markdown/lib/util/check-bullet-ordered.js +25 -0
- package/vendor/mdast-util-to-markdown/lib/util/check-bullet-other.js +42 -0
- package/vendor/mdast-util-to-markdown/lib/util/check-bullet.js +25 -0
- package/vendor/mdast-util-to-markdown/lib/util/check-emphasis.js +25 -0
- package/vendor/mdast-util-to-markdown/lib/util/check-fence.js +25 -0
- package/vendor/mdast-util-to-markdown/lib/util/check-list-item-indent.js +25 -0
- package/vendor/mdast-util-to-markdown/lib/util/check-quote.js +25 -0
- package/vendor/mdast-util-to-markdown/lib/util/check-rule-repetition.js +25 -0
- package/vendor/mdast-util-to-markdown/lib/util/check-rule.js +25 -0
- package/vendor/mdast-util-to-markdown/lib/util/check-strong.js +25 -0
- package/vendor/mdast-util-to-markdown/lib/util/compile-pattern.js +30 -0
- package/vendor/mdast-util-to-markdown/lib/util/container-flow.js +93 -0
- package/vendor/mdast-util-to-markdown/lib/util/container-phrasing.js +704 -0
- package/vendor/mdast-util-to-markdown/lib/util/encode-character-reference.js +11 -0
- package/vendor/mdast-util-to-markdown/lib/util/encode-info.js +82 -0
- package/vendor/mdast-util-to-markdown/lib/util/format-code-as-indented.js +27 -0
- package/vendor/mdast-util-to-markdown/lib/util/format-heading-as-setext.js +39 -0
- package/vendor/mdast-util-to-markdown/lib/util/format-link-as-autolink.js +39 -0
- package/vendor/mdast-util-to-markdown/lib/util/html-kind.js +63 -0
- package/vendor/mdast-util-to-markdown/lib/util/indent-lines.js +40 -0
- package/vendor/mdast-util-to-markdown/lib/util/pattern-in-scope.js +52 -0
- package/vendor/mdast-util-to-markdown/lib/util/safe.js +263 -0
- package/vendor/mdast-util-to-markdown/lib/util/track.js +55 -0
- package/vendor/mdast-util-to-markdown/license +22 -0
- package/vendor/mdast-util-to-markdown/package.json +88 -0
- package/vendor/mdast-util-to-string/index.js +5 -0
- package/vendor/mdast-util-to-string/lib/index.js +108 -0
- package/vendor/mdast-util-to-string/license +22 -0
- package/vendor/mdast-util-to-string/package.json +78 -0
- package/vendor/micromark/index.js +60 -0
- package/vendor/micromark/lib/compile.js +1068 -0
- package/vendor/micromark/lib/constructs.js +85 -0
- package/vendor/micromark/lib/create-tokenizer.js +615 -0
- package/vendor/micromark/lib/initialize/content.js +79 -0
- package/vendor/micromark/lib/initialize/document.js +370 -0
- package/vendor/micromark/lib/initialize/flow.js +58 -0
- package/vendor/micromark/lib/initialize/text.js +216 -0
- package/vendor/micromark/lib/parse.js +56 -0
- package/vendor/micromark/lib/postprocess.js +18 -0
- package/vendor/micromark/lib/preprocess.js +112 -0
- package/vendor/micromark/license +22 -0
- package/vendor/micromark/package.json +87 -0
- package/vendor/micromark-core-commonmark/index.js +22 -0
- package/vendor/micromark-core-commonmark/lib/attention.js +231 -0
- package/vendor/micromark-core-commonmark/lib/autolink.js +233 -0
- package/vendor/micromark-core-commonmark/lib/blank-line.js +61 -0
- package/vendor/micromark-core-commonmark/lib/block-quote.js +143 -0
- package/vendor/micromark-core-commonmark/lib/character-escape.js +64 -0
- package/vendor/micromark-core-commonmark/lib/character-reference.js +149 -0
- package/vendor/micromark-core-commonmark/lib/code-fenced.js +422 -0
- package/vendor/micromark-core-commonmark/lib/code-indented.js +159 -0
- package/vendor/micromark-core-commonmark/lib/code-text.js +225 -0
- package/vendor/micromark-core-commonmark/lib/content.js +163 -0
- package/vendor/micromark-core-commonmark/lib/definition.js +254 -0
- package/vendor/micromark-core-commonmark/lib/hard-break-escape.js +60 -0
- package/vendor/micromark-core-commonmark/lib/heading-atx.js +191 -0
- package/vendor/micromark-core-commonmark/lib/html-flow.js +827 -0
- package/vendor/micromark-core-commonmark/lib/html-text.js +678 -0
- package/vendor/micromark-core-commonmark/lib/label-end.js +561 -0
- package/vendor/micromark-core-commonmark/lib/label-start-image.js +110 -0
- package/vendor/micromark-core-commonmark/lib/label-start-link.js +63 -0
- package/vendor/micromark-core-commonmark/lib/line-ending.js +33 -0
- package/vendor/micromark-core-commonmark/lib/list.js +213 -0
- package/vendor/micromark-core-commonmark/lib/partial-non-lazy-continuation.js +61 -0
- package/vendor/micromark-core-commonmark/lib/setext-underline.js +187 -0
- package/vendor/micromark-core-commonmark/lib/thematic-break.js +102 -0
- package/vendor/micromark-core-commonmark/license +22 -0
- package/vendor/micromark-core-commonmark/package.json +62 -0
- package/vendor/micromark-extension-gfm-strikethrough/index.js +3 -0
- package/vendor/micromark-extension-gfm-strikethrough/lib/html.js +26 -0
- package/vendor/micromark-extension-gfm-strikethrough/lib/syntax.js +142 -0
- package/vendor/micromark-extension-gfm-strikethrough/license +22 -0
- package/vendor/micromark-extension-gfm-strikethrough/package.json +129 -0
- package/vendor/micromark-extension-gfm-table/index.js +2 -0
- package/vendor/micromark-extension-gfm-table/lib/edit-map.js +222 -0
- package/vendor/micromark-extension-gfm-table/lib/html.js +135 -0
- package/vendor/micromark-extension-gfm-table/lib/infer.js +52 -0
- package/vendor/micromark-extension-gfm-table/lib/syntax.js +846 -0
- package/vendor/micromark-extension-gfm-table/license +22 -0
- package/vendor/micromark-extension-gfm-table/package.json +86 -0
- package/vendor/micromark-extension-gfm-task-list-item/index.js +2 -0
- package/vendor/micromark-extension-gfm-task-list-item/lib/html.js +29 -0
- package/vendor/micromark-extension-gfm-task-list-item/lib/syntax.js +158 -0
- package/vendor/micromark-extension-gfm-task-list-item/license +22 -0
- package/vendor/micromark-extension-gfm-task-list-item/package.json +131 -0
- package/vendor/micromark-factory-destination/index.js +206 -0
- package/vendor/micromark-factory-destination/license +22 -0
- package/vendor/micromark-factory-destination/package.json +57 -0
- package/vendor/micromark-factory-label/index.js +148 -0
- package/vendor/micromark-factory-label/license +22 -0
- package/vendor/micromark-factory-label/package.json +60 -0
- package/vendor/micromark-factory-space/index.js +116 -0
- package/vendor/micromark-factory-space/license +22 -0
- package/vendor/micromark-factory-space/package.json +46 -0
- package/vendor/micromark-factory-title/index.js +158 -0
- package/vendor/micromark-factory-title/license +22 -0
- package/vendor/micromark-factory-title/package.json +58 -0
- package/vendor/micromark-factory-whitespace/index.js +44 -0
- package/vendor/micromark-factory-whitespace/license +22 -0
- package/vendor/micromark-factory-whitespace/package.json +57 -0
- package/vendor/micromark-util-character/index.js +246 -0
- package/vendor/micromark-util-character/license +22 -0
- package/vendor/micromark-util-character/package.json +57 -0
- package/vendor/micromark-util-chunked/index.js +81 -0
- package/vendor/micromark-util-chunked/license +22 -0
- package/vendor/micromark-util-chunked/package.json +57 -0
- package/vendor/micromark-util-classify-character/index.js +27 -0
- package/vendor/micromark-util-classify-character/license +22 -0
- package/vendor/micromark-util-classify-character/package.json +59 -0
- package/vendor/micromark-util-combine-extensions/index.js +143 -0
- package/vendor/micromark-util-combine-extensions/license +22 -0
- package/vendor/micromark-util-combine-extensions/package.json +52 -0
- package/vendor/micromark-util-decode-numeric-character-reference/index.js +32 -0
- package/vendor/micromark-util-decode-numeric-character-reference/license +22 -0
- package/vendor/micromark-util-decode-numeric-character-reference/package.json +59 -0
- package/vendor/micromark-util-decode-string/index.js +45 -0
- package/vendor/micromark-util-decode-string/license +22 -0
- package/vendor/micromark-util-decode-string/package.json +63 -0
- package/vendor/micromark-util-edit-map/index.js +225 -0
- package/vendor/micromark-util-edit-map/license +22 -0
- package/vendor/micromark-util-edit-map/package.json +48 -0
- package/vendor/micromark-util-encode/index.js +33 -0
- package/vendor/micromark-util-encode/license +22 -0
- package/vendor/micromark-util-encode/package.json +47 -0
- package/vendor/micromark-util-html-tag-name/index.js +93 -0
- package/vendor/micromark-util-html-tag-name/license +22 -0
- package/vendor/micromark-util-html-tag-name/package.json +47 -0
- package/vendor/micromark-util-normalize-identifier/index.js +33 -0
- package/vendor/micromark-util-normalize-identifier/license +22 -0
- package/vendor/micromark-util-normalize-identifier/package.json +58 -0
- package/vendor/micromark-util-resolve-all/index.js +32 -0
- package/vendor/micromark-util-resolve-all/license +22 -0
- package/vendor/micromark-util-resolve-all/package.json +48 -0
- package/vendor/micromark-util-sanitize-uri/index.js +107 -0
- package/vendor/micromark-util-sanitize-uri/license +22 -0
- package/vendor/micromark-util-sanitize-uri/package.json +59 -0
- package/vendor/micromark-util-subtokenize/index.js +228 -0
- package/vendor/micromark-util-subtokenize/lib/splice-buffer.js +251 -0
- package/vendor/micromark-util-subtokenize/license +22 -0
- package/vendor/micromark-util-subtokenize/package.json +60 -0
- package/vendor/unist-util-is/index.js +7 -0
- package/vendor/unist-util-is/lib/index.js +296 -0
- package/vendor/unist-util-is/license +22 -0
- package/vendor/unist-util-is/package.json +103 -0
- package/vendor/unist-util-stringify-position/index.js +1 -0
- package/vendor/unist-util-stringify-position/lib/index.js +84 -0
- package/vendor/unist-util-stringify-position/license +22 -0
- package/vendor/unist-util-stringify-position/package.json +80 -0
- package/vendor/unist-util-visit/index.js +2 -0
- package/vendor/unist-util-visit/lib/index.js +312 -0
- package/vendor/unist-util-visit/license +22 -0
- package/vendor/unist-util-visit/package.json +108 -0
- package/vendor/unist-util-visit-parents/index.js +2 -0
- package/vendor/unist-util-visit-parents/lib/color.js +7 -0
- package/vendor/unist-util-visit-parents/lib/index.js +399 -0
- package/vendor/unist-util-visit-parents/license +22 -0
- package/vendor/unist-util-visit-parents/package.json +106 -0
- package/vendor/zwitch/index.js +118 -0
- package/vendor/zwitch/license +22 -0
- package/vendor/zwitch/package.json +72 -0
- package/README.md +0 -3
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @import {Code} from 'micromark-util-types'
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { markdownLineEndingOrSpace, unicodePunctuation, unicodeWhitespace } from 'micromark-util-character';
|
|
6
|
+
/**
|
|
7
|
+
* Classify whether a code represents whitespace, punctuation, or something
|
|
8
|
+
* else.
|
|
9
|
+
*
|
|
10
|
+
* Used for attention (emphasis, strong), whose sequences can open or close
|
|
11
|
+
* based on the class of surrounding characters.
|
|
12
|
+
*
|
|
13
|
+
* > 👉 **Note**: eof (`null`) is seen as whitespace.
|
|
14
|
+
*
|
|
15
|
+
* @param {Code} code
|
|
16
|
+
* Code.
|
|
17
|
+
* @returns {typeof constants.characterGroupWhitespace | typeof constants.characterGroupPunctuation | undefined}
|
|
18
|
+
* Group.
|
|
19
|
+
*/
|
|
20
|
+
export function classifyCharacter(code) {
|
|
21
|
+
if (code === null || markdownLineEndingOrSpace(code) || unicodeWhitespace(code)) {
|
|
22
|
+
return 1;
|
|
23
|
+
}
|
|
24
|
+
if (unicodePunctuation(code)) {
|
|
25
|
+
return 2;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -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.
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "micromark-util-classify-character",
|
|
3
|
+
"version": "2.0.1",
|
|
4
|
+
"description": "micromark utility to classify whether a character is whitespace or punctuation",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"micromark",
|
|
8
|
+
"util",
|
|
9
|
+
"utility",
|
|
10
|
+
"attention",
|
|
11
|
+
"classify",
|
|
12
|
+
"character"
|
|
13
|
+
],
|
|
14
|
+
"repository": "https://github.com/micromark/micromark/tree/main/packages/micromark-util-classify-character",
|
|
15
|
+
"bugs": "https://github.com/micromark/micromark/issues",
|
|
16
|
+
"funding": [
|
|
17
|
+
{
|
|
18
|
+
"type": "GitHub Sponsors",
|
|
19
|
+
"url": "https://github.com/sponsors/unifiedjs"
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
"type": "OpenCollective",
|
|
23
|
+
"url": "https://opencollective.com/unified"
|
|
24
|
+
}
|
|
25
|
+
],
|
|
26
|
+
"author": "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)",
|
|
27
|
+
"contributors": [
|
|
28
|
+
"Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)"
|
|
29
|
+
],
|
|
30
|
+
"sideEffects": false,
|
|
31
|
+
"type": "module",
|
|
32
|
+
"files": [
|
|
33
|
+
"dev/",
|
|
34
|
+
"index.d.ts.map",
|
|
35
|
+
"index.d.ts",
|
|
36
|
+
"index.js"
|
|
37
|
+
],
|
|
38
|
+
"exports": {
|
|
39
|
+
"development": "./dev/index.js",
|
|
40
|
+
"default": "./index.js"
|
|
41
|
+
},
|
|
42
|
+
"dependencies": {
|
|
43
|
+
"micromark-util-character": "^2.0.0",
|
|
44
|
+
"micromark-util-symbol": "^2.0.0",
|
|
45
|
+
"micromark-util-types": "^2.0.0"
|
|
46
|
+
},
|
|
47
|
+
"scripts": {
|
|
48
|
+
"build": "micromark-build"
|
|
49
|
+
},
|
|
50
|
+
"xo": {
|
|
51
|
+
"envs": [
|
|
52
|
+
"shared-node-browser"
|
|
53
|
+
],
|
|
54
|
+
"prettier": true,
|
|
55
|
+
"rules": {
|
|
56
|
+
"unicorn/prefer-code-point": "off"
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @import {
|
|
3
|
+
* Extension,
|
|
4
|
+
* Handles,
|
|
5
|
+
* HtmlExtension,
|
|
6
|
+
* NormalizedExtension
|
|
7
|
+
* } from 'micromark-util-types'
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import {splice} from 'micromark-util-chunked'
|
|
11
|
+
|
|
12
|
+
const hasOwnProperty = {}.hasOwnProperty
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Combine multiple syntax extensions into one.
|
|
16
|
+
*
|
|
17
|
+
* @param {ReadonlyArray<Extension>} extensions
|
|
18
|
+
* List of syntax extensions.
|
|
19
|
+
* @returns {NormalizedExtension}
|
|
20
|
+
* A single combined extension.
|
|
21
|
+
*/
|
|
22
|
+
export function combineExtensions(extensions) {
|
|
23
|
+
/** @type {NormalizedExtension} */
|
|
24
|
+
const all = {}
|
|
25
|
+
let index = -1
|
|
26
|
+
|
|
27
|
+
while (++index < extensions.length) {
|
|
28
|
+
syntaxExtension(all, extensions[index])
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
return all
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Merge `extension` into `all`.
|
|
36
|
+
*
|
|
37
|
+
* @param {NormalizedExtension} all
|
|
38
|
+
* Extension to merge into.
|
|
39
|
+
* @param {Extension} extension
|
|
40
|
+
* Extension to merge.
|
|
41
|
+
* @returns {undefined}
|
|
42
|
+
* Nothing.
|
|
43
|
+
*/
|
|
44
|
+
function syntaxExtension(all, extension) {
|
|
45
|
+
/** @type {keyof Extension} */
|
|
46
|
+
let hook
|
|
47
|
+
|
|
48
|
+
for (hook in extension) {
|
|
49
|
+
const maybe = hasOwnProperty.call(all, hook) ? all[hook] : undefined
|
|
50
|
+
/** @type {Record<string, unknown>} */
|
|
51
|
+
const left = maybe || (all[hook] = {})
|
|
52
|
+
/** @type {Record<string, unknown> | undefined} */
|
|
53
|
+
const right = extension[hook]
|
|
54
|
+
/** @type {string} */
|
|
55
|
+
let code
|
|
56
|
+
|
|
57
|
+
if (right) {
|
|
58
|
+
for (code in right) {
|
|
59
|
+
if (!hasOwnProperty.call(left, code)) left[code] = []
|
|
60
|
+
const value = right[code]
|
|
61
|
+
constructs(
|
|
62
|
+
// @ts-expect-error Looks like a list.
|
|
63
|
+
left[code],
|
|
64
|
+
Array.isArray(value) ? value : value ? [value] : []
|
|
65
|
+
)
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Merge `list` into `existing` (both lists of constructs).
|
|
73
|
+
* Mutates `existing`.
|
|
74
|
+
*
|
|
75
|
+
* @param {Array<unknown>} existing
|
|
76
|
+
* List of constructs to merge into.
|
|
77
|
+
* @param {Array<unknown>} list
|
|
78
|
+
* List of constructs to merge.
|
|
79
|
+
* @returns {undefined}
|
|
80
|
+
* Nothing.
|
|
81
|
+
*/
|
|
82
|
+
function constructs(existing, list) {
|
|
83
|
+
let index = -1
|
|
84
|
+
/** @type {Array<unknown>} */
|
|
85
|
+
const before = []
|
|
86
|
+
|
|
87
|
+
while (++index < list.length) {
|
|
88
|
+
// @ts-expect-error Looks like an object.
|
|
89
|
+
;(list[index].add === 'after' ? existing : before).push(list[index])
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
splice(existing, 0, 0, before)
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Combine multiple HTML extensions into one.
|
|
97
|
+
*
|
|
98
|
+
* @param {ReadonlyArray<HtmlExtension>} htmlExtensions
|
|
99
|
+
* List of HTML extensions.
|
|
100
|
+
* @returns {HtmlExtension}
|
|
101
|
+
* Single combined HTML extension.
|
|
102
|
+
*/
|
|
103
|
+
export function combineHtmlExtensions(htmlExtensions) {
|
|
104
|
+
/** @type {HtmlExtension} */
|
|
105
|
+
const handlers = {}
|
|
106
|
+
let index = -1
|
|
107
|
+
|
|
108
|
+
while (++index < htmlExtensions.length) {
|
|
109
|
+
htmlExtension(handlers, htmlExtensions[index])
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
return handlers
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Merge `extension` into `all`.
|
|
117
|
+
*
|
|
118
|
+
* @param {HtmlExtension} all
|
|
119
|
+
* Extension to merge into.
|
|
120
|
+
* @param {HtmlExtension} extension
|
|
121
|
+
* Extension to merge.
|
|
122
|
+
* @returns {undefined}
|
|
123
|
+
* Nothing.
|
|
124
|
+
*/
|
|
125
|
+
function htmlExtension(all, extension) {
|
|
126
|
+
/** @type {keyof HtmlExtension} */
|
|
127
|
+
let hook
|
|
128
|
+
|
|
129
|
+
for (hook in extension) {
|
|
130
|
+
const maybe = hasOwnProperty.call(all, hook) ? all[hook] : undefined
|
|
131
|
+
const left = maybe || (all[hook] = {})
|
|
132
|
+
const right = extension[hook]
|
|
133
|
+
/** @type {keyof Handles} */
|
|
134
|
+
let type
|
|
135
|
+
|
|
136
|
+
if (right) {
|
|
137
|
+
for (type in right) {
|
|
138
|
+
// @ts-expect-error assume document vs regular handler are managed correctly.
|
|
139
|
+
left[type] = right[type]
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
@@ -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.
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "micromark-util-combine-extensions",
|
|
3
|
+
"version": "2.0.1",
|
|
4
|
+
"description": "micromark utility to combine syntax or html extensions",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"micromark",
|
|
8
|
+
"util",
|
|
9
|
+
"utility",
|
|
10
|
+
"extension",
|
|
11
|
+
"combine",
|
|
12
|
+
"merge"
|
|
13
|
+
],
|
|
14
|
+
"repository": "https://github.com/micromark/micromark/tree/main/packages/micromark-util-combine-extensions",
|
|
15
|
+
"bugs": "https://github.com/micromark/micromark/issues",
|
|
16
|
+
"funding": [
|
|
17
|
+
{
|
|
18
|
+
"type": "GitHub Sponsors",
|
|
19
|
+
"url": "https://github.com/sponsors/unifiedjs"
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
"type": "OpenCollective",
|
|
23
|
+
"url": "https://opencollective.com/unified"
|
|
24
|
+
}
|
|
25
|
+
],
|
|
26
|
+
"author": "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)",
|
|
27
|
+
"contributors": [
|
|
28
|
+
"Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)"
|
|
29
|
+
],
|
|
30
|
+
"sideEffects": false,
|
|
31
|
+
"type": "module",
|
|
32
|
+
"files": [
|
|
33
|
+
"index.d.ts.map",
|
|
34
|
+
"index.d.ts",
|
|
35
|
+
"index.js"
|
|
36
|
+
],
|
|
37
|
+
"exports": "./index.js",
|
|
38
|
+
"dependencies": {
|
|
39
|
+
"micromark-util-chunked": "^2.0.0",
|
|
40
|
+
"micromark-util-types": "^2.0.0"
|
|
41
|
+
},
|
|
42
|
+
"xo": {
|
|
43
|
+
"envs": [
|
|
44
|
+
"shared-node-browser"
|
|
45
|
+
],
|
|
46
|
+
"prettier": true,
|
|
47
|
+
"rules": {
|
|
48
|
+
"guard-for-in": "off",
|
|
49
|
+
"unicorn/prefer-code-point": "off"
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Turn the number (in string form as either hexa- or plain decimal) coming from
|
|
3
|
+
* a numeric character reference into a character.
|
|
4
|
+
*
|
|
5
|
+
* Sort of like `String.fromCodePoint(Number.parseInt(value, base))`, but makes
|
|
6
|
+
* non-characters and control characters safe.
|
|
7
|
+
*
|
|
8
|
+
* @param {string} value
|
|
9
|
+
* Value to decode.
|
|
10
|
+
* @param {number} base
|
|
11
|
+
* Numeric base.
|
|
12
|
+
* @returns {string}
|
|
13
|
+
* Character.
|
|
14
|
+
*/
|
|
15
|
+
export function decodeNumericCharacterReference(value, base) {
|
|
16
|
+
const code = Number.parseInt(value, base);
|
|
17
|
+
if (
|
|
18
|
+
// C0 except for HT, LF, FF, CR, space.
|
|
19
|
+
code < 9 || code === 11 || code > 13 && code < 32 ||
|
|
20
|
+
// Control character (DEL) of C0, and C1 controls.
|
|
21
|
+
code > 126 && code < 160 ||
|
|
22
|
+
// Lone high surrogates and low surrogates.
|
|
23
|
+
code > 55_295 && code < 57_344 ||
|
|
24
|
+
// Noncharacters.
|
|
25
|
+
code > 64_975 && code < 65_008 || /* eslint-disable no-bitwise */
|
|
26
|
+
(code & 65_535) === 65_535 || (code & 65_535) === 65_534 || /* eslint-enable no-bitwise */
|
|
27
|
+
// Out of range
|
|
28
|
+
code > 1_114_111) {
|
|
29
|
+
return "\uFFFD";
|
|
30
|
+
}
|
|
31
|
+
return String.fromCodePoint(code);
|
|
32
|
+
}
|
|
@@ -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.
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "micromark-util-decode-numeric-character-reference",
|
|
3
|
+
"version": "2.0.2",
|
|
4
|
+
"description": "micromark utility to decode numeric character references",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"micromark",
|
|
8
|
+
"util",
|
|
9
|
+
"utility",
|
|
10
|
+
"decode",
|
|
11
|
+
"numeric",
|
|
12
|
+
"number",
|
|
13
|
+
"character",
|
|
14
|
+
"reference"
|
|
15
|
+
],
|
|
16
|
+
"repository": "https://github.com/micromark/micromark/tree/main/packages/micromark-util-decode-numeric-character-reference",
|
|
17
|
+
"bugs": "https://github.com/micromark/micromark/issues",
|
|
18
|
+
"funding": [
|
|
19
|
+
{
|
|
20
|
+
"type": "GitHub Sponsors",
|
|
21
|
+
"url": "https://github.com/sponsors/unifiedjs"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"type": "OpenCollective",
|
|
25
|
+
"url": "https://opencollective.com/unified"
|
|
26
|
+
}
|
|
27
|
+
],
|
|
28
|
+
"author": "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)",
|
|
29
|
+
"contributors": [
|
|
30
|
+
"Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)"
|
|
31
|
+
],
|
|
32
|
+
"sideEffects": false,
|
|
33
|
+
"type": "module",
|
|
34
|
+
"files": [
|
|
35
|
+
"dev/",
|
|
36
|
+
"index.d.ts.map",
|
|
37
|
+
"index.d.ts",
|
|
38
|
+
"index.js"
|
|
39
|
+
],
|
|
40
|
+
"exports": {
|
|
41
|
+
"development": "./dev/index.js",
|
|
42
|
+
"default": "./index.js"
|
|
43
|
+
},
|
|
44
|
+
"dependencies": {
|
|
45
|
+
"micromark-util-symbol": "^2.0.0"
|
|
46
|
+
},
|
|
47
|
+
"scripts": {
|
|
48
|
+
"build": "micromark-build"
|
|
49
|
+
},
|
|
50
|
+
"xo": {
|
|
51
|
+
"envs": [
|
|
52
|
+
"shared-node-browser"
|
|
53
|
+
],
|
|
54
|
+
"prettier": true,
|
|
55
|
+
"rules": {
|
|
56
|
+
"unicorn/prefer-code-point": "off"
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { decodeNamedCharacterReference } from 'decode-named-character-reference';
|
|
2
|
+
import { decodeNumericCharacterReference } from 'micromark-util-decode-numeric-character-reference';
|
|
3
|
+
const characterEscapeOrReference = /\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Decode markdown strings (which occur in places such as fenced code info
|
|
7
|
+
* strings, destinations, labels, and titles).
|
|
8
|
+
*
|
|
9
|
+
* The “string” content type allows character escapes and -references.
|
|
10
|
+
* This decodes those.
|
|
11
|
+
*
|
|
12
|
+
* @param {string} value
|
|
13
|
+
* Value to decode.
|
|
14
|
+
* @returns {string}
|
|
15
|
+
* Decoded value.
|
|
16
|
+
*/
|
|
17
|
+
export function decodeString(value) {
|
|
18
|
+
return value.replace(characterEscapeOrReference, decode);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* @param {string} $0
|
|
23
|
+
* Match.
|
|
24
|
+
* @param {string} $1
|
|
25
|
+
* Character escape.
|
|
26
|
+
* @param {string} $2
|
|
27
|
+
* Character reference.
|
|
28
|
+
* @returns {string}
|
|
29
|
+
* Decoded value
|
|
30
|
+
*/
|
|
31
|
+
function decode($0, $1, $2) {
|
|
32
|
+
if ($1) {
|
|
33
|
+
// Escape.
|
|
34
|
+
return $1;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// Reference.
|
|
38
|
+
const head = $2.charCodeAt(0);
|
|
39
|
+
if (head === 35) {
|
|
40
|
+
const head = $2.charCodeAt(1);
|
|
41
|
+
const hex = head === 120 || head === 88;
|
|
42
|
+
return decodeNumericCharacterReference($2.slice(hex ? 2 : 1), hex ? 16 : 10);
|
|
43
|
+
}
|
|
44
|
+
return decodeNamedCharacterReference($2) || $0;
|
|
45
|
+
}
|
|
@@ -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.
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "micromark-util-decode-string",
|
|
3
|
+
"version": "2.0.1",
|
|
4
|
+
"description": "micromark utility to decode markdown strings",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"micromark",
|
|
8
|
+
"util",
|
|
9
|
+
"utility",
|
|
10
|
+
"decode",
|
|
11
|
+
"character",
|
|
12
|
+
"reference",
|
|
13
|
+
"escape",
|
|
14
|
+
"string"
|
|
15
|
+
],
|
|
16
|
+
"repository": "https://github.com/micromark/micromark/tree/main/packages/micromark-util-decode-string",
|
|
17
|
+
"bugs": "https://github.com/micromark/micromark/issues",
|
|
18
|
+
"funding": [
|
|
19
|
+
{
|
|
20
|
+
"type": "GitHub Sponsors",
|
|
21
|
+
"url": "https://github.com/sponsors/unifiedjs"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"type": "OpenCollective",
|
|
25
|
+
"url": "https://opencollective.com/unified"
|
|
26
|
+
}
|
|
27
|
+
],
|
|
28
|
+
"author": "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)",
|
|
29
|
+
"contributors": [
|
|
30
|
+
"Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)"
|
|
31
|
+
],
|
|
32
|
+
"sideEffects": false,
|
|
33
|
+
"type": "module",
|
|
34
|
+
"files": [
|
|
35
|
+
"dev/",
|
|
36
|
+
"index.d.ts.map",
|
|
37
|
+
"index.d.ts",
|
|
38
|
+
"index.js"
|
|
39
|
+
],
|
|
40
|
+
"exports": {
|
|
41
|
+
"development": "./dev/index.js",
|
|
42
|
+
"default": "./index.js"
|
|
43
|
+
},
|
|
44
|
+
"dependencies": {
|
|
45
|
+
"micromark-util-character": "^2.0.0",
|
|
46
|
+
"micromark-util-decode-numeric-character-reference": "^2.0.0",
|
|
47
|
+
"micromark-util-symbol": "^2.0.0",
|
|
48
|
+
"decode-named-character-reference": "^1.0.0"
|
|
49
|
+
},
|
|
50
|
+
"scripts": {
|
|
51
|
+
"build": "micromark-build"
|
|
52
|
+
},
|
|
53
|
+
"xo": {
|
|
54
|
+
"envs": [
|
|
55
|
+
"shared-node-browser"
|
|
56
|
+
],
|
|
57
|
+
"prettier": true,
|
|
58
|
+
"rules": {
|
|
59
|
+
"unicorn/prefer-code-point": "off",
|
|
60
|
+
"unicorn/prefer-string-replace-all": "off"
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|