@morlay/dsh-reference 0.0.5 → 0.0.7

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/dist/index.mjs CHANGED
@@ -1,6 +1,10 @@
1
1
  import { createUserMessage } from "@deepseek-ai/dsh-llm";
2
2
  import { isUserInvocable, renderSkillContent } from "@deepseek-ai/dsh-skill";
3
3
  import { fromMarkdown } from "mdast-util-from-markdown";
4
+ import { gfmFromMarkdown } from "mdast-util-gfm";
5
+ import { asciiAlpha, asciiAlphanumeric, asciiDigit, markdownLineEnding, markdownLineEndingOrSpace, unicodePunctuation, unicodeWhitespace } from "micromark-util-character";
6
+ import { gfm } from "micromark-extension-gfm";
7
+ import { codes, types } from "micromark-util-symbol";
4
8
  //#region src/file-content.ts
5
9
  const READ_LIMIT = 2e3;
6
10
  const READ_MAX_LINE_LENGTH = 2e3;
@@ -92,4322 +96,7 @@ ${body}
92
96
  </file_content>`;
93
97
  }
94
98
  //#endregion
95
- //#region ../../../node_modules/.pnpm/ccount@2.0.1/node_modules/ccount/index.js
96
- /**
97
- * Count how often a character (or substring) is used in a string.
98
- *
99
- * @param {string} value
100
- * Value to search in.
101
- * @param {string} character
102
- * Character (or substring) to look for.
103
- * @return {number}
104
- * Number of times `character` occurred in `value`.
105
- */
106
- function ccount(value, character) {
107
- const source = String(value);
108
- if (typeof character !== "string") throw new TypeError("Expected character");
109
- let count = 0;
110
- let index = source.indexOf(character);
111
- while (index !== -1) {
112
- count++;
113
- index = source.indexOf(character, index + character.length);
114
- }
115
- return count;
116
- }
117
- //#endregion
118
- //#region ../../../node_modules/.pnpm/micromark-util-character@2.1.1/node_modules/micromark-util-character/index.js
119
- /**
120
- * @import {Code} from 'micromark-util-types'
121
- */
122
- /**
123
- * Check whether the character code represents an ASCII alpha (`a` through `z`,
124
- * case insensitive).
125
- *
126
- * An **ASCII alpha** is an ASCII upper alpha or ASCII lower alpha.
127
- *
128
- * An **ASCII upper alpha** is a character in the inclusive range U+0041 (`A`)
129
- * to U+005A (`Z`).
130
- *
131
- * An **ASCII lower alpha** is a character in the inclusive range U+0061 (`a`)
132
- * to U+007A (`z`).
133
- *
134
- * @param code
135
- * Code.
136
- * @returns {boolean}
137
- * Whether it matches.
138
- */
139
- const asciiAlpha = regexCheck(/[A-Za-z]/);
140
- /**
141
- * Check whether the character code represents an ASCII alphanumeric (`a`
142
- * through `z`, case insensitive, or `0` through `9`).
143
- *
144
- * An **ASCII alphanumeric** is an ASCII digit (see `asciiDigit`) or ASCII alpha
145
- * (see `asciiAlpha`).
146
- *
147
- * @param code
148
- * Code.
149
- * @returns {boolean}
150
- * Whether it matches.
151
- */
152
- const asciiAlphanumeric = regexCheck(/[\dA-Za-z]/);
153
- /**
154
- * Check whether a character code is an ASCII control character.
155
- *
156
- * An **ASCII control** is a character in the inclusive range U+0000 NULL (NUL)
157
- * to U+001F (US), or U+007F (DEL).
158
- *
159
- * @param {Code} code
160
- * Code.
161
- * @returns {boolean}
162
- * Whether it matches.
163
- */
164
- function asciiControl(code) {
165
- return code !== null && (code < 32 || code === 127);
166
- }
167
- /**
168
- * Check whether the character code represents an ASCII digit (`0` through `9`).
169
- *
170
- * An **ASCII digit** is a character in the inclusive range U+0030 (`0`) to
171
- * U+0039 (`9`).
172
- *
173
- * @param code
174
- * Code.
175
- * @returns {boolean}
176
- * Whether it matches.
177
- */
178
- const asciiDigit = regexCheck(/\d/);
179
- /**
180
- * Check whether a character code is a markdown line ending.
181
- *
182
- * A **markdown line ending** is the virtual characters M-0003 CARRIAGE RETURN
183
- * LINE FEED (CRLF), M-0004 LINE FEED (LF) and M-0005 CARRIAGE RETURN (CR).
184
- *
185
- * In micromark, the actual character U+000A LINE FEED (LF) and U+000D CARRIAGE
186
- * RETURN (CR) are replaced by these virtual characters depending on whether
187
- * they occurred together.
188
- *
189
- * @param {Code} code
190
- * Code.
191
- * @returns {boolean}
192
- * Whether it matches.
193
- */
194
- function markdownLineEnding(code) {
195
- return code !== null && code < -2;
196
- }
197
- /**
198
- * Check whether a character code is a markdown line ending (see
199
- * `markdownLineEnding`) or markdown space (see `markdownSpace`).
200
- *
201
- * @param {Code} code
202
- * Code.
203
- * @returns {boolean}
204
- * Whether it matches.
205
- */
206
- function markdownLineEndingOrSpace(code) {
207
- return code !== null && (code < 0 || code === 32);
208
- }
209
- /**
210
- * Check whether a character code is a markdown space.
211
- *
212
- * A **markdown space** is the concrete character U+0020 SPACE (SP) and the
213
- * virtual characters M-0001 VIRTUAL SPACE (VS) and M-0002 HORIZONTAL TAB (HT).
214
- *
215
- * In micromark, the actual character U+0009 CHARACTER TABULATION (HT) is
216
- * replaced by one M-0002 HORIZONTAL TAB (HT) and between 0 and 3 M-0001 VIRTUAL
217
- * SPACE (VS) characters, depending on the column at which the tab occurred.
218
- *
219
- * @param {Code} code
220
- * Code.
221
- * @returns {boolean}
222
- * Whether it matches.
223
- */
224
- function markdownSpace(code) {
225
- return code === -2 || code === -1 || code === 32;
226
- }
227
- /**
228
- * Check whether the character code represents Unicode punctuation.
229
- *
230
- * A **Unicode punctuation** is a character in the Unicode `Pc` (Punctuation,
231
- * Connector), `Pd` (Punctuation, Dash), `Pe` (Punctuation, Close), `Pf`
232
- * (Punctuation, Final quote), `Pi` (Punctuation, Initial quote), `Po`
233
- * (Punctuation, Other), or `Ps` (Punctuation, Open) categories, or an ASCII
234
- * punctuation (see `asciiPunctuation`).
235
- *
236
- * See:
237
- * **\[UNICODE]**:
238
- * [The Unicode Standard](https://www.unicode.org/versions/).
239
- * Unicode Consortium.
240
- *
241
- * @param code
242
- * Code.
243
- * @returns
244
- * Whether it matches.
245
- */
246
- const unicodePunctuation = regexCheck(/\p{P}|\p{S}/u);
247
- /**
248
- * Check whether the character code represents Unicode whitespace.
249
- *
250
- * Note that this does handle micromark specific markdown whitespace characters.
251
- * See `markdownLineEndingOrSpace` to check that.
252
- *
253
- * A **Unicode whitespace** is a character in the Unicode `Zs` (Separator,
254
- * Space) category, or U+0009 CHARACTER TABULATION (HT), U+000A LINE FEED (LF),
255
- * U+000C (FF), or U+000D CARRIAGE RETURN (CR) (**\[UNICODE]**).
256
- *
257
- * See:
258
- * **\[UNICODE]**:
259
- * [The Unicode Standard](https://www.unicode.org/versions/).
260
- * Unicode Consortium.
261
- *
262
- * @param code
263
- * Code.
264
- * @returns
265
- * Whether it matches.
266
- */
267
- const unicodeWhitespace = regexCheck(/\s/);
268
- /**
269
- * Create a code check from a regex.
270
- *
271
- * @param {RegExp} regex
272
- * Expression.
273
- * @returns {(code: Code) => boolean}
274
- * Check.
275
- */
276
- function regexCheck(regex) {
277
- return check;
278
- /**
279
- * Check whether a code matches the bound regex.
280
- *
281
- * @param {Code} code
282
- * Character code.
283
- * @returns {boolean}
284
- * Whether the character code matches the bound regex.
285
- */
286
- function check(code) {
287
- return code !== null && code > -1 && regex.test(String.fromCharCode(code));
288
- }
289
- }
290
- //#endregion
291
- //#region ../../../node_modules/.pnpm/escape-string-regexp@5.0.0/node_modules/escape-string-regexp/index.js
292
- function escapeStringRegexp(string) {
293
- if (typeof string !== "string") throw new TypeError("Expected a string");
294
- return string.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&").replace(/-/g, "\\x2d");
295
- }
296
- //#endregion
297
- //#region ../../../node_modules/.pnpm/unist-util-is@6.0.1/node_modules/unist-util-is/lib/index.js
298
- /**
299
- * Generate an assertion from a test.
300
- *
301
- * Useful if you’re going to test many nodes, for example when creating a
302
- * utility where something else passes a compatible test.
303
- *
304
- * The created function is a bit faster because it expects valid input only:
305
- * a `node`, `index`, and `parent`.
306
- *
307
- * @param {Test} test
308
- * * when nullish, checks if `node` is a `Node`.
309
- * * when `string`, works like passing `(node) => node.type === test`.
310
- * * when `function` checks if function passed the node is true.
311
- * * when `object`, checks that all keys in test are in node, and that they have (strictly) equal values.
312
- * * when `array`, checks if any one of the subtests pass.
313
- * @returns {Check}
314
- * An assertion.
315
- */
316
- const convert = (
317
- /**
318
- * @param {Test} [test]
319
- * @returns {Check}
320
- */
321
- function(test) {
322
- if (test === null || test === void 0) return ok;
323
- if (typeof test === "function") return castFactory(test);
324
- if (typeof test === "object") return Array.isArray(test) ? anyFactory(test) : propertiesFactory(test);
325
- if (typeof test === "string") return typeFactory(test);
326
- throw new Error("Expected function, string, or object as test");
327
- });
328
- /**
329
- * @param {Array<Props | TestFunction | string>} tests
330
- * @returns {Check}
331
- */
332
- function anyFactory(tests) {
333
- /** @type {Array<Check>} */
334
- const checks = [];
335
- let index = -1;
336
- while (++index < tests.length) checks[index] = convert(tests[index]);
337
- return castFactory(any);
338
- /**
339
- * @this {unknown}
340
- * @type {TestFunction}
341
- */
342
- function any(...parameters) {
343
- let index = -1;
344
- while (++index < checks.length) if (checks[index].apply(this, parameters)) return true;
345
- return false;
346
- }
347
- }
348
- /**
349
- * Turn an object into a test for a node with a certain fields.
350
- *
351
- * @param {Props} check
352
- * @returns {Check}
353
- */
354
- function propertiesFactory(check) {
355
- const checkAsRecord = check;
356
- return castFactory(all);
357
- /**
358
- * @param {Node} node
359
- * @returns {boolean}
360
- */
361
- function all(node) {
362
- const nodeAsRecord = node;
363
- /** @type {string} */
364
- let key;
365
- for (key in check) if (nodeAsRecord[key] !== checkAsRecord[key]) return false;
366
- return true;
367
- }
368
- }
369
- /**
370
- * Turn a string into a test for a node with a certain type.
371
- *
372
- * @param {string} check
373
- * @returns {Check}
374
- */
375
- function typeFactory(check) {
376
- return castFactory(type);
377
- /**
378
- * @param {Node} node
379
- */
380
- function type(node) {
381
- return node && node.type === check;
382
- }
383
- }
384
- /**
385
- * Turn a custom test into a test for a node that passes that test.
386
- *
387
- * @param {TestFunction} testFunction
388
- * @returns {Check}
389
- */
390
- function castFactory(testFunction) {
391
- return check;
392
- /**
393
- * @this {unknown}
394
- * @type {Check}
395
- */
396
- function check(value, index, parent) {
397
- return Boolean(looksLikeANode(value) && testFunction.call(this, value, typeof index === "number" ? index : void 0, parent || void 0));
398
- }
399
- }
400
- function ok() {
401
- return true;
402
- }
403
- /**
404
- * @param {unknown} value
405
- * @returns {value is Node}
406
- */
407
- function looksLikeANode(value) {
408
- return value !== null && typeof value === "object" && "type" in value;
409
- }
410
- //#endregion
411
- //#region ../../../node_modules/.pnpm/unist-util-visit-parents@6.0.2/node_modules/unist-util-visit-parents/lib/color.node.js
412
- /**
413
- * @param {string} d
414
- * @returns {string}
415
- */
416
- function color(d) {
417
- return "\x1B[33m" + d + "\x1B[39m";
418
- }
419
- //#endregion
420
- //#region ../../../node_modules/.pnpm/unist-util-visit-parents@6.0.2/node_modules/unist-util-visit-parents/lib/index.js
421
- /**
422
- * @import {Node as UnistNode, Parent as UnistParent} from 'unist'
423
- */
424
- /**
425
- * @typedef {Exclude<import('unist-util-is').Test, undefined> | undefined} Test
426
- * Test from `unist-util-is`.
427
- *
428
- * Note: we have remove and add `undefined`, because otherwise when generating
429
- * automatic `.d.ts` files, TS tries to flatten paths from a local perspective,
430
- * which doesn’t work when publishing on npm.
431
- */
432
- /**
433
- * @typedef {(
434
- * Fn extends (value: any) => value is infer Thing
435
- * ? Thing
436
- * : Fallback
437
- * )} Predicate
438
- * Get the value of a type guard `Fn`.
439
- * @template Fn
440
- * Value; typically function that is a type guard (such as `(x): x is Y`).
441
- * @template Fallback
442
- * Value to yield if `Fn` is not a type guard.
443
- */
444
- /**
445
- * @typedef {(
446
- * Check extends null | undefined // No test.
447
- * ? Value
448
- * : Value extends {type: Check} // String (type) test.
449
- * ? Value
450
- * : Value extends Check // Partial test.
451
- * ? Value
452
- * : Check extends Function // Function test.
453
- * ? Predicate<Check, Value> extends Value
454
- * ? Predicate<Check, Value>
455
- * : never
456
- * : never // Some other test?
457
- * )} MatchesOne
458
- * Check whether a node matches a primitive check in the type system.
459
- * @template Value
460
- * Value; typically unist `Node`.
461
- * @template Check
462
- * Value; typically `unist-util-is`-compatible test, but not arrays.
463
- */
464
- /**
465
- * @typedef {(
466
- * Check extends ReadonlyArray<infer T>
467
- * ? MatchesOne<Value, T>
468
- * : Check extends Array<infer T>
469
- * ? MatchesOne<Value, T>
470
- * : MatchesOne<Value, Check>
471
- * )} Matches
472
- * Check whether a node matches a check in the type system.
473
- * @template Value
474
- * Value; typically unist `Node`.
475
- * @template Check
476
- * Value; typically `unist-util-is`-compatible test.
477
- */
478
- /**
479
- * @typedef {0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10} Uint
480
- * Number; capped reasonably.
481
- */
482
- /**
483
- * @typedef {I extends 0 ? 1 : I extends 1 ? 2 : I extends 2 ? 3 : I extends 3 ? 4 : I extends 4 ? 5 : I extends 5 ? 6 : I extends 6 ? 7 : I extends 7 ? 8 : I extends 8 ? 9 : 10} Increment
484
- * Increment a number in the type system.
485
- * @template {Uint} [I=0]
486
- * Index.
487
- */
488
- /**
489
- * @typedef {(
490
- * Node extends UnistParent
491
- * ? Node extends {children: Array<infer Children>}
492
- * ? Child extends Children ? Node : never
493
- * : never
494
- * : never
495
- * )} InternalParent
496
- * Collect nodes that can be parents of `Child`.
497
- * @template {UnistNode} Node
498
- * All node types in a tree.
499
- * @template {UnistNode} Child
500
- * Node to search for.
501
- */
502
- /**
503
- * @typedef {InternalParent<InclusiveDescendant<Tree>, Child>} Parent
504
- * Collect nodes in `Tree` that can be parents of `Child`.
505
- * @template {UnistNode} Tree
506
- * All node types in a tree.
507
- * @template {UnistNode} Child
508
- * Node to search for.
509
- */
510
- /**
511
- * @typedef {(
512
- * Depth extends Max
513
- * ? never
514
- * :
515
- * | InternalParent<Node, Child>
516
- * | InternalAncestor<Node, InternalParent<Node, Child>, Max, Increment<Depth>>
517
- * )} InternalAncestor
518
- * Collect nodes in `Tree` that can be ancestors of `Child`.
519
- * @template {UnistNode} Node
520
- * All node types in a tree.
521
- * @template {UnistNode} Child
522
- * Node to search for.
523
- * @template {Uint} [Max=10]
524
- * Max; searches up to this depth.
525
- * @template {Uint} [Depth=0]
526
- * Current depth.
527
- */
528
- /**
529
- * @typedef {InternalAncestor<InclusiveDescendant<Tree>, Child>} Ancestor
530
- * Collect nodes in `Tree` that can be ancestors of `Child`.
531
- * @template {UnistNode} Tree
532
- * All node types in a tree.
533
- * @template {UnistNode} Child
534
- * Node to search for.
535
- */
536
- /**
537
- * @typedef {(
538
- * Tree extends UnistParent
539
- * ? Depth extends Max
540
- * ? Tree
541
- * : Tree | InclusiveDescendant<Tree['children'][number], Max, Increment<Depth>>
542
- * : Tree
543
- * )} InclusiveDescendant
544
- * Collect all (inclusive) descendants of `Tree`.
545
- *
546
- * > 👉 **Note**: for performance reasons, this seems to be the fastest way to
547
- * > recurse without actually running into an infinite loop, which the
548
- * > previous version did.
549
- * >
550
- * > Practically, a max of `2` is typically enough assuming a `Root` is
551
- * > passed, but it doesn’t improve performance.
552
- * > It gets higher with `List > ListItem > Table > TableRow > TableCell`.
553
- * > Using up to `10` doesn’t hurt or help either.
554
- * @template {UnistNode} Tree
555
- * Tree type.
556
- * @template {Uint} [Max=10]
557
- * Max; searches up to this depth.
558
- * @template {Uint} [Depth=0]
559
- * Current depth.
560
- */
561
- /**
562
- * @typedef {'skip' | boolean} Action
563
- * Union of the action types.
564
- *
565
- * @typedef {number} Index
566
- * Move to the sibling at `index` next (after node itself is completely
567
- * traversed).
568
- *
569
- * Useful if mutating the tree, such as removing the node the visitor is
570
- * currently on, or any of its previous siblings.
571
- * Results less than 0 or greater than or equal to `children.length` stop
572
- * traversing the parent.
573
- *
574
- * @typedef {[(Action | null | undefined | void)?, (Index | null | undefined)?]} ActionTuple
575
- * List with one or two values, the first an action, the second an index.
576
- *
577
- * @typedef {Action | ActionTuple | Index | null | undefined | void} VisitorResult
578
- * Any value that can be returned from a visitor.
579
- */
580
- /**
581
- * @callback Visitor
582
- * Handle a node (matching `test`, if given).
583
- *
584
- * Visitors are free to transform `node`.
585
- * They can also transform the parent of node (the last of `ancestors`).
586
- *
587
- * Replacing `node` itself, if `SKIP` is not returned, still causes its
588
- * descendants to be walked (which is a bug).
589
- *
590
- * When adding or removing previous siblings of `node` (or next siblings, in
591
- * case of reverse), the `Visitor` should return a new `Index` to specify the
592
- * sibling to traverse after `node` is traversed.
593
- * Adding or removing next siblings of `node` (or previous siblings, in case
594
- * of reverse) is handled as expected without needing to return a new `Index`.
595
- *
596
- * Removing the children property of an ancestor still results in them being
597
- * traversed.
598
- * @param {Visited} node
599
- * Found node.
600
- * @param {Array<VisitedParents>} ancestors
601
- * Ancestors of `node`.
602
- * @returns {VisitorResult}
603
- * What to do next.
604
- *
605
- * An `Index` is treated as a tuple of `[CONTINUE, Index]`.
606
- * An `Action` is treated as a tuple of `[Action]`.
607
- *
608
- * Passing a tuple back only makes sense if the `Action` is `SKIP`.
609
- * When the `Action` is `EXIT`, that action can be returned.
610
- * When the `Action` is `CONTINUE`, `Index` can be returned.
611
- * @template {UnistNode} [Visited=UnistNode]
612
- * Visited node type.
613
- * @template {UnistParent} [VisitedParents=UnistParent]
614
- * Ancestor type.
615
- */
616
- /**
617
- * @typedef {Visitor<Matches<InclusiveDescendant<Tree>, Check>, Ancestor<Tree, Matches<InclusiveDescendant<Tree>, Check>>>} BuildVisitor
618
- * Build a typed `Visitor` function from a tree and a test.
619
- *
620
- * It will infer which values are passed as `node` and which as `parents`.
621
- * @template {UnistNode} [Tree=UnistNode]
622
- * Tree type.
623
- * @template {Test} [Check=Test]
624
- * Test type.
625
- */
626
- /** @type {Readonly<ActionTuple>} */
627
- const empty = [];
628
- /**
629
- * Visit nodes, with ancestral information.
630
- *
631
- * This algorithm performs *depth-first* *tree traversal* in *preorder*
632
- * (**NLR**) or if `reverse` is given, in *reverse preorder* (**NRL**).
633
- *
634
- * You can choose for which nodes `visitor` is called by passing a `test`.
635
- * For complex tests, you should test yourself in `visitor`, as it will be
636
- * faster and will have improved type information.
637
- *
638
- * Walking the tree is an intensive task.
639
- * Make use of the return values of the visitor when possible.
640
- * Instead of walking a tree multiple times, walk it once, use `unist-util-is`
641
- * to check if a node matches, and then perform different operations.
642
- *
643
- * You can change the tree.
644
- * See `Visitor` for more info.
645
- *
646
- * @overload
647
- * @param {Tree} tree
648
- * @param {Check} check
649
- * @param {BuildVisitor<Tree, Check>} visitor
650
- * @param {boolean | null | undefined} [reverse]
651
- * @returns {undefined}
652
- *
653
- * @overload
654
- * @param {Tree} tree
655
- * @param {BuildVisitor<Tree>} visitor
656
- * @param {boolean | null | undefined} [reverse]
657
- * @returns {undefined}
658
- *
659
- * @param {UnistNode} tree
660
- * Tree to traverse.
661
- * @param {Visitor | Test} test
662
- * `unist-util-is`-compatible test
663
- * @param {Visitor | boolean | null | undefined} [visitor]
664
- * Handle each node.
665
- * @param {boolean | null | undefined} [reverse]
666
- * Traverse in reverse preorder (NRL) instead of the default preorder (NLR).
667
- * @returns {undefined}
668
- * Nothing.
669
- *
670
- * @template {UnistNode} Tree
671
- * Node type.
672
- * @template {Test} Check
673
- * `unist-util-is`-compatible test.
674
- */
675
- function visitParents(tree, test, visitor, reverse) {
676
- /** @type {Test} */
677
- let check;
678
- if (typeof test === "function" && typeof visitor !== "function") {
679
- reverse = visitor;
680
- visitor = test;
681
- } else check = test;
682
- const is = convert(check);
683
- const step = reverse ? -1 : 1;
684
- factory(tree, void 0, [])();
685
- /**
686
- * @param {UnistNode} node
687
- * @param {number | undefined} index
688
- * @param {Array<UnistParent>} parents
689
- */
690
- function factory(node, index, parents) {
691
- const value = node && typeof node === "object" ? node : {};
692
- if (typeof value.type === "string") {
693
- const name = typeof value.tagName === "string" ? value.tagName : typeof value.name === "string" ? value.name : void 0;
694
- Object.defineProperty(visit, "name", { value: "node (" + color(node.type + (name ? "<" + name + ">" : "")) + ")" });
695
- }
696
- return visit;
697
- function visit() {
698
- /** @type {Readonly<ActionTuple>} */
699
- let result = empty;
700
- /** @type {Readonly<ActionTuple>} */
701
- let subresult;
702
- /** @type {number} */
703
- let offset;
704
- /** @type {Array<UnistParent>} */
705
- let grandparents;
706
- if (!test || is(node, index, parents[parents.length - 1] || void 0)) {
707
- result = toResult(visitor(node, parents));
708
- if (result[0] === false) return result;
709
- }
710
- if ("children" in node && node.children) {
711
- const nodeAsParent = node;
712
- if (nodeAsParent.children && result[0] !== "skip") {
713
- offset = (reverse ? nodeAsParent.children.length : -1) + step;
714
- grandparents = parents.concat(nodeAsParent);
715
- while (offset > -1 && offset < nodeAsParent.children.length) {
716
- const child = nodeAsParent.children[offset];
717
- subresult = factory(child, offset, grandparents)();
718
- if (subresult[0] === false) return subresult;
719
- offset = typeof subresult[1] === "number" ? subresult[1] : offset + step;
720
- }
721
- }
722
- }
723
- return result;
724
- }
725
- }
726
- }
727
- /**
728
- * Turn a return value into a clean result.
729
- *
730
- * @param {VisitorResult} value
731
- * Valid return values from visitors.
732
- * @returns {Readonly<ActionTuple>}
733
- * Clean result.
734
- */
735
- function toResult(value) {
736
- if (Array.isArray(value)) return value;
737
- if (typeof value === "number") return [true, value];
738
- return value === null || value === void 0 ? empty : [value];
739
- }
740
- //#endregion
741
- //#region ../../../node_modules/.pnpm/mdast-util-find-and-replace@3.0.2/node_modules/mdast-util-find-and-replace/lib/index.js
742
- /**
743
- * @import {Nodes, Parents, PhrasingContent, Root, Text} from 'mdast'
744
- * @import {BuildVisitor, Test, VisitorResult} from 'unist-util-visit-parents'
745
- */
746
- /**
747
- * @typedef RegExpMatchObject
748
- * Info on the match.
749
- * @property {number} index
750
- * The index of the search at which the result was found.
751
- * @property {string} input
752
- * A copy of the search string in the text node.
753
- * @property {[...Array<Parents>, Text]} stack
754
- * All ancestors of the text node, where the last node is the text itself.
755
- *
756
- * @typedef {RegExp | string} Find
757
- * Pattern to find.
758
- *
759
- * Strings are escaped and then turned into global expressions.
760
- *
761
- * @typedef {Array<FindAndReplaceTuple>} FindAndReplaceList
762
- * Several find and replaces, in array form.
763
- *
764
- * @typedef {[Find, Replace?]} FindAndReplaceTuple
765
- * Find and replace in tuple form.
766
- *
767
- * @typedef {ReplaceFunction | string | null | undefined} Replace
768
- * Thing to replace with.
769
- *
770
- * @callback ReplaceFunction
771
- * Callback called when a search matches.
772
- * @param {...any} parameters
773
- * The parameters are the result of corresponding search expression:
774
- *
775
- * * `value` (`string`) — whole match
776
- * * `...capture` (`Array<string>`) — matches from regex capture groups
777
- * * `match` (`RegExpMatchObject`) — info on the match
778
- * @returns {Array<PhrasingContent> | PhrasingContent | string | false | null | undefined}
779
- * Thing to replace with.
780
- *
781
- * * when `null`, `undefined`, `''`, remove the match
782
- * * …or when `false`, do not replace at all
783
- * * …or when `string`, replace with a text node of that value
784
- * * …or when `Node` or `Array<Node>`, replace with those nodes
785
- *
786
- * @typedef {[RegExp, ReplaceFunction]} Pair
787
- * Normalized find and replace.
788
- *
789
- * @typedef {Array<Pair>} Pairs
790
- * All find and replaced.
791
- *
792
- * @typedef Options
793
- * Configuration.
794
- * @property {Test | null | undefined} [ignore]
795
- * Test for which nodes to ignore (optional).
796
- */
797
- /**
798
- * Find patterns in a tree and replace them.
799
- *
800
- * The algorithm searches the tree in *preorder* for complete values in `Text`
801
- * nodes.
802
- * Partial matches are not supported.
803
- *
804
- * @param {Nodes} tree
805
- * Tree to change.
806
- * @param {FindAndReplaceList | FindAndReplaceTuple} list
807
- * Patterns to find.
808
- * @param {Options | null | undefined} [options]
809
- * Configuration (when `find` is not `Find`).
810
- * @returns {undefined}
811
- * Nothing.
812
- */
813
- function findAndReplace(tree, list, options) {
814
- const ignored = convert((options || {}).ignore || []);
815
- const pairs = toPairs(list);
816
- let pairIndex = -1;
817
- while (++pairIndex < pairs.length) visitParents(tree, "text", visitor);
818
- /** @type {BuildVisitor<Root, 'text'>} */
819
- function visitor(node, parents) {
820
- let index = -1;
821
- /** @type {Parents | undefined} */
822
- let grandparent;
823
- while (++index < parents.length) {
824
- const parent = parents[index];
825
- /** @type {Array<Nodes> | undefined} */
826
- const siblings = grandparent ? grandparent.children : void 0;
827
- if (ignored(parent, siblings ? siblings.indexOf(parent) : void 0, grandparent)) return;
828
- grandparent = parent;
829
- }
830
- if (grandparent) return handler(node, parents);
831
- }
832
- /**
833
- * Handle a text node which is not in an ignored parent.
834
- *
835
- * @param {Text} node
836
- * Text node.
837
- * @param {Array<Parents>} parents
838
- * Parents.
839
- * @returns {VisitorResult}
840
- * Result.
841
- */
842
- function handler(node, parents) {
843
- const parent = parents[parents.length - 1];
844
- const find = pairs[pairIndex][0];
845
- const replace = pairs[pairIndex][1];
846
- let start = 0;
847
- const index = parent.children.indexOf(node);
848
- let change = false;
849
- /** @type {Array<PhrasingContent>} */
850
- let nodes = [];
851
- find.lastIndex = 0;
852
- let match = find.exec(node.value);
853
- while (match) {
854
- const position = match.index;
855
- /** @type {RegExpMatchObject} */
856
- const matchObject = {
857
- index: match.index,
858
- input: match.input,
859
- stack: [...parents, node]
860
- };
861
- let value = replace(...match, matchObject);
862
- if (typeof value === "string") value = value.length > 0 ? {
863
- type: "text",
864
- value
865
- } : void 0;
866
- if (value === false) find.lastIndex = position + 1;
867
- else {
868
- if (start !== position) nodes.push({
869
- type: "text",
870
- value: node.value.slice(start, position)
871
- });
872
- if (Array.isArray(value)) nodes.push(...value);
873
- else if (value) nodes.push(value);
874
- start = position + match[0].length;
875
- change = true;
876
- }
877
- if (!find.global) break;
878
- match = find.exec(node.value);
879
- }
880
- if (change) {
881
- if (start < node.value.length) nodes.push({
882
- type: "text",
883
- value: node.value.slice(start)
884
- });
885
- parent.children.splice(index, 1, ...nodes);
886
- } else nodes = [node];
887
- return index + nodes.length;
888
- }
889
- }
890
- /**
891
- * Turn a tuple or a list of tuples into pairs.
892
- *
893
- * @param {FindAndReplaceList | FindAndReplaceTuple} tupleOrList
894
- * Schema.
895
- * @returns {Pairs}
896
- * Clean pairs.
897
- */
898
- function toPairs(tupleOrList) {
899
- /** @type {Pairs} */
900
- const result = [];
901
- if (!Array.isArray(tupleOrList)) throw new TypeError("Expected find and replace tuple or list of tuples");
902
- /** @type {FindAndReplaceList} */
903
- const list = !tupleOrList[0] || Array.isArray(tupleOrList[0]) ? tupleOrList : [tupleOrList];
904
- let index = -1;
905
- while (++index < list.length) {
906
- const tuple = list[index];
907
- result.push([toExpression(tuple[0]), toFunction(tuple[1])]);
908
- }
909
- return result;
910
- }
911
- /**
912
- * Turn a find into an expression.
913
- *
914
- * @param {Find} find
915
- * Find.
916
- * @returns {RegExp}
917
- * Expression.
918
- */
919
- function toExpression(find) {
920
- return typeof find === "string" ? new RegExp(escapeStringRegexp(find), "g") : find;
921
- }
922
- /**
923
- * Turn a replace into a function.
924
- *
925
- * @param {Replace} replace
926
- * Replace.
927
- * @returns {ReplaceFunction}
928
- * Function.
929
- */
930
- function toFunction(replace) {
931
- return typeof replace === "function" ? replace : function() {
932
- return replace;
933
- };
934
- }
935
- //#endregion
936
- //#region ../../../node_modules/.pnpm/mdast-util-gfm-autolink-literal@2.0.1/node_modules/mdast-util-gfm-autolink-literal/lib/index.js
937
- /**
938
- * @import {RegExpMatchObject, ReplaceFunction} from 'mdast-util-find-and-replace'
939
- * @import {CompileContext, Extension as FromMarkdownExtension, Handle as FromMarkdownHandle, Transform as FromMarkdownTransform} from 'mdast-util-from-markdown'
940
- * @import {ConstructName, Options as ToMarkdownExtension} from 'mdast-util-to-markdown'
941
- * @import {Link, PhrasingContent} from 'mdast'
942
- */
943
- /**
944
- * Create an extension for `mdast-util-from-markdown` to enable GFM autolink
945
- * literals in markdown.
946
- *
947
- * @returns {FromMarkdownExtension}
948
- * Extension for `mdast-util-to-markdown` to enable GFM autolink literals.
949
- */
950
- function gfmAutolinkLiteralFromMarkdown() {
951
- return {
952
- transforms: [transformGfmAutolinkLiterals],
953
- enter: {
954
- literalAutolink: enterLiteralAutolink,
955
- literalAutolinkEmail: enterLiteralAutolinkValue,
956
- literalAutolinkHttp: enterLiteralAutolinkValue,
957
- literalAutolinkWww: enterLiteralAutolinkValue
958
- },
959
- exit: {
960
- literalAutolink: exitLiteralAutolink,
961
- literalAutolinkEmail: exitLiteralAutolinkEmail,
962
- literalAutolinkHttp: exitLiteralAutolinkHttp,
963
- literalAutolinkWww: exitLiteralAutolinkWww
964
- }
965
- };
966
- }
967
- /**
968
- * @this {CompileContext}
969
- * @type {FromMarkdownHandle}
970
- */
971
- function enterLiteralAutolink(token) {
972
- this.enter({
973
- type: "link",
974
- title: null,
975
- url: "",
976
- children: []
977
- }, token);
978
- }
979
- /**
980
- * @this {CompileContext}
981
- * @type {FromMarkdownHandle}
982
- */
983
- function enterLiteralAutolinkValue(token) {
984
- this.config.enter.autolinkProtocol.call(this, token);
985
- }
986
- /**
987
- * @this {CompileContext}
988
- * @type {FromMarkdownHandle}
989
- */
990
- function exitLiteralAutolinkHttp(token) {
991
- this.config.exit.autolinkProtocol.call(this, token);
992
- }
993
- /**
994
- * @this {CompileContext}
995
- * @type {FromMarkdownHandle}
996
- */
997
- function exitLiteralAutolinkWww(token) {
998
- this.config.exit.data.call(this, token);
999
- const node = this.stack[this.stack.length - 1];
1000
- node.type;
1001
- node.url = "http://" + this.sliceSerialize(token);
1002
- }
1003
- /**
1004
- * @this {CompileContext}
1005
- * @type {FromMarkdownHandle}
1006
- */
1007
- function exitLiteralAutolinkEmail(token) {
1008
- this.config.exit.autolinkEmail.call(this, token);
1009
- }
1010
- /**
1011
- * @this {CompileContext}
1012
- * @type {FromMarkdownHandle}
1013
- */
1014
- function exitLiteralAutolink(token) {
1015
- this.exit(token);
1016
- }
1017
- /** @type {FromMarkdownTransform} */
1018
- function transformGfmAutolinkLiterals(tree) {
1019
- findAndReplace(tree, [[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi, findUrl], [/(?<=^|\s|\p{P}|\p{S})([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/gu, findEmail]], { ignore: ["link", "linkReference"] });
1020
- }
1021
- /**
1022
- * @type {ReplaceFunction}
1023
- * @param {string} _
1024
- * @param {string} protocol
1025
- * @param {string} domain
1026
- * @param {string} path
1027
- * @param {RegExpMatchObject} match
1028
- * @returns {Array<PhrasingContent> | Link | false}
1029
- */
1030
- function findUrl(_, protocol, domain, path, match) {
1031
- let prefix = "";
1032
- if (!previous(match)) return false;
1033
- if (/^w/i.test(protocol)) {
1034
- domain = protocol + domain;
1035
- protocol = "";
1036
- prefix = "http://";
1037
- }
1038
- if (!isCorrectDomain(domain)) return false;
1039
- const parts = splitUrl(domain + path);
1040
- if (!parts[0]) return false;
1041
- /** @type {Link} */
1042
- const result = {
1043
- type: "link",
1044
- title: null,
1045
- url: prefix + protocol + parts[0],
1046
- children: [{
1047
- type: "text",
1048
- value: protocol + parts[0]
1049
- }]
1050
- };
1051
- if (parts[1]) return [result, {
1052
- type: "text",
1053
- value: parts[1]
1054
- }];
1055
- return result;
1056
- }
1057
- /**
1058
- * @type {ReplaceFunction}
1059
- * @param {string} _
1060
- * @param {string} atext
1061
- * @param {string} label
1062
- * @param {RegExpMatchObject} match
1063
- * @returns {Link | false}
1064
- */
1065
- function findEmail(_, atext, label, match) {
1066
- if (!previous(match, true) || /[-\d_]$/.test(label)) return false;
1067
- return {
1068
- type: "link",
1069
- title: null,
1070
- url: "mailto:" + atext + "@" + label,
1071
- children: [{
1072
- type: "text",
1073
- value: atext + "@" + label
1074
- }]
1075
- };
1076
- }
1077
- /**
1078
- * @param {string} domain
1079
- * @returns {boolean}
1080
- */
1081
- function isCorrectDomain(domain) {
1082
- const parts = domain.split(".");
1083
- if (parts.length < 2 || parts[parts.length - 1] && (/_/.test(parts[parts.length - 1]) || !/[a-zA-Z\d]/.test(parts[parts.length - 1])) || parts[parts.length - 2] && (/_/.test(parts[parts.length - 2]) || !/[a-zA-Z\d]/.test(parts[parts.length - 2]))) return false;
1084
- return true;
1085
- }
1086
- /**
1087
- * @param {string} url
1088
- * @returns {[string, string | undefined]}
1089
- */
1090
- function splitUrl(url) {
1091
- const trailExec = /[!"&'),.:;<>?\]}]+$/.exec(url);
1092
- if (!trailExec) return [url, void 0];
1093
- url = url.slice(0, trailExec.index);
1094
- let trail = trailExec[0];
1095
- let closingParenIndex = trail.indexOf(")");
1096
- const openingParens = ccount(url, "(");
1097
- let closingParens = ccount(url, ")");
1098
- while (closingParenIndex !== -1 && openingParens > closingParens) {
1099
- url += trail.slice(0, closingParenIndex + 1);
1100
- trail = trail.slice(closingParenIndex + 1);
1101
- closingParenIndex = trail.indexOf(")");
1102
- closingParens++;
1103
- }
1104
- return [url, trail];
1105
- }
1106
- /**
1107
- * @param {RegExpMatchObject} match
1108
- * @param {boolean | null | undefined} [email=false]
1109
- * @returns {boolean}
1110
- */
1111
- function previous(match, email) {
1112
- const code = match.input.charCodeAt(match.index - 1);
1113
- return (match.index === 0 || unicodeWhitespace(code) || unicodePunctuation(code)) && (!email || code !== 47);
1114
- }
1115
- //#endregion
1116
- //#region ../../../node_modules/.pnpm/micromark-util-normalize-identifier@2.0.1/node_modules/micromark-util-normalize-identifier/index.js
1117
- /**
1118
- * Normalize an identifier (as found in references, definitions).
1119
- *
1120
- * Collapses markdown whitespace, trim, and then lower- and uppercase.
1121
- *
1122
- * Some characters are considered “uppercase”, such as U+03F4 (`ϴ`), but if their
1123
- * lowercase counterpart (U+03B8 (`θ`)) is uppercased will result in a different
1124
- * uppercase character (U+0398 (`Θ`)).
1125
- * So, to get a canonical form, we perform both lower- and uppercase.
1126
- *
1127
- * Using uppercase last makes sure keys will never interact with default
1128
- * prototypal values (such as `constructor`): nothing in the prototype of
1129
- * `Object` is uppercase.
1130
- *
1131
- * @param {string} value
1132
- * Identifier to normalize.
1133
- * @returns {string}
1134
- * Normalized identifier.
1135
- */
1136
- function normalizeIdentifier(value) {
1137
- return value.replace(/[\t\n\r ]+/g, " ").replace(/^ | $/g, "").toLowerCase().toUpperCase();
1138
- }
1139
- //#endregion
1140
- //#region ../../../node_modules/.pnpm/mdast-util-gfm-footnote@2.1.0_supports-color@9.4.0/node_modules/mdast-util-gfm-footnote/lib/index.js
1141
- /**
1142
- * @import {
1143
- * CompileContext,
1144
- * Extension as FromMarkdownExtension,
1145
- * Handle as FromMarkdownHandle
1146
- * } from 'mdast-util-from-markdown'
1147
- * @import {ToMarkdownOptions} from 'mdast-util-gfm-footnote'
1148
- * @import {
1149
- * Handle as ToMarkdownHandle,
1150
- * Map,
1151
- * Options as ToMarkdownExtension
1152
- * } from 'mdast-util-to-markdown'
1153
- * @import {FootnoteDefinition, FootnoteReference} from 'mdast'
1154
- */
1155
- footnoteReference.peek = footnoteReferencePeek;
1156
- /**
1157
- * @this {CompileContext}
1158
- * @type {FromMarkdownHandle}
1159
- */
1160
- function enterFootnoteCallString() {
1161
- this.buffer();
1162
- }
1163
- /**
1164
- * @this {CompileContext}
1165
- * @type {FromMarkdownHandle}
1166
- */
1167
- function enterFootnoteCall(token) {
1168
- this.enter({
1169
- type: "footnoteReference",
1170
- identifier: "",
1171
- label: ""
1172
- }, token);
1173
- }
1174
- /**
1175
- * @this {CompileContext}
1176
- * @type {FromMarkdownHandle}
1177
- */
1178
- function enterFootnoteDefinitionLabelString() {
1179
- this.buffer();
1180
- }
1181
- /**
1182
- * @this {CompileContext}
1183
- * @type {FromMarkdownHandle}
1184
- */
1185
- function enterFootnoteDefinition(token) {
1186
- this.enter({
1187
- type: "footnoteDefinition",
1188
- identifier: "",
1189
- label: "",
1190
- children: []
1191
- }, token);
1192
- }
1193
- /**
1194
- * @this {CompileContext}
1195
- * @type {FromMarkdownHandle}
1196
- */
1197
- function exitFootnoteCallString(token) {
1198
- const label = this.resume();
1199
- const node = this.stack[this.stack.length - 1];
1200
- node.type;
1201
- node.identifier = normalizeIdentifier(this.sliceSerialize(token)).toLowerCase();
1202
- node.label = label;
1203
- }
1204
- /**
1205
- * @this {CompileContext}
1206
- * @type {FromMarkdownHandle}
1207
- */
1208
- function exitFootnoteCall(token) {
1209
- this.exit(token);
1210
- }
1211
- /**
1212
- * @this {CompileContext}
1213
- * @type {FromMarkdownHandle}
1214
- */
1215
- function exitFootnoteDefinitionLabelString(token) {
1216
- const label = this.resume();
1217
- const node = this.stack[this.stack.length - 1];
1218
- node.type;
1219
- node.identifier = normalizeIdentifier(this.sliceSerialize(token)).toLowerCase();
1220
- node.label = label;
1221
- }
1222
- /**
1223
- * @this {CompileContext}
1224
- * @type {FromMarkdownHandle}
1225
- */
1226
- function exitFootnoteDefinition(token) {
1227
- this.exit(token);
1228
- }
1229
- /** @type {ToMarkdownHandle} */
1230
- function footnoteReferencePeek() {
1231
- return "[";
1232
- }
1233
- /**
1234
- * @type {ToMarkdownHandle}
1235
- * @param {FootnoteReference} node
1236
- */
1237
- function footnoteReference(node, _, state, info) {
1238
- const tracker = state.createTracker(info);
1239
- let value = tracker.move("[^");
1240
- const exit = state.enter("footnoteReference");
1241
- const subexit = state.enter("reference");
1242
- value += tracker.move(state.safe(state.associationId(node), {
1243
- after: "]",
1244
- before: value
1245
- }));
1246
- subexit();
1247
- exit();
1248
- value += tracker.move("]");
1249
- return value;
1250
- }
1251
- /**
1252
- * Create an extension for `mdast-util-from-markdown` to enable GFM footnotes
1253
- * in markdown.
1254
- *
1255
- * @returns {FromMarkdownExtension}
1256
- * Extension for `mdast-util-from-markdown`.
1257
- */
1258
- function gfmFootnoteFromMarkdown() {
1259
- return {
1260
- enter: {
1261
- gfmFootnoteCallString: enterFootnoteCallString,
1262
- gfmFootnoteCall: enterFootnoteCall,
1263
- gfmFootnoteDefinitionLabelString: enterFootnoteDefinitionLabelString,
1264
- gfmFootnoteDefinition: enterFootnoteDefinition
1265
- },
1266
- exit: {
1267
- gfmFootnoteCallString: exitFootnoteCallString,
1268
- gfmFootnoteCall: exitFootnoteCall,
1269
- gfmFootnoteDefinitionLabelString: exitFootnoteDefinitionLabelString,
1270
- gfmFootnoteDefinition: exitFootnoteDefinition
1271
- }
1272
- };
1273
- }
1274
- //#endregion
1275
- //#region ../../../node_modules/.pnpm/mdast-util-gfm-strikethrough@2.0.1_supports-color@9.4.0/node_modules/mdast-util-gfm-strikethrough/lib/index.js
1276
- handleDelete.attention = attentionDelete;
1277
- handleDelete.peek = peekDelete;
1278
- /**
1279
- * Create an extension for `mdast-util-from-markdown` to enable GFM
1280
- * strikethrough in markdown.
1281
- *
1282
- * @returns {FromMarkdownExtension}
1283
- * Extension for `mdast-util-from-markdown` to enable GFM strikethrough.
1284
- */
1285
- function gfmStrikethroughFromMarkdown() {
1286
- return {
1287
- canContainEols: ["delete"],
1288
- enter: { strikethrough: enterStrikethrough },
1289
- exit: { strikethrough: exitStrikethrough }
1290
- };
1291
- }
1292
- /**
1293
- * Enter strikethrough.
1294
- *
1295
- * @this {CompileContext}
1296
- * @type {FromMarkdownHandle}
1297
- */
1298
- function enterStrikethrough(token) {
1299
- this.enter({
1300
- type: "delete",
1301
- children: [],
1302
- position: void 0
1303
- }, token);
1304
- }
1305
- /**
1306
- * Exit strikethrough.
1307
- *
1308
- * @this {CompileContext}
1309
- * @type {FromMarkdownHandle}
1310
- */
1311
- function exitStrikethrough(token) {
1312
- this.exit(token);
1313
- }
1314
- /**
1315
- * Serialize a delete node.
1316
- *
1317
- * @type {ToMarkdownHandle}
1318
- * @param {Delete} node
1319
- * Node to serialize.
1320
- */
1321
- function handleDelete(node, _, state, info) {
1322
- const tracker = state.createTracker(info);
1323
- const sequence = state.stack.includes("strikethrough") ? "~" : "~~";
1324
- const exit = state.enter("strikethrough");
1325
- let value = tracker.move(sequence);
1326
- value += state.containerPhrasing(node, {
1327
- ...tracker.current(),
1328
- before: value,
1329
- after: "~"
1330
- });
1331
- value += tracker.move(sequence);
1332
- exit();
1333
- return value;
1334
- }
1335
- /**
1336
- * Serialize a delete node as attention.
1337
- *
1338
- * @type {Attention}
1339
- */
1340
- function attentionDelete() {
1341
- return {
1342
- construct: "strikethrough",
1343
- markers: ["~"],
1344
- sizes: [2, 1]
1345
- };
1346
- }
1347
- /**
1348
- * Peek the first character of a delete node.
1349
- *
1350
- * @type {ToMarkdownHandle}
1351
- */
1352
- function peekDelete() {
1353
- return "~";
1354
- }
1355
- //#endregion
1356
- //#region ../../../node_modules/.pnpm/micromark-util-classify-character@2.0.1/node_modules/micromark-util-classify-character/index.js
1357
- /**
1358
- * @import {Code} from 'micromark-util-types'
1359
- */
1360
- /**
1361
- * Classify whether a code represents whitespace, punctuation, or something
1362
- * else.
1363
- *
1364
- * Used for attention (emphasis, strong), whose sequences can open or close
1365
- * based on the class of surrounding characters.
1366
- *
1367
- * > 👉 **Note**: eof (`null`) is seen as whitespace.
1368
- *
1369
- * @param {Code} code
1370
- * Code.
1371
- * @returns {typeof constants.characterGroupWhitespace | typeof constants.characterGroupPunctuation | undefined}
1372
- * Group.
1373
- */
1374
- function classifyCharacter(code) {
1375
- if (code === null || markdownLineEndingOrSpace(code) || unicodeWhitespace(code)) return 1;
1376
- if (unicodePunctuation(code)) return 2;
1377
- }
1378
- //#endregion
1379
- //#region ../../../node_modules/.pnpm/mdast-util-gfm-table@2.0.0_supports-color@9.4.0/node_modules/mdast-util-gfm-table/lib/index.js
1380
- /**
1381
- * @typedef {import('mdast').InlineCode} InlineCode
1382
- * @typedef {import('mdast').Table} Table
1383
- * @typedef {import('mdast').TableCell} TableCell
1384
- * @typedef {import('mdast').TableRow} TableRow
1385
- *
1386
- * @typedef {import('markdown-table').Options} MarkdownTableOptions
1387
- *
1388
- * @typedef {import('mdast-util-from-markdown').CompileContext} CompileContext
1389
- * @typedef {import('mdast-util-from-markdown').Extension} FromMarkdownExtension
1390
- * @typedef {import('mdast-util-from-markdown').Handle} FromMarkdownHandle
1391
- *
1392
- * @typedef {import('mdast-util-to-markdown').Options} ToMarkdownExtension
1393
- * @typedef {import('mdast-util-to-markdown').Handle} ToMarkdownHandle
1394
- * @typedef {import('mdast-util-to-markdown').State} State
1395
- * @typedef {import('mdast-util-to-markdown').Info} Info
1396
- */
1397
- /**
1398
- * @typedef Options
1399
- * Configuration.
1400
- * @property {boolean | null | undefined} [tableCellPadding=true]
1401
- * Whether to add a space of padding between delimiters and cells (default:
1402
- * `true`).
1403
- * @property {boolean | null | undefined} [tablePipeAlign=true]
1404
- * Whether to align the delimiters (default: `true`).
1405
- * @property {MarkdownTableOptions['stringLength'] | null | undefined} [stringLength]
1406
- * Function to detect the length of table cell content, used when aligning
1407
- * the delimiters between cells (optional).
1408
- */
1409
- /**
1410
- * Create an extension for `mdast-util-from-markdown` to enable GFM tables in
1411
- * markdown.
1412
- *
1413
- * @returns {FromMarkdownExtension}
1414
- * Extension for `mdast-util-from-markdown` to enable GFM tables.
1415
- */
1416
- function gfmTableFromMarkdown() {
1417
- return {
1418
- enter: {
1419
- table: enterTable,
1420
- tableData: enterCell,
1421
- tableHeader: enterCell,
1422
- tableRow: enterRow
1423
- },
1424
- exit: {
1425
- codeText: exitCodeText,
1426
- table: exitTable,
1427
- tableData: exit,
1428
- tableHeader: exit,
1429
- tableRow: exit
1430
- }
1431
- };
1432
- }
1433
- /**
1434
- * @this {CompileContext}
1435
- * @type {FromMarkdownHandle}
1436
- */
1437
- function enterTable(token) {
1438
- const align = token._align;
1439
- this.enter({
1440
- type: "table",
1441
- align: align.map(function(d) {
1442
- return d === "none" ? null : d;
1443
- }),
1444
- children: []
1445
- }, token);
1446
- this.data.inTable = true;
1447
- }
1448
- /**
1449
- * @this {CompileContext}
1450
- * @type {FromMarkdownHandle}
1451
- */
1452
- function exitTable(token) {
1453
- this.exit(token);
1454
- this.data.inTable = void 0;
1455
- }
1456
- /**
1457
- * @this {CompileContext}
1458
- * @type {FromMarkdownHandle}
1459
- */
1460
- function enterRow(token) {
1461
- this.enter({
1462
- type: "tableRow",
1463
- children: []
1464
- }, token);
1465
- }
1466
- /**
1467
- * @this {CompileContext}
1468
- * @type {FromMarkdownHandle}
1469
- */
1470
- function exit(token) {
1471
- this.exit(token);
1472
- }
1473
- /**
1474
- * @this {CompileContext}
1475
- * @type {FromMarkdownHandle}
1476
- */
1477
- function enterCell(token) {
1478
- this.enter({
1479
- type: "tableCell",
1480
- children: []
1481
- }, token);
1482
- }
1483
- /**
1484
- * @this {CompileContext}
1485
- * @type {FromMarkdownHandle}
1486
- */
1487
- function exitCodeText(token) {
1488
- let value = this.resume();
1489
- if (this.data.inTable) value = value.replace(/\\([\\|])/g, replace);
1490
- const node = this.stack[this.stack.length - 1];
1491
- node.type;
1492
- node.value = value;
1493
- this.exit(token);
1494
- }
1495
- /**
1496
- * @param {string} $0
1497
- * @param {string} $1
1498
- * @returns {string}
1499
- */
1500
- function replace($0, $1) {
1501
- return $1 === "|" ? $1 : $0;
1502
- }
1503
- //#endregion
1504
- //#region ../../../node_modules/.pnpm/mdast-util-gfm-task-list-item@2.0.0_supports-color@9.4.0/node_modules/mdast-util-gfm-task-list-item/lib/index.js
1505
- /**
1506
- * @typedef {import('mdast').ListItem} ListItem
1507
- * @typedef {import('mdast').Paragraph} Paragraph
1508
- * @typedef {import('mdast-util-from-markdown').CompileContext} CompileContext
1509
- * @typedef {import('mdast-util-from-markdown').Extension} FromMarkdownExtension
1510
- * @typedef {import('mdast-util-from-markdown').Handle} FromMarkdownHandle
1511
- * @typedef {import('mdast-util-to-markdown').Options} ToMarkdownExtension
1512
- * @typedef {import('mdast-util-to-markdown').Handle} ToMarkdownHandle
1513
- */
1514
- /**
1515
- * Create an extension for `mdast-util-from-markdown` to enable GFM task
1516
- * list items in markdown.
1517
- *
1518
- * @returns {FromMarkdownExtension}
1519
- * Extension for `mdast-util-from-markdown` to enable GFM task list items.
1520
- */
1521
- function gfmTaskListItemFromMarkdown() {
1522
- return { exit: {
1523
- taskListCheckValueChecked: exitCheck,
1524
- taskListCheckValueUnchecked: exitCheck,
1525
- paragraph: exitParagraphWithTaskListItem
1526
- } };
1527
- }
1528
- /**
1529
- * @this {CompileContext}
1530
- * @type {FromMarkdownHandle}
1531
- */
1532
- function exitCheck(token) {
1533
- const node = this.stack[this.stack.length - 2];
1534
- node.type;
1535
- node.checked = token.type === "taskListCheckValueChecked";
1536
- }
1537
- /**
1538
- * @this {CompileContext}
1539
- * @type {FromMarkdownHandle}
1540
- */
1541
- function exitParagraphWithTaskListItem(token) {
1542
- const parent = this.stack[this.stack.length - 2];
1543
- if (parent && parent.type === "listItem" && typeof parent.checked === "boolean") {
1544
- const node = this.stack[this.stack.length - 1];
1545
- node.type;
1546
- const head = node.children[0];
1547
- if (head && head.type === "text") {
1548
- const siblings = parent.children;
1549
- let index = -1;
1550
- /** @type {Paragraph | undefined} */
1551
- let firstParaghraph;
1552
- while (++index < siblings.length) {
1553
- const sibling = siblings[index];
1554
- if (sibling.type === "paragraph") {
1555
- firstParaghraph = sibling;
1556
- break;
1557
- }
1558
- }
1559
- if (firstParaghraph === node) {
1560
- head.value = head.value.slice(1);
1561
- if (head.value.length === 0) node.children.shift();
1562
- else if (node.position && head.position && typeof head.position.start.offset === "number") {
1563
- head.position.start.column++;
1564
- head.position.start.offset++;
1565
- node.position.start = Object.assign({}, head.position.start);
1566
- }
1567
- }
1568
- }
1569
- }
1570
- this.exit(token);
1571
- }
1572
- //#endregion
1573
- //#region ../../../node_modules/.pnpm/mdast-util-gfm@3.1.0_supports-color@9.4.0/node_modules/mdast-util-gfm/lib/index.js
1574
- /**
1575
- * @import {Extension as FromMarkdownExtension} from 'mdast-util-from-markdown'
1576
- * @import {Options} from 'mdast-util-gfm'
1577
- * @import {Options as ToMarkdownExtension} from 'mdast-util-to-markdown'
1578
- */
1579
- /**
1580
- * Create an extension for `mdast-util-from-markdown` to enable GFM (autolink
1581
- * literals, footnotes, strikethrough, tables, tasklists).
1582
- *
1583
- * @returns {Array<FromMarkdownExtension>}
1584
- * Extension for `mdast-util-from-markdown` to enable GFM (autolink literals,
1585
- * footnotes, strikethrough, tables, tasklists).
1586
- */
1587
- function gfmFromMarkdown() {
1588
- return [
1589
- gfmAutolinkLiteralFromMarkdown(),
1590
- gfmFootnoteFromMarkdown(),
1591
- gfmStrikethroughFromMarkdown(),
1592
- gfmTableFromMarkdown(),
1593
- gfmTaskListItemFromMarkdown()
1594
- ];
1595
- }
1596
- //#endregion
1597
- //#region ../../../node_modules/.pnpm/micromark-util-chunked@2.0.1/node_modules/micromark-util-chunked/index.js
1598
- /**
1599
- * Like `Array#splice`, but smarter for giant arrays.
1600
- *
1601
- * `Array#splice` takes all items to be inserted as individual argument which
1602
- * causes a stack overflow in V8 when trying to insert 100k items for instance.
1603
- *
1604
- * Otherwise, this does not return the removed items, and takes `items` as an
1605
- * array instead of rest parameters.
1606
- *
1607
- * @template {unknown} T
1608
- * Item type.
1609
- * @param {Array<T>} list
1610
- * List to operate on.
1611
- * @param {number} start
1612
- * Index to remove/insert at (can be negative).
1613
- * @param {number} remove
1614
- * Number of items to remove.
1615
- * @param {Array<T>} items
1616
- * Items to inject into `list`.
1617
- * @returns {undefined}
1618
- * Nothing.
1619
- */
1620
- function splice(list, start, remove, items) {
1621
- const end = list.length;
1622
- let chunkStart = 0;
1623
- /** @type {Array<unknown>} */
1624
- let parameters;
1625
- if (start < 0) start = -start > end ? 0 : end + start;
1626
- else start = start > end ? end : start;
1627
- remove = remove > 0 ? remove : 0;
1628
- if (items.length < 1e4) {
1629
- parameters = Array.from(items);
1630
- parameters.unshift(start, remove);
1631
- list.splice(...parameters);
1632
- } else {
1633
- if (remove) list.splice(start, remove);
1634
- while (chunkStart < items.length) {
1635
- parameters = items.slice(chunkStart, chunkStart + 1e4);
1636
- parameters.unshift(start, 0);
1637
- list.splice(...parameters);
1638
- chunkStart += 1e4;
1639
- start += 1e4;
1640
- }
1641
- }
1642
- }
1643
- //#endregion
1644
- //#region ../../../node_modules/.pnpm/micromark-util-combine-extensions@2.0.1/node_modules/micromark-util-combine-extensions/index.js
1645
- /**
1646
- * @import {
1647
- * Extension,
1648
- * Handles,
1649
- * HtmlExtension,
1650
- * NormalizedExtension
1651
- * } from 'micromark-util-types'
1652
- */
1653
- const hasOwnProperty = {}.hasOwnProperty;
1654
- /**
1655
- * Combine multiple syntax extensions into one.
1656
- *
1657
- * @param {ReadonlyArray<Extension>} extensions
1658
- * List of syntax extensions.
1659
- * @returns {NormalizedExtension}
1660
- * A single combined extension.
1661
- */
1662
- function combineExtensions(extensions) {
1663
- /** @type {NormalizedExtension} */
1664
- const all = {};
1665
- let index = -1;
1666
- while (++index < extensions.length) syntaxExtension(all, extensions[index]);
1667
- return all;
1668
- }
1669
- /**
1670
- * Merge `extension` into `all`.
1671
- *
1672
- * @param {NormalizedExtension} all
1673
- * Extension to merge into.
1674
- * @param {Extension} extension
1675
- * Extension to merge.
1676
- * @returns {undefined}
1677
- * Nothing.
1678
- */
1679
- function syntaxExtension(all, extension) {
1680
- /** @type {keyof Extension} */
1681
- let hook;
1682
- for (hook in extension) {
1683
- /** @type {Record<string, unknown>} */
1684
- const left = (hasOwnProperty.call(all, hook) ? all[hook] : void 0) || (all[hook] = {});
1685
- /** @type {Record<string, unknown> | undefined} */
1686
- const right = extension[hook];
1687
- /** @type {string} */
1688
- let code;
1689
- if (right) for (code in right) {
1690
- if (!hasOwnProperty.call(left, code)) left[code] = [];
1691
- const value = right[code];
1692
- constructs(left[code], Array.isArray(value) ? value : value ? [value] : []);
1693
- }
1694
- }
1695
- }
1696
- /**
1697
- * Merge `list` into `existing` (both lists of constructs).
1698
- * Mutates `existing`.
1699
- *
1700
- * @param {Array<unknown>} existing
1701
- * List of constructs to merge into.
1702
- * @param {Array<unknown>} list
1703
- * List of constructs to merge.
1704
- * @returns {undefined}
1705
- * Nothing.
1706
- */
1707
- function constructs(existing, list) {
1708
- let index = -1;
1709
- /** @type {Array<unknown>} */
1710
- const before = [];
1711
- while (++index < list.length) (list[index].add === "after" ? existing : before).push(list[index]);
1712
- splice(existing, 0, 0, before);
1713
- }
1714
- //#endregion
1715
- //#region ../../../node_modules/.pnpm/micromark-extension-gfm-autolink-literal@2.1.0/node_modules/micromark-extension-gfm-autolink-literal/lib/syntax.js
1716
- /**
1717
- * @import {Code, ConstructRecord, Event, Extension, Previous, State, TokenizeContext, Tokenizer} from 'micromark-util-types'
1718
- */
1719
- const wwwPrefix = {
1720
- tokenize: tokenizeWwwPrefix,
1721
- partial: true
1722
- };
1723
- const domain = {
1724
- tokenize: tokenizeDomain,
1725
- partial: true
1726
- };
1727
- const path = {
1728
- tokenize: tokenizePath,
1729
- partial: true
1730
- };
1731
- const trail = {
1732
- tokenize: tokenizeTrail,
1733
- partial: true
1734
- };
1735
- const emailDomainDotTrail = {
1736
- tokenize: tokenizeEmailDomainDotTrail,
1737
- partial: true
1738
- };
1739
- const wwwAutolink = {
1740
- name: "wwwAutolink",
1741
- tokenize: tokenizeWwwAutolink,
1742
- previous: previousWww
1743
- };
1744
- const protocolAutolink = {
1745
- name: "protocolAutolink",
1746
- tokenize: tokenizeProtocolAutolink,
1747
- previous: previousProtocol
1748
- };
1749
- const emailAutolink = {
1750
- name: "emailAutolink",
1751
- tokenize: tokenizeEmailAutolink,
1752
- previous: previousEmail
1753
- };
1754
- /** @type {ConstructRecord} */
1755
- const text = {};
1756
- /**
1757
- * Create an extension for `micromark` to support GitHub autolink literal
1758
- * syntax.
1759
- *
1760
- * @returns {Extension}
1761
- * Extension for `micromark` that can be passed in `extensions` to enable GFM
1762
- * autolink literal syntax.
1763
- */
1764
- function gfmAutolinkLiteral() {
1765
- return { text };
1766
- }
1767
- /** @type {Code} */
1768
- let code = 48;
1769
- while (code < 123) {
1770
- text[code] = emailAutolink;
1771
- code++;
1772
- if (code === 58) code = 65;
1773
- else if (code === 91) code = 97;
1774
- }
1775
- text[43] = emailAutolink;
1776
- text[45] = emailAutolink;
1777
- text[46] = emailAutolink;
1778
- text[95] = emailAutolink;
1779
- text[72] = [emailAutolink, protocolAutolink];
1780
- text[104] = [emailAutolink, protocolAutolink];
1781
- text[87] = [emailAutolink, wwwAutolink];
1782
- text[119] = [emailAutolink, wwwAutolink];
1783
- /**
1784
- * Email autolink literal.
1785
- *
1786
- * ```markdown
1787
- * > | a contact@example.org b
1788
- * ^^^^^^^^^^^^^^^^^^^
1789
- * ```
1790
- *
1791
- * @this {TokenizeContext}
1792
- * @type {Tokenizer}
1793
- */
1794
- function tokenizeEmailAutolink(effects, ok, nok) {
1795
- const self = this;
1796
- /** @type {boolean | undefined} */
1797
- let dot;
1798
- /** @type {boolean} */
1799
- let data;
1800
- return start;
1801
- /**
1802
- * Start of email autolink literal.
1803
- *
1804
- * ```markdown
1805
- * > | a contact@example.org b
1806
- * ^
1807
- * ```
1808
- *
1809
- * @type {State}
1810
- */
1811
- function start(code) {
1812
- if (!gfmAtext(code) || !previousEmail.call(self, self.previous) || previousUnbalanced(self.events)) return nok(code);
1813
- effects.enter("literalAutolink");
1814
- effects.enter("literalAutolinkEmail");
1815
- return atext(code);
1816
- }
1817
- /**
1818
- * In email atext.
1819
- *
1820
- * ```markdown
1821
- * > | a contact@example.org b
1822
- * ^
1823
- * ```
1824
- *
1825
- * @type {State}
1826
- */
1827
- function atext(code) {
1828
- if (gfmAtext(code)) {
1829
- effects.consume(code);
1830
- return atext;
1831
- }
1832
- if (code === 64) {
1833
- effects.consume(code);
1834
- return emailDomain;
1835
- }
1836
- return nok(code);
1837
- }
1838
- /**
1839
- * In email domain.
1840
- *
1841
- * The reference code is a bit overly complex as it handles the `@`, of which
1842
- * there may be just one.
1843
- * Source: <https://github.com/github/cmark-gfm/blob/ef1cfcb/extensions/autolink.c#L318>
1844
- *
1845
- * ```markdown
1846
- * > | a contact@example.org b
1847
- * ^
1848
- * ```
1849
- *
1850
- * @type {State}
1851
- */
1852
- function emailDomain(code) {
1853
- if (code === 46) return effects.check(emailDomainDotTrail, emailDomainAfter, emailDomainDot)(code);
1854
- if (code === 45 || code === 95 || asciiAlphanumeric(code)) {
1855
- data = true;
1856
- effects.consume(code);
1857
- return emailDomain;
1858
- }
1859
- return emailDomainAfter(code);
1860
- }
1861
- /**
1862
- * In email domain, on dot that is not a trail.
1863
- *
1864
- * ```markdown
1865
- * > | a contact@example.org b
1866
- * ^
1867
- * ```
1868
- *
1869
- * @type {State}
1870
- */
1871
- function emailDomainDot(code) {
1872
- effects.consume(code);
1873
- dot = true;
1874
- return emailDomain;
1875
- }
1876
- /**
1877
- * After email domain.
1878
- *
1879
- * ```markdown
1880
- * > | a contact@example.org b
1881
- * ^
1882
- * ```
1883
- *
1884
- * @type {State}
1885
- */
1886
- function emailDomainAfter(code) {
1887
- if (data && dot && asciiAlpha(self.previous)) {
1888
- effects.exit("literalAutolinkEmail");
1889
- effects.exit("literalAutolink");
1890
- return ok(code);
1891
- }
1892
- return nok(code);
1893
- }
1894
- }
1895
- /**
1896
- * `www` autolink literal.
1897
- *
1898
- * ```markdown
1899
- * > | a www.example.org b
1900
- * ^^^^^^^^^^^^^^^
1901
- * ```
1902
- *
1903
- * @this {TokenizeContext}
1904
- * @type {Tokenizer}
1905
- */
1906
- function tokenizeWwwAutolink(effects, ok, nok) {
1907
- const self = this;
1908
- return wwwStart;
1909
- /**
1910
- * Start of www autolink literal.
1911
- *
1912
- * ```markdown
1913
- * > | www.example.com/a?b#c
1914
- * ^
1915
- * ```
1916
- *
1917
- * @type {State}
1918
- */
1919
- function wwwStart(code) {
1920
- if (code !== 87 && code !== 119 || !previousWww.call(self, self.previous) || previousUnbalanced(self.events)) return nok(code);
1921
- effects.enter("literalAutolink");
1922
- effects.enter("literalAutolinkWww");
1923
- return effects.check(wwwPrefix, effects.attempt(domain, effects.attempt(path, wwwAfter), nok), nok)(code);
1924
- }
1925
- /**
1926
- * After a www autolink literal.
1927
- *
1928
- * ```markdown
1929
- * > | www.example.com/a?b#c
1930
- * ^
1931
- * ```
1932
- *
1933
- * @type {State}
1934
- */
1935
- function wwwAfter(code) {
1936
- effects.exit("literalAutolinkWww");
1937
- effects.exit("literalAutolink");
1938
- return ok(code);
1939
- }
1940
- }
1941
- /**
1942
- * Protocol autolink literal.
1943
- *
1944
- * ```markdown
1945
- * > | a https://example.org b
1946
- * ^^^^^^^^^^^^^^^^^^^
1947
- * ```
1948
- *
1949
- * @this {TokenizeContext}
1950
- * @type {Tokenizer}
1951
- */
1952
- function tokenizeProtocolAutolink(effects, ok, nok) {
1953
- const self = this;
1954
- let buffer = "";
1955
- let seen = false;
1956
- return protocolStart;
1957
- /**
1958
- * Start of protocol autolink literal.
1959
- *
1960
- * ```markdown
1961
- * > | https://example.com/a?b#c
1962
- * ^
1963
- * ```
1964
- *
1965
- * @type {State}
1966
- */
1967
- function protocolStart(code) {
1968
- if ((code === 72 || code === 104) && previousProtocol.call(self, self.previous) && !previousUnbalanced(self.events)) {
1969
- effects.enter("literalAutolink");
1970
- effects.enter("literalAutolinkHttp");
1971
- buffer += String.fromCodePoint(code);
1972
- effects.consume(code);
1973
- return protocolPrefixInside;
1974
- }
1975
- return nok(code);
1976
- }
1977
- /**
1978
- * In protocol.
1979
- *
1980
- * ```markdown
1981
- * > | https://example.com/a?b#c
1982
- * ^^^^^
1983
- * ```
1984
- *
1985
- * @type {State}
1986
- */
1987
- function protocolPrefixInside(code) {
1988
- if (asciiAlpha(code) && buffer.length < 5) {
1989
- buffer += String.fromCodePoint(code);
1990
- effects.consume(code);
1991
- return protocolPrefixInside;
1992
- }
1993
- if (code === 58) {
1994
- const protocol = buffer.toLowerCase();
1995
- if (protocol === "http" || protocol === "https") {
1996
- effects.consume(code);
1997
- return protocolSlashesInside;
1998
- }
1999
- }
2000
- return nok(code);
2001
- }
2002
- /**
2003
- * In slashes.
2004
- *
2005
- * ```markdown
2006
- * > | https://example.com/a?b#c
2007
- * ^^
2008
- * ```
2009
- *
2010
- * @type {State}
2011
- */
2012
- function protocolSlashesInside(code) {
2013
- if (code === 47) {
2014
- effects.consume(code);
2015
- if (seen) return afterProtocol;
2016
- seen = true;
2017
- return protocolSlashesInside;
2018
- }
2019
- return nok(code);
2020
- }
2021
- /**
2022
- * After protocol, before domain.
2023
- *
2024
- * ```markdown
2025
- * > | https://example.com/a?b#c
2026
- * ^
2027
- * ```
2028
- *
2029
- * @type {State}
2030
- */
2031
- function afterProtocol(code) {
2032
- return code === null || asciiControl(code) || markdownLineEndingOrSpace(code) || unicodeWhitespace(code) || unicodePunctuation(code) ? nok(code) : effects.attempt(domain, effects.attempt(path, protocolAfter), nok)(code);
2033
- }
2034
- /**
2035
- * After a protocol autolink literal.
2036
- *
2037
- * ```markdown
2038
- * > | https://example.com/a?b#c
2039
- * ^
2040
- * ```
2041
- *
2042
- * @type {State}
2043
- */
2044
- function protocolAfter(code) {
2045
- effects.exit("literalAutolinkHttp");
2046
- effects.exit("literalAutolink");
2047
- return ok(code);
2048
- }
2049
- }
2050
- /**
2051
- * `www` prefix.
2052
- *
2053
- * ```markdown
2054
- * > | a www.example.org b
2055
- * ^^^^
2056
- * ```
2057
- *
2058
- * @this {TokenizeContext}
2059
- * @type {Tokenizer}
2060
- */
2061
- function tokenizeWwwPrefix(effects, ok, nok) {
2062
- let size = 0;
2063
- return wwwPrefixInside;
2064
- /**
2065
- * In www prefix.
2066
- *
2067
- * ```markdown
2068
- * > | www.example.com
2069
- * ^^^^
2070
- * ```
2071
- *
2072
- * @type {State}
2073
- */
2074
- function wwwPrefixInside(code) {
2075
- if ((code === 87 || code === 119) && size < 3) {
2076
- size++;
2077
- effects.consume(code);
2078
- return wwwPrefixInside;
2079
- }
2080
- if (code === 46 && size === 3) {
2081
- effects.consume(code);
2082
- return wwwPrefixAfter;
2083
- }
2084
- return nok(code);
2085
- }
2086
- /**
2087
- * After www prefix.
2088
- *
2089
- * ```markdown
2090
- * > | www.example.com
2091
- * ^
2092
- * ```
2093
- *
2094
- * @type {State}
2095
- */
2096
- function wwwPrefixAfter(code) {
2097
- return code === null ? nok(code) : ok(code);
2098
- }
2099
- }
2100
- /**
2101
- * Domain.
2102
- *
2103
- * ```markdown
2104
- * > | a https://example.org b
2105
- * ^^^^^^^^^^^
2106
- * ```
2107
- *
2108
- * @this {TokenizeContext}
2109
- * @type {Tokenizer}
2110
- */
2111
- function tokenizeDomain(effects, ok, nok) {
2112
- /** @type {boolean | undefined} */
2113
- let underscoreInLastSegment;
2114
- /** @type {boolean | undefined} */
2115
- let underscoreInLastLastSegment;
2116
- /** @type {boolean | undefined} */
2117
- let seen;
2118
- return domainInside;
2119
- /**
2120
- * In domain.
2121
- *
2122
- * ```markdown
2123
- * > | https://example.com/a
2124
- * ^^^^^^^^^^^
2125
- * ```
2126
- *
2127
- * @type {State}
2128
- */
2129
- function domainInside(code) {
2130
- if (code === 46 || code === 95) return effects.check(trail, domainAfter, domainAtPunctuation)(code);
2131
- if (code === null || markdownLineEndingOrSpace(code) || unicodeWhitespace(code) || code !== 45 && unicodePunctuation(code)) return domainAfter(code);
2132
- seen = true;
2133
- effects.consume(code);
2134
- return domainInside;
2135
- }
2136
- /**
2137
- * In domain, at potential trailing punctuation, that was not trailing.
2138
- *
2139
- * ```markdown
2140
- * > | https://example.com
2141
- * ^
2142
- * ```
2143
- *
2144
- * @type {State}
2145
- */
2146
- function domainAtPunctuation(code) {
2147
- if (code === 95) underscoreInLastSegment = true;
2148
- else {
2149
- underscoreInLastLastSegment = underscoreInLastSegment;
2150
- underscoreInLastSegment = void 0;
2151
- }
2152
- effects.consume(code);
2153
- return domainInside;
2154
- }
2155
- /**
2156
- * After domain.
2157
- *
2158
- * ```markdown
2159
- * > | https://example.com/a
2160
- * ^
2161
- * ```
2162
- *
2163
- * @type {State} */
2164
- function domainAfter(code) {
2165
- if (underscoreInLastLastSegment || underscoreInLastSegment || !seen) return nok(code);
2166
- return ok(code);
2167
- }
2168
- }
2169
- /**
2170
- * Path.
2171
- *
2172
- * ```markdown
2173
- * > | a https://example.org/stuff b
2174
- * ^^^^^^
2175
- * ```
2176
- *
2177
- * @this {TokenizeContext}
2178
- * @type {Tokenizer}
2179
- */
2180
- function tokenizePath(effects, ok) {
2181
- let sizeOpen = 0;
2182
- let sizeClose = 0;
2183
- return pathInside;
2184
- /**
2185
- * In path.
2186
- *
2187
- * ```markdown
2188
- * > | https://example.com/a
2189
- * ^^
2190
- * ```
2191
- *
2192
- * @type {State}
2193
- */
2194
- function pathInside(code) {
2195
- if (code === 40) {
2196
- sizeOpen++;
2197
- effects.consume(code);
2198
- return pathInside;
2199
- }
2200
- if (code === 41 && sizeClose < sizeOpen) return pathAtPunctuation(code);
2201
- if (code === 33 || code === 34 || code === 38 || code === 39 || code === 41 || code === 42 || code === 44 || code === 46 || code === 58 || code === 59 || code === 60 || code === 63 || code === 93 || code === 95 || code === 126) return effects.check(trail, ok, pathAtPunctuation)(code);
2202
- if (code === null || markdownLineEndingOrSpace(code) || unicodeWhitespace(code)) return ok(code);
2203
- effects.consume(code);
2204
- return pathInside;
2205
- }
2206
- /**
2207
- * In path, at potential trailing punctuation, that was not trailing.
2208
- *
2209
- * ```markdown
2210
- * > | https://example.com/a"b
2211
- * ^
2212
- * ```
2213
- *
2214
- * @type {State}
2215
- */
2216
- function pathAtPunctuation(code) {
2217
- if (code === 41) sizeClose++;
2218
- effects.consume(code);
2219
- return pathInside;
2220
- }
2221
- }
2222
- /**
2223
- * Trail.
2224
- *
2225
- * This calls `ok` if this *is* the trail, followed by an end, which means
2226
- * the entire trail is not part of the link.
2227
- * It calls `nok` if this *is* part of the link.
2228
- *
2229
- * ```markdown
2230
- * > | https://example.com").
2231
- * ^^^
2232
- * ```
2233
- *
2234
- * @this {TokenizeContext}
2235
- * @type {Tokenizer}
2236
- */
2237
- function tokenizeTrail(effects, ok, nok) {
2238
- return trail;
2239
- /**
2240
- * In trail of domain or path.
2241
- *
2242
- * ```markdown
2243
- * > | https://example.com").
2244
- * ^
2245
- * ```
2246
- *
2247
- * @type {State}
2248
- */
2249
- function trail(code) {
2250
- if (code === 33 || code === 34 || code === 39 || code === 41 || code === 42 || code === 44 || code === 46 || code === 58 || code === 59 || code === 63 || code === 95 || code === 126) {
2251
- effects.consume(code);
2252
- return trail;
2253
- }
2254
- if (code === 38) {
2255
- effects.consume(code);
2256
- return trailCharacterReferenceStart;
2257
- }
2258
- if (code === 93) {
2259
- effects.consume(code);
2260
- return trailBracketAfter;
2261
- }
2262
- if (code === 60 || code === null || markdownLineEndingOrSpace(code) || unicodeWhitespace(code)) return ok(code);
2263
- return nok(code);
2264
- }
2265
- /**
2266
- * In trail, after `]`.
2267
- *
2268
- * > 👉 **Note**: this deviates from `cmark-gfm` to fix a bug.
2269
- * > See end of <https://github.com/github/cmark-gfm/issues/278> for more.
2270
- *
2271
- * ```markdown
2272
- * > | https://example.com](
2273
- * ^
2274
- * ```
2275
- *
2276
- * @type {State}
2277
- */
2278
- function trailBracketAfter(code) {
2279
- if (code === null || code === 40 || code === 91 || markdownLineEndingOrSpace(code) || unicodeWhitespace(code)) return ok(code);
2280
- return trail(code);
2281
- }
2282
- /**
2283
- * In character-reference like trail, after `&`.
2284
- *
2285
- * ```markdown
2286
- * > | https://example.com&amp;).
2287
- * ^
2288
- * ```
2289
- *
2290
- * @type {State}
2291
- */
2292
- function trailCharacterReferenceStart(code) {
2293
- return asciiAlpha(code) ? trailCharacterReferenceInside(code) : nok(code);
2294
- }
2295
- /**
2296
- * In character-reference like trail.
2297
- *
2298
- * ```markdown
2299
- * > | https://example.com&amp;).
2300
- * ^
2301
- * ```
2302
- *
2303
- * @type {State}
2304
- */
2305
- function trailCharacterReferenceInside(code) {
2306
- if (code === 59) {
2307
- effects.consume(code);
2308
- return trail;
2309
- }
2310
- if (asciiAlpha(code)) {
2311
- effects.consume(code);
2312
- return trailCharacterReferenceInside;
2313
- }
2314
- return nok(code);
2315
- }
2316
- }
2317
- /**
2318
- * Dot in email domain trail.
2319
- *
2320
- * This calls `ok` if this *is* the trail, followed by an end, which means
2321
- * the trail is not part of the link.
2322
- * It calls `nok` if this *is* part of the link.
2323
- *
2324
- * ```markdown
2325
- * > | contact@example.org.
2326
- * ^
2327
- * ```
2328
- *
2329
- * @this {TokenizeContext}
2330
- * @type {Tokenizer}
2331
- */
2332
- function tokenizeEmailDomainDotTrail(effects, ok, nok) {
2333
- return start;
2334
- /**
2335
- * Dot.
2336
- *
2337
- * ```markdown
2338
- * > | contact@example.org.
2339
- * ^ ^
2340
- * ```
2341
- *
2342
- * @type {State}
2343
- */
2344
- function start(code) {
2345
- effects.consume(code);
2346
- return after;
2347
- }
2348
- /**
2349
- * After dot.
2350
- *
2351
- * ```markdown
2352
- * > | contact@example.org.
2353
- * ^ ^
2354
- * ```
2355
- *
2356
- * @type {State}
2357
- */
2358
- function after(code) {
2359
- return asciiAlphanumeric(code) ? nok(code) : ok(code);
2360
- }
2361
- }
2362
- /**
2363
- * See:
2364
- * <https://github.com/github/cmark-gfm/blob/ef1cfcb/extensions/autolink.c#L156>.
2365
- *
2366
- * @type {Previous}
2367
- */
2368
- function previousWww(code) {
2369
- return code === null || code === 40 || code === 42 || code === 95 || code === 91 || code === 93 || code === 126 || markdownLineEndingOrSpace(code);
2370
- }
2371
- /**
2372
- * See:
2373
- * <https://github.com/github/cmark-gfm/blob/ef1cfcb/extensions/autolink.c#L214>.
2374
- *
2375
- * @type {Previous}
2376
- */
2377
- function previousProtocol(code) {
2378
- return !asciiAlpha(code);
2379
- }
2380
- /**
2381
- * @this {TokenizeContext}
2382
- * @type {Previous}
2383
- */
2384
- function previousEmail(code) {
2385
- return !(code === 47 || gfmAtext(code));
2386
- }
2387
- /**
2388
- * @param {Code} code
2389
- * @returns {boolean}
2390
- */
2391
- function gfmAtext(code) {
2392
- return code === 43 || code === 45 || code === 46 || code === 95 || asciiAlphanumeric(code);
2393
- }
2394
- /**
2395
- * @param {Array<Event>} events
2396
- * @returns {boolean}
2397
- */
2398
- function previousUnbalanced(events) {
2399
- let index = events.length;
2400
- let result = false;
2401
- while (index--) {
2402
- const token = events[index][1];
2403
- if ((token.type === "labelLink" || token.type === "labelImage") && !token._balanced) {
2404
- result = true;
2405
- break;
2406
- }
2407
- if (token._gfmAutolinkLiteralWalkedInto) {
2408
- result = false;
2409
- break;
2410
- }
2411
- }
2412
- if (events.length > 0 && !result) events[events.length - 1][1]._gfmAutolinkLiteralWalkedInto = true;
2413
- return result;
2414
- }
2415
- //#endregion
2416
- //#region ../../../node_modules/.pnpm/micromark-util-resolve-all@2.0.1/node_modules/micromark-util-resolve-all/index.js
2417
- /**
2418
- * @import {Event, Resolver, TokenizeContext} from 'micromark-util-types'
2419
- */
2420
- /**
2421
- * Call all `resolveAll`s.
2422
- *
2423
- * @param {ReadonlyArray<{resolveAll?: Resolver | undefined}>} constructs
2424
- * List of constructs, optionally with `resolveAll`s.
2425
- * @param {Array<Event>} events
2426
- * List of events.
2427
- * @param {TokenizeContext} context
2428
- * Context used by `tokenize`.
2429
- * @returns {Array<Event>}
2430
- * Changed events.
2431
- */
2432
- function resolveAll(constructs, events, context) {
2433
- /** @type {Array<Resolver>} */
2434
- const called = [];
2435
- let index = -1;
2436
- while (++index < constructs.length) {
2437
- const resolve = constructs[index].resolveAll;
2438
- if (resolve && !called.includes(resolve)) {
2439
- events = resolve(events, context);
2440
- called.push(resolve);
2441
- }
2442
- }
2443
- return events;
2444
- }
2445
- //#endregion
2446
- //#region ../../../node_modules/.pnpm/micromark-factory-space@2.1.0/node_modules/micromark-factory-space/index.js
2447
- /**
2448
- * @import {Effects, State, TokenType} from 'micromark-util-types'
2449
- */
2450
- /**
2451
- * Parse spaces and tabs.
2452
- *
2453
- * There is no `nok` parameter:
2454
- *
2455
- * * spaces in markdown are often optional, in which case this factory can be
2456
- * used and `ok` will be switched to whether spaces were found or not
2457
- * * one line ending or space can be detected with `markdownSpace(code)` right
2458
- * before using `factorySpace`
2459
- *
2460
- * ###### Examples
2461
- *
2462
- * Where `␉` represents a tab (plus how much it expands) and `␠` represents a
2463
- * single space.
2464
- *
2465
- * ```markdown
2466
- * ␉
2467
- * ␠␠␠␠
2468
- * ␉␠
2469
- * ```
2470
- *
2471
- * @param {Effects} effects
2472
- * Context.
2473
- * @param {State} ok
2474
- * State switched to when successful.
2475
- * @param {TokenType} type
2476
- * Type of the whole whitespace.
2477
- * @param {number | undefined} [max=Infinity]
2478
- * Max (exclusive).
2479
- * @returns {State}
2480
- * Start state.
2481
- */
2482
- function factorySpace(effects, ok, type, max) {
2483
- const limit = max ? max - 1 : Infinity;
2484
- let size = 0;
2485
- return start;
2486
- /** @type {State} */
2487
- function start(code) {
2488
- if (markdownSpace(code)) {
2489
- effects.enter(type);
2490
- return prefix(code);
2491
- }
2492
- return ok(code);
2493
- }
2494
- /** @type {State} */
2495
- function prefix(code) {
2496
- if (markdownSpace(code) && size++ < limit) {
2497
- effects.consume(code);
2498
- return prefix;
2499
- }
2500
- effects.exit(type);
2501
- return ok(code);
2502
- }
2503
- }
2504
- //#endregion
2505
- //#region ../../../node_modules/.pnpm/micromark-core-commonmark@2.0.4/node_modules/micromark-core-commonmark/lib/blank-line.js
2506
- /**
2507
- * @import {
2508
- * Construct,
2509
- * State,
2510
- * TokenizeContext,
2511
- * Tokenizer
2512
- * } from 'micromark-util-types'
2513
- */
2514
- /** @type {Construct} */
2515
- const blankLine = {
2516
- partial: true,
2517
- tokenize: tokenizeBlankLine
2518
- };
2519
- /**
2520
- * @this {TokenizeContext}
2521
- * Context.
2522
- * @type {Tokenizer}
2523
- */
2524
- function tokenizeBlankLine(effects, ok, nok) {
2525
- return start;
2526
- /**
2527
- * Start of blank line.
2528
- *
2529
- * > 👉 **Note**: `␠` represents a space character.
2530
- *
2531
- * ```markdown
2532
- * > | ␠␠␊
2533
- * ^
2534
- * > | ␊
2535
- * ^
2536
- * ```
2537
- *
2538
- * @type {State}
2539
- */
2540
- function start(code) {
2541
- return markdownSpace(code) ? factorySpace(effects, after, "linePrefix")(code) : after(code);
2542
- }
2543
- /**
2544
- * At eof/eol, after optional whitespace.
2545
- *
2546
- * > 👉 **Note**: `␠` represents a space character.
2547
- *
2548
- * ```markdown
2549
- * > | ␠␠␊
2550
- * ^
2551
- * > | ␊
2552
- * ^
2553
- * ```
2554
- *
2555
- * @type {State}
2556
- */
2557
- function after(code) {
2558
- return code === null || markdownLineEnding(code) ? ok(code) : nok(code);
2559
- }
2560
- }
2561
- //#endregion
2562
- //#region ../../../node_modules/.pnpm/micromark-extension-gfm-footnote@2.1.0/node_modules/micromark-extension-gfm-footnote/lib/syntax.js
2563
- /**
2564
- * @import {Event, Exiter, Extension, Resolver, State, Token, TokenizeContext, Tokenizer} from 'micromark-util-types'
2565
- */
2566
- const indent = {
2567
- tokenize: tokenizeIndent,
2568
- partial: true
2569
- };
2570
- /**
2571
- * Create an extension for `micromark` to enable GFM footnote syntax.
2572
- *
2573
- * @returns {Extension}
2574
- * Extension for `micromark` that can be passed in `extensions` to
2575
- * enable GFM footnote syntax.
2576
- */
2577
- function gfmFootnote() {
2578
- /** @type {Extension} */
2579
- return {
2580
- document: { [91]: {
2581
- name: "gfmFootnoteDefinition",
2582
- tokenize: tokenizeDefinitionStart,
2583
- continuation: { tokenize: tokenizeDefinitionContinuation },
2584
- exit: gfmFootnoteDefinitionEnd
2585
- } },
2586
- text: {
2587
- [91]: {
2588
- name: "gfmFootnoteCall",
2589
- tokenize: tokenizeGfmFootnoteCall
2590
- },
2591
- [93]: {
2592
- name: "gfmPotentialFootnoteCall",
2593
- add: "after",
2594
- tokenize: tokenizePotentialGfmFootnoteCall,
2595
- resolveTo: resolveToPotentialGfmFootnoteCall
2596
- }
2597
- }
2598
- };
2599
- }
2600
- /**
2601
- * @this {TokenizeContext}
2602
- * @type {Tokenizer}
2603
- */
2604
- function tokenizePotentialGfmFootnoteCall(effects, ok, nok) {
2605
- const self = this;
2606
- let index = self.events.length;
2607
- const defined = self.parser.gfmFootnotes || (self.parser.gfmFootnotes = []);
2608
- /** @type {Token} */
2609
- let labelStart;
2610
- while (index--) {
2611
- const token = self.events[index][1];
2612
- if (token.type === "labelImage") {
2613
- labelStart = token;
2614
- break;
2615
- }
2616
- if (token.type === "gfmFootnoteCall" || token.type === "labelLink" || token.type === "label" || token.type === "image" || token.type === "link") break;
2617
- }
2618
- return start;
2619
- /**
2620
- * @type {State}
2621
- */
2622
- function start(code) {
2623
- if (!labelStart || !labelStart._balanced) return nok(code);
2624
- const id = normalizeIdentifier(self.sliceSerialize({
2625
- start: labelStart.end,
2626
- end: self.now()
2627
- }));
2628
- if (id.codePointAt(0) !== 94 || !defined.includes(id.slice(1))) return nok(code);
2629
- effects.enter("gfmFootnoteCallLabelMarker");
2630
- effects.consume(code);
2631
- effects.exit("gfmFootnoteCallLabelMarker");
2632
- return ok(code);
2633
- }
2634
- }
2635
- /** @type {Resolver} */
2636
- function resolveToPotentialGfmFootnoteCall(events, context) {
2637
- let index = events.length;
2638
- while (index--) if (events[index][1].type === "labelImage" && events[index][0] === "enter") {
2639
- events[index][1];
2640
- break;
2641
- }
2642
- events[index + 1][1].type = "data";
2643
- events[index + 3][1].type = "gfmFootnoteCallLabelMarker";
2644
- /** @type {Token} */
2645
- const call = {
2646
- type: "gfmFootnoteCall",
2647
- start: Object.assign({}, events[index + 3][1].start),
2648
- end: Object.assign({}, events[events.length - 1][1].end)
2649
- };
2650
- /** @type {Token} */
2651
- const marker = {
2652
- type: "gfmFootnoteCallMarker",
2653
- start: Object.assign({}, events[index + 3][1].end),
2654
- end: Object.assign({}, events[index + 3][1].end)
2655
- };
2656
- marker.end.column++;
2657
- marker.end.offset++;
2658
- marker.end._bufferIndex++;
2659
- /** @type {Token} */
2660
- const string = {
2661
- type: "gfmFootnoteCallString",
2662
- start: Object.assign({}, marker.end),
2663
- end: Object.assign({}, events[events.length - 1][1].start)
2664
- };
2665
- /** @type {Token} */
2666
- const chunk = {
2667
- type: "chunkString",
2668
- contentType: "string",
2669
- start: Object.assign({}, string.start),
2670
- end: Object.assign({}, string.end)
2671
- };
2672
- /** @type {Array<Event>} */
2673
- const replacement = [
2674
- events[index + 1],
2675
- events[index + 2],
2676
- [
2677
- "enter",
2678
- call,
2679
- context
2680
- ],
2681
- events[index + 3],
2682
- events[index + 4],
2683
- [
2684
- "enter",
2685
- marker,
2686
- context
2687
- ],
2688
- [
2689
- "exit",
2690
- marker,
2691
- context
2692
- ],
2693
- [
2694
- "enter",
2695
- string,
2696
- context
2697
- ],
2698
- [
2699
- "enter",
2700
- chunk,
2701
- context
2702
- ],
2703
- [
2704
- "exit",
2705
- chunk,
2706
- context
2707
- ],
2708
- [
2709
- "exit",
2710
- string,
2711
- context
2712
- ],
2713
- events[events.length - 2],
2714
- events[events.length - 1],
2715
- [
2716
- "exit",
2717
- call,
2718
- context
2719
- ]
2720
- ];
2721
- events.splice(index, events.length - index + 1, ...replacement);
2722
- return events;
2723
- }
2724
- /**
2725
- * @this {TokenizeContext}
2726
- * @type {Tokenizer}
2727
- */
2728
- function tokenizeGfmFootnoteCall(effects, ok, nok) {
2729
- const self = this;
2730
- const defined = self.parser.gfmFootnotes || (self.parser.gfmFootnotes = []);
2731
- let size = 0;
2732
- /** @type {boolean} */
2733
- let data;
2734
- return start;
2735
- /**
2736
- * Start of footnote label.
2737
- *
2738
- * ```markdown
2739
- * > | a [^b] c
2740
- * ^
2741
- * ```
2742
- *
2743
- * @type {State}
2744
- */
2745
- function start(code) {
2746
- effects.enter("gfmFootnoteCall");
2747
- effects.enter("gfmFootnoteCallLabelMarker");
2748
- effects.consume(code);
2749
- effects.exit("gfmFootnoteCallLabelMarker");
2750
- return callStart;
2751
- }
2752
- /**
2753
- * After `[`, at `^`.
2754
- *
2755
- * ```markdown
2756
- * > | a [^b] c
2757
- * ^
2758
- * ```
2759
- *
2760
- * @type {State}
2761
- */
2762
- function callStart(code) {
2763
- if (code !== 94) return nok(code);
2764
- effects.enter("gfmFootnoteCallMarker");
2765
- effects.consume(code);
2766
- effects.exit("gfmFootnoteCallMarker");
2767
- effects.enter("gfmFootnoteCallString");
2768
- effects.enter("chunkString").contentType = "string";
2769
- return callData;
2770
- }
2771
- /**
2772
- * In label.
2773
- *
2774
- * ```markdown
2775
- * > | a [^b] c
2776
- * ^
2777
- * ```
2778
- *
2779
- * @type {State}
2780
- */
2781
- function callData(code) {
2782
- if (size > 999 || code === 93 && !data || code === null || code === 91 || markdownLineEndingOrSpace(code)) return nok(code);
2783
- if (code === 93) {
2784
- effects.exit("chunkString");
2785
- const token = effects.exit("gfmFootnoteCallString");
2786
- if (!defined.includes(normalizeIdentifier(self.sliceSerialize(token)))) return nok(code);
2787
- effects.enter("gfmFootnoteCallLabelMarker");
2788
- effects.consume(code);
2789
- effects.exit("gfmFootnoteCallLabelMarker");
2790
- effects.exit("gfmFootnoteCall");
2791
- return ok;
2792
- }
2793
- if (!markdownLineEndingOrSpace(code)) data = true;
2794
- size++;
2795
- effects.consume(code);
2796
- return code === 92 ? callEscape : callData;
2797
- }
2798
- /**
2799
- * On character after escape.
2800
- *
2801
- * ```markdown
2802
- * > | a [^b\c] d
2803
- * ^
2804
- * ```
2805
- *
2806
- * @type {State}
2807
- */
2808
- function callEscape(code) {
2809
- if (code === 91 || code === 92 || code === 93) {
2810
- effects.consume(code);
2811
- size++;
2812
- return callData;
2813
- }
2814
- return callData(code);
2815
- }
2816
- }
2817
- /**
2818
- * @this {TokenizeContext}
2819
- * @type {Tokenizer}
2820
- */
2821
- function tokenizeDefinitionStart(effects, ok, nok) {
2822
- const self = this;
2823
- const defined = self.parser.gfmFootnotes || (self.parser.gfmFootnotes = []);
2824
- /** @type {string} */
2825
- let identifier;
2826
- let size = 0;
2827
- /** @type {boolean | undefined} */
2828
- let data;
2829
- return start;
2830
- /**
2831
- * Start of GFM footnote definition.
2832
- *
2833
- * ```markdown
2834
- * > | [^a]: b
2835
- * ^
2836
- * ```
2837
- *
2838
- * @type {State}
2839
- */
2840
- function start(code) {
2841
- effects.enter("gfmFootnoteDefinition")._container = true;
2842
- effects.enter("gfmFootnoteDefinitionLabel");
2843
- effects.enter("gfmFootnoteDefinitionLabelMarker");
2844
- effects.consume(code);
2845
- effects.exit("gfmFootnoteDefinitionLabelMarker");
2846
- return labelAtMarker;
2847
- }
2848
- /**
2849
- * In label, at caret.
2850
- *
2851
- * ```markdown
2852
- * > | [^a]: b
2853
- * ^
2854
- * ```
2855
- *
2856
- * @type {State}
2857
- */
2858
- function labelAtMarker(code) {
2859
- if (code === 94) {
2860
- effects.enter("gfmFootnoteDefinitionMarker");
2861
- effects.consume(code);
2862
- effects.exit("gfmFootnoteDefinitionMarker");
2863
- effects.enter("gfmFootnoteDefinitionLabelString");
2864
- effects.enter("chunkString").contentType = "string";
2865
- return labelInside;
2866
- }
2867
- return nok(code);
2868
- }
2869
- /**
2870
- * In label.
2871
- *
2872
- * > 👉 **Note**: `cmark-gfm` prevents whitespace from occurring in footnote
2873
- * > definition labels.
2874
- *
2875
- * ```markdown
2876
- * > | [^a]: b
2877
- * ^
2878
- * ```
2879
- *
2880
- * @type {State}
2881
- */
2882
- function labelInside(code) {
2883
- if (size > 999 || code === 93 && !data || code === null || code === 91 || markdownLineEndingOrSpace(code)) return nok(code);
2884
- if (code === 93) {
2885
- effects.exit("chunkString");
2886
- const token = effects.exit("gfmFootnoteDefinitionLabelString");
2887
- identifier = normalizeIdentifier(self.sliceSerialize(token));
2888
- effects.enter("gfmFootnoteDefinitionLabelMarker");
2889
- effects.consume(code);
2890
- effects.exit("gfmFootnoteDefinitionLabelMarker");
2891
- effects.exit("gfmFootnoteDefinitionLabel");
2892
- return labelAfter;
2893
- }
2894
- if (!markdownLineEndingOrSpace(code)) data = true;
2895
- size++;
2896
- effects.consume(code);
2897
- return code === 92 ? labelEscape : labelInside;
2898
- }
2899
- /**
2900
- * After `\`, at a special character.
2901
- *
2902
- * > 👉 **Note**: `cmark-gfm` currently does not support escaped brackets:
2903
- * > <https://github.com/github/cmark-gfm/issues/240>
2904
- *
2905
- * ```markdown
2906
- * > | [^a\*b]: c
2907
- * ^
2908
- * ```
2909
- *
2910
- * @type {State}
2911
- */
2912
- function labelEscape(code) {
2913
- if (code === 91 || code === 92 || code === 93) {
2914
- effects.consume(code);
2915
- size++;
2916
- return labelInside;
2917
- }
2918
- return labelInside(code);
2919
- }
2920
- /**
2921
- * After definition label.
2922
- *
2923
- * ```markdown
2924
- * > | [^a]: b
2925
- * ^
2926
- * ```
2927
- *
2928
- * @type {State}
2929
- */
2930
- function labelAfter(code) {
2931
- if (code === 58) {
2932
- effects.enter("definitionMarker");
2933
- effects.consume(code);
2934
- effects.exit("definitionMarker");
2935
- if (!defined.includes(identifier)) defined.push(identifier);
2936
- return factorySpace(effects, whitespaceAfter, "gfmFootnoteDefinitionWhitespace");
2937
- }
2938
- return nok(code);
2939
- }
2940
- /**
2941
- * After definition prefix.
2942
- *
2943
- * ```markdown
2944
- * > | [^a]: b
2945
- * ^
2946
- * ```
2947
- *
2948
- * @type {State}
2949
- */
2950
- function whitespaceAfter(code) {
2951
- return ok(code);
2952
- }
2953
- }
2954
- /**
2955
- * @this {TokenizeContext}
2956
- * @type {Tokenizer}
2957
- */
2958
- function tokenizeDefinitionContinuation(effects, ok, nok) {
2959
- return effects.check(blankLine, ok, effects.attempt(indent, ok, nok));
2960
- }
2961
- /** @type {Exiter} */
2962
- function gfmFootnoteDefinitionEnd(effects) {
2963
- effects.exit("gfmFootnoteDefinition");
2964
- }
2965
- /**
2966
- * @this {TokenizeContext}
2967
- * @type {Tokenizer}
2968
- */
2969
- function tokenizeIndent(effects, ok, nok) {
2970
- const self = this;
2971
- return factorySpace(effects, afterPrefix, "gfmFootnoteDefinitionIndent", 5);
2972
- /**
2973
- * @type {State}
2974
- */
2975
- function afterPrefix(code) {
2976
- const tail = self.events[self.events.length - 1];
2977
- return tail && tail[1].type === "gfmFootnoteDefinitionIndent" && tail[2].sliceSerialize(tail[1], true).length === 4 ? ok(code) : nok(code);
2978
- }
2979
- }
2980
- //#endregion
2981
- //#region ../../../node_modules/.pnpm/micromark-extension-gfm-strikethrough@2.1.0/node_modules/micromark-extension-gfm-strikethrough/lib/syntax.js
2982
- /**
2983
- * @import {Options} from 'micromark-extension-gfm-strikethrough'
2984
- * @import {Event, Extension, Resolver, State, Token, TokenizeContext, Tokenizer} from 'micromark-util-types'
2985
- */
2986
- /**
2987
- * Create an extension for `micromark` to enable GFM strikethrough syntax.
2988
- *
2989
- * @param {Options | null | undefined} [options={}]
2990
- * Configuration.
2991
- * @returns {Extension}
2992
- * Extension for `micromark` that can be passed in `extensions`, to
2993
- * enable GFM strikethrough syntax.
2994
- */
2995
- function gfmStrikethrough(options) {
2996
- let single = (options || {}).singleTilde;
2997
- const tokenizer = {
2998
- name: "strikethrough",
2999
- tokenize: tokenizeStrikethrough,
3000
- resolveAll: resolveAllStrikethrough
3001
- };
3002
- if (single === null || single === void 0) single = true;
3003
- return {
3004
- text: { [126]: tokenizer },
3005
- insideSpan: { null: [tokenizer] },
3006
- attentionMarkers: { null: [126] }
3007
- };
3008
- /**
3009
- * Take events and resolve strikethrough.
3010
- *
3011
- * @type {Resolver}
3012
- */
3013
- function resolveAllStrikethrough(events, context) {
3014
- let index = -1;
3015
- while (++index < events.length) if (events[index][0] === "enter" && events[index][1].type === "strikethroughSequenceTemporary" && events[index][1]._close) {
3016
- let open = index;
3017
- while (open--) if (events[open][0] === "exit" && events[open][1].type === "strikethroughSequenceTemporary" && events[open][1]._open && events[index][1].end.offset - events[index][1].start.offset === events[open][1].end.offset - events[open][1].start.offset) {
3018
- events[index][1].type = "strikethroughSequence";
3019
- events[open][1].type = "strikethroughSequence";
3020
- /** @type {Token} */
3021
- const strikethrough = {
3022
- type: "strikethrough",
3023
- start: Object.assign({}, events[open][1].start),
3024
- end: Object.assign({}, events[index][1].end)
3025
- };
3026
- /** @type {Token} */
3027
- const text = {
3028
- type: "strikethroughText",
3029
- start: Object.assign({}, events[open][1].end),
3030
- end: Object.assign({}, events[index][1].start)
3031
- };
3032
- /** @type {Array<Event>} */
3033
- const nextEvents = [
3034
- [
3035
- "enter",
3036
- strikethrough,
3037
- context
3038
- ],
3039
- [
3040
- "enter",
3041
- events[open][1],
3042
- context
3043
- ],
3044
- [
3045
- "exit",
3046
- events[open][1],
3047
- context
3048
- ],
3049
- [
3050
- "enter",
3051
- text,
3052
- context
3053
- ]
3054
- ];
3055
- const insideSpan = context.parser.constructs.insideSpan.null;
3056
- if (insideSpan) splice(nextEvents, nextEvents.length, 0, resolveAll(insideSpan, events.slice(open + 1, index), context));
3057
- splice(nextEvents, nextEvents.length, 0, [
3058
- [
3059
- "exit",
3060
- text,
3061
- context
3062
- ],
3063
- [
3064
- "enter",
3065
- events[index][1],
3066
- context
3067
- ],
3068
- [
3069
- "exit",
3070
- events[index][1],
3071
- context
3072
- ],
3073
- [
3074
- "exit",
3075
- strikethrough,
3076
- context
3077
- ]
3078
- ]);
3079
- splice(events, open - 1, index - open + 3, nextEvents);
3080
- index = open + nextEvents.length - 2;
3081
- break;
3082
- }
3083
- }
3084
- index = -1;
3085
- while (++index < events.length) if (events[index][1].type === "strikethroughSequenceTemporary") events[index][1].type = "data";
3086
- return events;
3087
- }
3088
- /**
3089
- * @this {TokenizeContext}
3090
- * @type {Tokenizer}
3091
- */
3092
- function tokenizeStrikethrough(effects, ok, nok) {
3093
- const previous = this.previous;
3094
- const events = this.events;
3095
- let size = 0;
3096
- return start;
3097
- /** @type {State} */
3098
- function start(code) {
3099
- if (previous === 126 && events[events.length - 1][1].type !== "characterEscape") return nok(code);
3100
- effects.enter("strikethroughSequenceTemporary");
3101
- return more(code);
3102
- }
3103
- /** @type {State} */
3104
- function more(code) {
3105
- const before = classifyCharacter(previous);
3106
- if (code === 126) {
3107
- if (size > 1) return nok(code);
3108
- effects.consume(code);
3109
- size++;
3110
- return more;
3111
- }
3112
- if (size < 2 && !single) return nok(code);
3113
- const token = effects.exit("strikethroughSequenceTemporary");
3114
- const after = classifyCharacter(code);
3115
- token._open = !after || after === 2 && Boolean(before);
3116
- token._close = !before || before === 2 && Boolean(after);
3117
- return ok(code);
3118
- }
3119
- }
3120
- }
3121
- //#endregion
3122
- //#region ../../../node_modules/.pnpm/micromark-extension-gfm-table@2.1.2/node_modules/micromark-extension-gfm-table/lib/edit-map.js
3123
- /**
3124
- * @import {Event} from 'micromark-util-types'
3125
- */
3126
- /**
3127
- * @typedef {[number, number, Array<Event>]} Change
3128
- * @typedef {[number, number, number]} Jump
3129
- */
3130
- /**
3131
- * Tracks a bunch of edits.
3132
- */
3133
- var EditMap = class {
3134
- /**
3135
- * Create a new edit map.
3136
- */
3137
- constructor() {
3138
- /**
3139
- * Record of changes.
3140
- *
3141
- * @type {Array<Change>}
3142
- */
3143
- this.map = [];
3144
- /**
3145
- * Changes by index, so `add` does not scan `map` (quadratic on
3146
- * table-heavy documents).
3147
- *
3148
- * @type {Map<number, Change>}
3149
- */
3150
- this.index = /* @__PURE__ */ new Map();
3151
- }
3152
- /**
3153
- * Create an edit: a remove and/or add at a certain place.
3154
- *
3155
- * @param {number} index
3156
- * Index at which to apply the edit.
3157
- * @param {number} remove
3158
- * Count of items to remove at the index.
3159
- * @param {Array<Event>} add
3160
- * Items to add at the index.
3161
- * @returns {undefined}
3162
- * Nothing.
3163
- */
3164
- add(index, remove, add) {
3165
- addImplementation(this, index, remove, add);
3166
- }
3167
- /**
3168
- * Done, change the events.
3169
- *
3170
- * @param {Array<Event>} events
3171
- * List of events to apply the edits to.
3172
- * @returns {undefined}
3173
- * Nothing.
3174
- */
3175
- consume(events) {
3176
- this.map.sort(function(a, b) {
3177
- return a[0] - b[0];
3178
- });
3179
- /* c8 ignore next 3 -- `resolve` is never called without tables, so without edits. */
3180
- if (this.map.length === 0) return;
3181
- let index = this.map.length;
3182
- /** @type {Array<Array<Event>>} */
3183
- const vecs = [];
3184
- while (index > 0) {
3185
- index -= 1;
3186
- vecs.push(events.slice(this.map[index][0] + this.map[index][1]), this.map[index][2]);
3187
- events.length = this.map[index][0];
3188
- }
3189
- vecs.push(events.slice());
3190
- events.length = 0;
3191
- let slice = vecs.pop();
3192
- while (slice) {
3193
- for (const element of slice) events.push(element);
3194
- slice = vecs.pop();
3195
- }
3196
- this.map.length = 0;
3197
- this.index.clear();
3198
- }
3199
- };
3200
- /**
3201
- * Create an edit.
3202
- *
3203
- * @param {EditMap} editMap
3204
- * Edit map to apply to.
3205
- * @param {number} at
3206
- * Index at which to apply the edit.
3207
- * @param {number} remove
3208
- * Count of items to remove at the index.
3209
- * @param {Array<Event>} add
3210
- * Items to add at the index.
3211
- * @returns {undefined}
3212
- * Nothing.
3213
- */
3214
- function addImplementation(editMap, at, remove, add) {
3215
- /* c8 ignore next 3 -- `resolve` is never called without tables, so without edits. */
3216
- if (remove === 0 && add.length === 0) return;
3217
- const existing = editMap.index.get(at);
3218
- if (existing) {
3219
- existing[1] += remove;
3220
- existing[2].push(...add);
3221
- return;
3222
- }
3223
- /** @type {Change} */
3224
- const change = [
3225
- at,
3226
- remove,
3227
- add
3228
- ];
3229
- editMap.map.push(change);
3230
- editMap.index.set(at, change);
3231
- }
3232
- //#endregion
3233
- //#region ../../../node_modules/.pnpm/micromark-extension-gfm-table@2.1.2/node_modules/micromark-extension-gfm-table/lib/infer.js
3234
- /**
3235
- * @import {Event} from 'micromark-util-types'
3236
- */
3237
- /**
3238
- * @typedef {'center' | 'left' | 'none' | 'right'} Align
3239
- */
3240
- /**
3241
- * Figure out the alignment of a GFM table.
3242
- *
3243
- * @param {Readonly<Array<Event>>} events
3244
- * List of events.
3245
- * @param {number} index
3246
- * Table enter event.
3247
- * @returns {Array<Align>}
3248
- * List of aligns.
3249
- */
3250
- function gfmTableAlign(events, index) {
3251
- let inDelimiterRow = false;
3252
- /** @type {Array<Align>} */
3253
- const align = [];
3254
- while (index < events.length) {
3255
- const event = events[index];
3256
- if (inDelimiterRow) {
3257
- if (event[0] === "enter") {
3258
- if (event[1].type === "tableContent") align.push(events[index + 1][1].type === "tableDelimiterMarker" ? "left" : "none");
3259
- } else if (event[1].type === "tableContent") {
3260
- if (events[index - 1][1].type === "tableDelimiterMarker") {
3261
- const alignIndex = align.length - 1;
3262
- align[alignIndex] = align[alignIndex] === "left" ? "center" : "right";
3263
- }
3264
- } else if (event[1].type === "tableDelimiterRow") break;
3265
- } else if (event[0] === "enter" && event[1].type === "tableDelimiterRow") inDelimiterRow = true;
3266
- index += 1;
3267
- }
3268
- return align;
3269
- }
3270
- //#endregion
3271
- //#region ../../../node_modules/.pnpm/micromark-extension-gfm-table@2.1.2/node_modules/micromark-extension-gfm-table/lib/syntax.js
3272
- /**
3273
- * @import {Event, Extension, Point, Resolver, State, Token, TokenizeContext, Tokenizer} from 'micromark-util-types'
3274
- */
3275
- /**
3276
- * @typedef {[number, number, number, number]} Range
3277
- * Cell info.
3278
- *
3279
- * @typedef {0 | 1 | 2 | 3} RowKind
3280
- * Where we are: `1` for head row, `2` for delimiter row, `3` for body row.
3281
- */
3282
- /**
3283
- * Create an HTML extension for `micromark` to support GitHub tables syntax.
3284
- *
3285
- * @returns {Extension}
3286
- * Extension for `micromark` that can be passed in `extensions` to enable GFM
3287
- * table syntax.
3288
- */
3289
- function gfmTable() {
3290
- return { flow: { null: {
3291
- name: "table",
3292
- tokenize: tokenizeTable,
3293
- resolveAll: resolveTable
3294
- } } };
3295
- }
3296
- /**
3297
- * Tokenizer for GFM tables.
3298
- *
3299
- * @this {TokenizeContext}
3300
- * @type {Tokenizer}
3301
- */
3302
- function tokenizeTable(effects, ok, nok) {
3303
- const self = this;
3304
- let size = 0;
3305
- let sizeB = 0;
3306
- /** @type {boolean | undefined} */
3307
- let seen;
3308
- return start;
3309
- /**
3310
- * Start of a GFM table.
3311
- *
3312
- * If there is a valid table row or table head before, then we try to parse
3313
- * another row.
3314
- * Otherwise, we try to parse a head.
3315
- *
3316
- * ```markdown
3317
- * > | | a |
3318
- * ^
3319
- * | | - |
3320
- * > | | b |
3321
- * ^
3322
- * ```
3323
- * @type {State}
3324
- */
3325
- function start(code) {
3326
- let index = self.events.length - 1;
3327
- while (index > -1) {
3328
- const { type } = self.events[index][1];
3329
- if (type === "lineEnding" || type === "linePrefix") index--;
3330
- else break;
3331
- }
3332
- const tail = index > -1 ? self.events[index][1].type : null;
3333
- const next = tail === "tableHead" || tail === "tableRow" ? bodyRowStart : headRowBefore;
3334
- if (next === bodyRowStart && self.parser.lazy[self.now().line]) return nok(code);
3335
- return next(code);
3336
- }
3337
- /**
3338
- * Before table head row.
3339
- *
3340
- * ```markdown
3341
- * > | | a |
3342
- * ^
3343
- * | | - |
3344
- * | | b |
3345
- * ```
3346
- *
3347
- * @type {State}
3348
- */
3349
- function headRowBefore(code) {
3350
- effects.enter("tableHead");
3351
- effects.enter("tableRow");
3352
- return headRowStart(code);
3353
- }
3354
- /**
3355
- * Before table head row, after whitespace.
3356
- *
3357
- * ```markdown
3358
- * > | | a |
3359
- * ^
3360
- * | | - |
3361
- * | | b |
3362
- * ```
3363
- *
3364
- * @type {State}
3365
- */
3366
- function headRowStart(code) {
3367
- if (code === 124) return headRowBreak(code);
3368
- seen = true;
3369
- sizeB += 1;
3370
- return headRowBreak(code);
3371
- }
3372
- /**
3373
- * At break in table head row.
3374
- *
3375
- * ```markdown
3376
- * > | | a |
3377
- * ^
3378
- * ^
3379
- * ^
3380
- * | | - |
3381
- * | | b |
3382
- * ```
3383
- *
3384
- * @type {State}
3385
- */
3386
- function headRowBreak(code) {
3387
- if (code === null) return nok(code);
3388
- if (markdownLineEnding(code)) {
3389
- if (sizeB > 1) {
3390
- sizeB = 0;
3391
- self.interrupt = true;
3392
- effects.exit("tableRow");
3393
- effects.enter("lineEnding");
3394
- effects.consume(code);
3395
- effects.exit("lineEnding");
3396
- return headDelimiterStart;
3397
- }
3398
- return nok(code);
3399
- }
3400
- if (markdownSpace(code)) return factorySpace(effects, headRowBreak, "whitespace")(code);
3401
- sizeB += 1;
3402
- if (seen) {
3403
- seen = false;
3404
- size += 1;
3405
- }
3406
- if (code === 124) {
3407
- effects.enter("tableCellDivider");
3408
- effects.consume(code);
3409
- effects.exit("tableCellDivider");
3410
- seen = true;
3411
- return headRowBreak;
3412
- }
3413
- effects.enter("data");
3414
- return headRowData(code);
3415
- }
3416
- /**
3417
- * In table head row data.
3418
- *
3419
- * ```markdown
3420
- * > | | a |
3421
- * ^
3422
- * | | - |
3423
- * | | b |
3424
- * ```
3425
- *
3426
- * @type {State}
3427
- */
3428
- function headRowData(code) {
3429
- if (code === null || code === 124 || markdownLineEndingOrSpace(code)) {
3430
- effects.exit("data");
3431
- return headRowBreak(code);
3432
- }
3433
- effects.consume(code);
3434
- return code === 92 ? headRowEscape : headRowData;
3435
- }
3436
- /**
3437
- * In table head row escape.
3438
- *
3439
- * ```markdown
3440
- * > | | a\-b |
3441
- * ^
3442
- * | | ---- |
3443
- * | | c |
3444
- * ```
3445
- *
3446
- * @type {State}
3447
- */
3448
- function headRowEscape(code) {
3449
- if (code === 92 || code === 124) {
3450
- effects.consume(code);
3451
- return headRowData;
3452
- }
3453
- return headRowData(code);
3454
- }
3455
- /**
3456
- * Before delimiter row.
3457
- *
3458
- * ```markdown
3459
- * | | a |
3460
- * > | | - |
3461
- * ^
3462
- * | | b |
3463
- * ```
3464
- *
3465
- * @type {State}
3466
- */
3467
- function headDelimiterStart(code) {
3468
- self.interrupt = false;
3469
- if (self.parser.lazy[self.now().line]) return nok(code);
3470
- effects.enter("tableDelimiterRow");
3471
- seen = false;
3472
- if (markdownSpace(code)) return factorySpace(effects, headDelimiterBefore, "linePrefix", self.parser.constructs.disable.null.includes("codeIndented") ? void 0 : 4)(code);
3473
- return headDelimiterBefore(code);
3474
- }
3475
- /**
3476
- * Before delimiter row, after optional whitespace.
3477
- *
3478
- * Reused when a `|` is found later, to parse another cell.
3479
- *
3480
- * ```markdown
3481
- * | | a |
3482
- * > | | - |
3483
- * ^
3484
- * | | b |
3485
- * ```
3486
- *
3487
- * @type {State}
3488
- */
3489
- function headDelimiterBefore(code) {
3490
- if (code === 45 || code === 58) return headDelimiterValueBefore(code);
3491
- if (code === 124) {
3492
- seen = true;
3493
- effects.enter("tableCellDivider");
3494
- effects.consume(code);
3495
- effects.exit("tableCellDivider");
3496
- return headDelimiterCellBefore;
3497
- }
3498
- return headDelimiterNok(code);
3499
- }
3500
- /**
3501
- * After `|`, before delimiter cell.
3502
- *
3503
- * ```markdown
3504
- * | | a |
3505
- * > | | - |
3506
- * ^
3507
- * ```
3508
- *
3509
- * @type {State}
3510
- */
3511
- function headDelimiterCellBefore(code) {
3512
- if (markdownSpace(code)) return factorySpace(effects, headDelimiterValueBefore, "whitespace")(code);
3513
- return headDelimiterValueBefore(code);
3514
- }
3515
- /**
3516
- * Before delimiter cell value.
3517
- *
3518
- * ```markdown
3519
- * | | a |
3520
- * > | | - |
3521
- * ^
3522
- * ```
3523
- *
3524
- * @type {State}
3525
- */
3526
- function headDelimiterValueBefore(code) {
3527
- if (code === 58) {
3528
- sizeB += 1;
3529
- seen = true;
3530
- effects.enter("tableDelimiterMarker");
3531
- effects.consume(code);
3532
- effects.exit("tableDelimiterMarker");
3533
- return headDelimiterLeftAlignmentAfter;
3534
- }
3535
- if (code === 45) {
3536
- sizeB += 1;
3537
- return headDelimiterLeftAlignmentAfter(code);
3538
- }
3539
- if (code === null || markdownLineEnding(code)) return headDelimiterCellAfter(code);
3540
- return headDelimiterNok(code);
3541
- }
3542
- /**
3543
- * After delimiter cell left alignment marker.
3544
- *
3545
- * ```markdown
3546
- * | | a |
3547
- * > | | :- |
3548
- * ^
3549
- * ```
3550
- *
3551
- * @type {State}
3552
- */
3553
- function headDelimiterLeftAlignmentAfter(code) {
3554
- if (code === 45) {
3555
- effects.enter("tableDelimiterFiller");
3556
- return headDelimiterFiller(code);
3557
- }
3558
- return headDelimiterNok(code);
3559
- }
3560
- /**
3561
- * In delimiter cell filler.
3562
- *
3563
- * ```markdown
3564
- * | | a |
3565
- * > | | - |
3566
- * ^
3567
- * ```
3568
- *
3569
- * @type {State}
3570
- */
3571
- function headDelimiterFiller(code) {
3572
- if (code === 45) {
3573
- effects.consume(code);
3574
- return headDelimiterFiller;
3575
- }
3576
- if (code === 58) {
3577
- seen = true;
3578
- effects.exit("tableDelimiterFiller");
3579
- effects.enter("tableDelimiterMarker");
3580
- effects.consume(code);
3581
- effects.exit("tableDelimiterMarker");
3582
- return headDelimiterRightAlignmentAfter;
3583
- }
3584
- effects.exit("tableDelimiterFiller");
3585
- return headDelimiterRightAlignmentAfter(code);
3586
- }
3587
- /**
3588
- * After delimiter cell right alignment marker.
3589
- *
3590
- * ```markdown
3591
- * | | a |
3592
- * > | | -: |
3593
- * ^
3594
- * ```
3595
- *
3596
- * @type {State}
3597
- */
3598
- function headDelimiterRightAlignmentAfter(code) {
3599
- if (markdownSpace(code)) return factorySpace(effects, headDelimiterCellAfter, "whitespace")(code);
3600
- return headDelimiterCellAfter(code);
3601
- }
3602
- /**
3603
- * After delimiter cell.
3604
- *
3605
- * ```markdown
3606
- * | | a |
3607
- * > | | -: |
3608
- * ^
3609
- * ```
3610
- *
3611
- * @type {State}
3612
- */
3613
- function headDelimiterCellAfter(code) {
3614
- if (code === 124) return headDelimiterBefore(code);
3615
- if (code === null || markdownLineEnding(code)) {
3616
- if (!seen || size !== sizeB) return headDelimiterNok(code);
3617
- effects.exit("tableDelimiterRow");
3618
- effects.exit("tableHead");
3619
- return ok(code);
3620
- }
3621
- return headDelimiterNok(code);
3622
- }
3623
- /**
3624
- * In delimiter row, at a disallowed byte.
3625
- *
3626
- * ```markdown
3627
- * | | a |
3628
- * > | | x |
3629
- * ^
3630
- * ```
3631
- *
3632
- * @type {State}
3633
- */
3634
- function headDelimiterNok(code) {
3635
- return nok(code);
3636
- }
3637
- /**
3638
- * Before table body row.
3639
- *
3640
- * ```markdown
3641
- * | | a |
3642
- * | | - |
3643
- * > | | b |
3644
- * ^
3645
- * ```
3646
- *
3647
- * @type {State}
3648
- */
3649
- function bodyRowStart(code) {
3650
- effects.enter("tableRow");
3651
- return bodyRowBreak(code);
3652
- }
3653
- /**
3654
- * At break in table body row.
3655
- *
3656
- * ```markdown
3657
- * | | a |
3658
- * | | - |
3659
- * > | | b |
3660
- * ^
3661
- * ^
3662
- * ^
3663
- * ```
3664
- *
3665
- * @type {State}
3666
- */
3667
- function bodyRowBreak(code) {
3668
- if (code === 124) {
3669
- effects.enter("tableCellDivider");
3670
- effects.consume(code);
3671
- effects.exit("tableCellDivider");
3672
- return bodyRowBreak;
3673
- }
3674
- if (code === null || markdownLineEnding(code)) {
3675
- effects.exit("tableRow");
3676
- return ok(code);
3677
- }
3678
- if (markdownSpace(code)) return factorySpace(effects, bodyRowBreak, "whitespace")(code);
3679
- effects.enter("data");
3680
- return bodyRowData(code);
3681
- }
3682
- /**
3683
- * In table body row data.
3684
- *
3685
- * ```markdown
3686
- * | | a |
3687
- * | | - |
3688
- * > | | b |
3689
- * ^
3690
- * ```
3691
- *
3692
- * @type {State}
3693
- */
3694
- function bodyRowData(code) {
3695
- if (code === null || code === 124 || markdownLineEndingOrSpace(code)) {
3696
- effects.exit("data");
3697
- return bodyRowBreak(code);
3698
- }
3699
- effects.consume(code);
3700
- return code === 92 ? bodyRowEscape : bodyRowData;
3701
- }
3702
- /**
3703
- * In table body row escape.
3704
- *
3705
- * ```markdown
3706
- * | | a |
3707
- * | | ---- |
3708
- * > | | b\-c |
3709
- * ^
3710
- * ```
3711
- *
3712
- * @type {State}
3713
- */
3714
- function bodyRowEscape(code) {
3715
- if (code === 92 || code === 124) {
3716
- effects.consume(code);
3717
- return bodyRowData;
3718
- }
3719
- return bodyRowData(code);
3720
- }
3721
- }
3722
- /** @type {Resolver} */
3723
- function resolveTable(events, context) {
3724
- let index = -1;
3725
- let inFirstCellAwaitingPipe = true;
3726
- /** @type {RowKind} */
3727
- let rowKind = 0;
3728
- /** @type {Range} */
3729
- let lastCell = [
3730
- 0,
3731
- 0,
3732
- 0,
3733
- 0
3734
- ];
3735
- /** @type {Range} */
3736
- let cell = [
3737
- 0,
3738
- 0,
3739
- 0,
3740
- 0
3741
- ];
3742
- let afterHeadAwaitingFirstBodyRow = false;
3743
- let lastTableEnd = 0;
3744
- /** @type {Token | undefined} */
3745
- let currentTable;
3746
- /** @type {Token | undefined} */
3747
- let currentBody;
3748
- /** @type {Token | undefined} */
3749
- let currentCell;
3750
- const map = new EditMap();
3751
- while (++index < events.length) {
3752
- const event = events[index];
3753
- const token = event[1];
3754
- if (event[0] === "enter") {
3755
- if (token.type === "tableHead") {
3756
- afterHeadAwaitingFirstBodyRow = false;
3757
- if (lastTableEnd !== 0) {
3758
- flushTableEnd(map, context, lastTableEnd, currentTable, currentBody);
3759
- currentBody = void 0;
3760
- lastTableEnd = 0;
3761
- }
3762
- currentTable = {
3763
- type: "table",
3764
- start: Object.assign({}, token.start),
3765
- end: Object.assign({}, token.end)
3766
- };
3767
- map.add(index, 0, [[
3768
- "enter",
3769
- currentTable,
3770
- context
3771
- ]]);
3772
- } else if (token.type === "tableRow" || token.type === "tableDelimiterRow") {
3773
- inFirstCellAwaitingPipe = true;
3774
- currentCell = void 0;
3775
- lastCell = [
3776
- 0,
3777
- 0,
3778
- 0,
3779
- 0
3780
- ];
3781
- cell = [
3782
- 0,
3783
- index + 1,
3784
- 0,
3785
- 0
3786
- ];
3787
- if (afterHeadAwaitingFirstBodyRow) {
3788
- afterHeadAwaitingFirstBodyRow = false;
3789
- currentBody = {
3790
- type: "tableBody",
3791
- start: Object.assign({}, token.start),
3792
- end: Object.assign({}, token.end)
3793
- };
3794
- map.add(index, 0, [[
3795
- "enter",
3796
- currentBody,
3797
- context
3798
- ]]);
3799
- }
3800
- rowKind = token.type === "tableDelimiterRow" ? 2 : currentBody ? 3 : 1;
3801
- } else if (rowKind && (token.type === "data" || token.type === "tableDelimiterMarker" || token.type === "tableDelimiterFiller")) {
3802
- inFirstCellAwaitingPipe = false;
3803
- if (cell[2] === 0) {
3804
- if (lastCell[1] !== 0) {
3805
- cell[0] = cell[1];
3806
- currentCell = flushCell(map, context, lastCell, rowKind, void 0, currentCell);
3807
- lastCell = [
3808
- 0,
3809
- 0,
3810
- 0,
3811
- 0
3812
- ];
3813
- }
3814
- cell[2] = index;
3815
- }
3816
- } else if (token.type === "tableCellDivider") {
3817
- if (inFirstCellAwaitingPipe) inFirstCellAwaitingPipe = false;
3818
- else {
3819
- if (lastCell[1] !== 0) {
3820
- cell[0] = cell[1];
3821
- currentCell = flushCell(map, context, lastCell, rowKind, void 0, currentCell);
3822
- }
3823
- lastCell = cell;
3824
- cell = [
3825
- lastCell[1],
3826
- index,
3827
- 0,
3828
- 0
3829
- ];
3830
- }
3831
- }
3832
- } else if (token.type === "tableHead") {
3833
- afterHeadAwaitingFirstBodyRow = true;
3834
- lastTableEnd = index;
3835
- } else if (token.type === "tableRow" || token.type === "tableDelimiterRow") {
3836
- lastTableEnd = index;
3837
- if (lastCell[1] !== 0) {
3838
- cell[0] = cell[1];
3839
- currentCell = flushCell(map, context, lastCell, rowKind, index, currentCell);
3840
- } else if (cell[1] !== 0) currentCell = flushCell(map, context, cell, rowKind, index, currentCell);
3841
- rowKind = 0;
3842
- } else if (rowKind && (token.type === "data" || token.type === "tableDelimiterMarker" || token.type === "tableDelimiterFiller")) cell[3] = index;
3843
- }
3844
- if (lastTableEnd !== 0) flushTableEnd(map, context, lastTableEnd, currentTable, currentBody);
3845
- map.consume(context.events);
3846
- index = -1;
3847
- while (++index < context.events.length) {
3848
- const event = context.events[index];
3849
- if (event[0] === "enter" && event[1].type === "table") event[1]._align = gfmTableAlign(context.events, index);
3850
- }
3851
- return events;
3852
- }
3853
- /**
3854
- * Generate a cell.
3855
- *
3856
- * @param {EditMap} map
3857
- * Edit map to apply to.
3858
- * @param {Readonly<TokenizeContext>} context
3859
- * Tokenize context.
3860
- * @param {Readonly<Range>} range
3861
- * Range of the cell within events.
3862
- * @param {RowKind} rowKind
3863
- * Type of row.
3864
- * @param {number | undefined} rowEnd
3865
- * Index of the end of the row, if known.
3866
- * @param {Token | undefined} previousCell
3867
- * Previous cell token, if any.
3868
- * @returns {Token | undefined}
3869
- * Current cell token after flushing, if any.
3870
- */
3871
- function flushCell(map, context, range, rowKind, rowEnd, previousCell) {
3872
- const groupName = rowKind === 1 ? "tableHeader" : rowKind === 2 ? "tableDelimiter" : "tableData";
3873
- const valueName = "tableContent";
3874
- if (range[0] !== 0) {
3875
- previousCell.end = Object.assign({}, getPoint(context.events, range[0]));
3876
- map.add(range[0], 0, [[
3877
- "exit",
3878
- previousCell,
3879
- context
3880
- ]]);
3881
- }
3882
- const now = getPoint(context.events, range[1]);
3883
- previousCell = {
3884
- type: groupName,
3885
- start: Object.assign({}, now),
3886
- end: Object.assign({}, now)
3887
- };
3888
- map.add(range[1], 0, [[
3889
- "enter",
3890
- previousCell,
3891
- context
3892
- ]]);
3893
- if (range[2] !== 0) {
3894
- const relatedStart = getPoint(context.events, range[2]);
3895
- const relatedEnd = getPoint(context.events, range[3]);
3896
- /** @type {Token} */
3897
- const valueToken = {
3898
- type: valueName,
3899
- start: Object.assign({}, relatedStart),
3900
- end: Object.assign({}, relatedEnd)
3901
- };
3902
- map.add(range[2], 0, [[
3903
- "enter",
3904
- valueToken,
3905
- context
3906
- ]]);
3907
- if (rowKind !== 2) {
3908
- const start = context.events[range[2]];
3909
- const end = context.events[range[3]];
3910
- start[1].end = Object.assign({}, end[1].end);
3911
- start[1].type = "chunkText";
3912
- start[1].contentType = "text";
3913
- if (range[3] > range[2] + 1) {
3914
- const a = range[2] + 1;
3915
- const b = range[3] - range[2] - 1;
3916
- map.add(a, b, []);
3917
- }
3918
- }
3919
- map.add(range[3] + 1, 0, [[
3920
- "exit",
3921
- valueToken,
3922
- context
3923
- ]]);
3924
- }
3925
- if (rowEnd !== void 0) {
3926
- previousCell.end = Object.assign({}, getPoint(context.events, rowEnd));
3927
- map.add(rowEnd, 0, [[
3928
- "exit",
3929
- previousCell,
3930
- context
3931
- ]]);
3932
- previousCell = void 0;
3933
- }
3934
- return previousCell;
3935
- }
3936
- /**
3937
- * Generate table end (and table body end).
3938
- *
3939
- * @param {Readonly<EditMap>} map
3940
- * Edit map to apply to.
3941
- * @param {Readonly<TokenizeContext>} context
3942
- * Tokenize context.
3943
- * @param {number} index
3944
- * Index within the events where the table end should be inserted.
3945
- * @param {Token} table
3946
- * Table token.
3947
- * @param {Token | undefined} tableBody
3948
- * Table body token, if any.
3949
- * @returns {undefined}
3950
- * Nothing.
3951
- */
3952
- function flushTableEnd(map, context, index, table, tableBody) {
3953
- /** @type {Array<Event>} */
3954
- const exits = [];
3955
- const related = getPoint(context.events, index);
3956
- if (tableBody) {
3957
- tableBody.end = Object.assign({}, related);
3958
- exits.push([
3959
- "exit",
3960
- tableBody,
3961
- context
3962
- ]);
3963
- }
3964
- table.end = Object.assign({}, related);
3965
- exits.push([
3966
- "exit",
3967
- table,
3968
- context
3969
- ]);
3970
- map.add(index + 1, 0, exits);
3971
- }
3972
- /**
3973
- * Get the point (start or end) for a given event in the list of events.
3974
- *
3975
- * @param {Readonly<Array<Event>>} events
3976
- * List of events.
3977
- * @param {number} index
3978
- * Index of the event to get the point for.
3979
- * @returns {Readonly<Point>}
3980
- * Start point for enter and end point for exit.
3981
- */
3982
- function getPoint(events, index) {
3983
- const event = events[index];
3984
- const side = event[0] === "enter" ? "start" : "end";
3985
- return event[1][side];
3986
- }
3987
- //#endregion
3988
- //#region ../../../node_modules/.pnpm/micromark-extension-gfm-task-list-item@2.1.0/node_modules/micromark-extension-gfm-task-list-item/lib/syntax.js
3989
- /**
3990
- * @import {Extension, State, TokenizeContext, Tokenizer} from 'micromark-util-types'
3991
- */
3992
- const tasklistCheck = {
3993
- name: "tasklistCheck",
3994
- tokenize: tokenizeTasklistCheck
3995
- };
3996
- /**
3997
- * Create an HTML extension for `micromark` to support GFM task list items
3998
- * syntax.
3999
- *
4000
- * @returns {Extension}
4001
- * Extension for `micromark` that can be passed in `htmlExtensions` to
4002
- * support GFM task list items when serializing to HTML.
4003
- */
4004
- function gfmTaskListItem() {
4005
- return { text: { [91]: tasklistCheck } };
4006
- }
4007
- /**
4008
- * @this {TokenizeContext}
4009
- * @type {Tokenizer}
4010
- */
4011
- function tokenizeTasklistCheck(effects, ok, nok) {
4012
- const self = this;
4013
- return open;
4014
- /**
4015
- * At start of task list item check.
4016
- *
4017
- * ```markdown
4018
- * > | * [x] y.
4019
- * ^
4020
- * ```
4021
- *
4022
- * @type {State}
4023
- */
4024
- function open(code) {
4025
- if (self.previous !== null || !self._gfmTasklistFirstContentOfListItem) return nok(code);
4026
- effects.enter("taskListCheck");
4027
- effects.enter("taskListCheckMarker");
4028
- effects.consume(code);
4029
- effects.exit("taskListCheckMarker");
4030
- return inside;
4031
- }
4032
- /**
4033
- * In task list item check.
4034
- *
4035
- * ```markdown
4036
- * > | * [x] y.
4037
- * ^
4038
- * ```
4039
- *
4040
- * @type {State}
4041
- */
4042
- function inside(code) {
4043
- if (markdownLineEndingOrSpace(code)) {
4044
- effects.enter("taskListCheckValueUnchecked");
4045
- effects.consume(code);
4046
- effects.exit("taskListCheckValueUnchecked");
4047
- return close;
4048
- }
4049
- if (code === 88 || code === 120) {
4050
- effects.enter("taskListCheckValueChecked");
4051
- effects.consume(code);
4052
- effects.exit("taskListCheckValueChecked");
4053
- return close;
4054
- }
4055
- return nok(code);
4056
- }
4057
- /**
4058
- * At close of task list item check.
4059
- *
4060
- * ```markdown
4061
- * > | * [x] y.
4062
- * ^
4063
- * ```
4064
- *
4065
- * @type {State}
4066
- */
4067
- function close(code) {
4068
- if (code === 93) {
4069
- effects.enter("taskListCheckMarker");
4070
- effects.consume(code);
4071
- effects.exit("taskListCheckMarker");
4072
- effects.exit("taskListCheck");
4073
- return after;
4074
- }
4075
- return nok(code);
4076
- }
4077
- /**
4078
- * @type {State}
4079
- */
4080
- function after(code) {
4081
- if (markdownLineEnding(code)) return ok(code);
4082
- if (markdownSpace(code)) return effects.check({ tokenize: spaceThenNonSpace }, ok, nok)(code);
4083
- return nok(code);
4084
- }
4085
- }
4086
- /**
4087
- * @this {TokenizeContext}
4088
- * @type {Tokenizer}
4089
- */
4090
- function spaceThenNonSpace(effects, ok, nok) {
4091
- return factorySpace(effects, after, "whitespace");
4092
- /**
4093
- * After whitespace, after task list item check.
4094
- *
4095
- * ```markdown
4096
- * > | * [x] y.
4097
- * ^
4098
- * ```
4099
- *
4100
- * @type {State}
4101
- */
4102
- function after(code) {
4103
- return code === null ? nok(code) : ok(code);
4104
- }
4105
- }
4106
- //#endregion
4107
- //#region ../../../node_modules/.pnpm/micromark-extension-gfm@3.0.0/node_modules/micromark-extension-gfm/index.js
4108
- /**
4109
- * @typedef {import('micromark-extension-gfm-footnote').HtmlOptions} HtmlOptions
4110
- * @typedef {import('micromark-extension-gfm-strikethrough').Options} Options
4111
- * @typedef {import('micromark-util-types').Extension} Extension
4112
- * @typedef {import('micromark-util-types').HtmlExtension} HtmlExtension
4113
- */
4114
- /**
4115
- * Create an extension for `micromark` to enable GFM syntax.
4116
- *
4117
- * @param {Options | null | undefined} [options]
4118
- * Configuration (optional).
4119
- *
4120
- * Passed to `micromark-extens-gfm-strikethrough`.
4121
- * @returns {Extension}
4122
- * Extension for `micromark` that can be passed in `extensions` to enable GFM
4123
- * syntax.
4124
- */
4125
- function gfm(options) {
4126
- return combineExtensions([
4127
- gfmAutolinkLiteral(),
4128
- gfmFootnote(),
4129
- gfmStrikethrough(options),
4130
- gfmTable(),
4131
- gfmTaskListItem()
4132
- ]);
4133
- }
4134
- //#endregion
4135
- //#region ../../../node_modules/.pnpm/micromark-util-symbol@2.0.1/node_modules/micromark-util-symbol/lib/codes.js
4136
- /**
4137
- * Character codes.
4138
- *
4139
- * This module is compiled away!
4140
- *
4141
- * micromark works based on character codes.
4142
- * This module contains constants for the ASCII block and the replacement
4143
- * character.
4144
- * A couple of them are handled in a special way, such as the line endings
4145
- * (CR, LF, and CR+LF, commonly known as end-of-line: EOLs), the tab (horizontal
4146
- * tab) and its expansion based on what column it’s at (virtual space),
4147
- * and the end-of-file (eof) character.
4148
- * As values are preprocessed before handling them, the actual characters LF,
4149
- * CR, HT, and NUL (which is present as the replacement character), are
4150
- * guaranteed to not exist.
4151
- *
4152
- * Unicode basic latin block.
4153
- */
4154
- const codes = {
4155
- carriageReturn: -5,
4156
- lineFeed: -4,
4157
- carriageReturnLineFeed: -3,
4158
- horizontalTab: -2,
4159
- virtualSpace: -1,
4160
- eof: null,
4161
- nul: 0,
4162
- soh: 1,
4163
- stx: 2,
4164
- etx: 3,
4165
- eot: 4,
4166
- enq: 5,
4167
- ack: 6,
4168
- bel: 7,
4169
- bs: 8,
4170
- ht: 9,
4171
- lf: 10,
4172
- vt: 11,
4173
- ff: 12,
4174
- cr: 13,
4175
- so: 14,
4176
- si: 15,
4177
- dle: 16,
4178
- dc1: 17,
4179
- dc2: 18,
4180
- dc3: 19,
4181
- dc4: 20,
4182
- nak: 21,
4183
- syn: 22,
4184
- etb: 23,
4185
- can: 24,
4186
- em: 25,
4187
- sub: 26,
4188
- esc: 27,
4189
- fs: 28,
4190
- gs: 29,
4191
- rs: 30,
4192
- us: 31,
4193
- space: 32,
4194
- exclamationMark: 33,
4195
- quotationMark: 34,
4196
- numberSign: 35,
4197
- dollarSign: 36,
4198
- percentSign: 37,
4199
- ampersand: 38,
4200
- apostrophe: 39,
4201
- leftParenthesis: 40,
4202
- rightParenthesis: 41,
4203
- asterisk: 42,
4204
- plusSign: 43,
4205
- comma: 44,
4206
- dash: 45,
4207
- dot: 46,
4208
- slash: 47,
4209
- digit0: 48,
4210
- digit1: 49,
4211
- digit2: 50,
4212
- digit3: 51,
4213
- digit4: 52,
4214
- digit5: 53,
4215
- digit6: 54,
4216
- digit7: 55,
4217
- digit8: 56,
4218
- digit9: 57,
4219
- colon: 58,
4220
- semicolon: 59,
4221
- lessThan: 60,
4222
- equalsTo: 61,
4223
- greaterThan: 62,
4224
- questionMark: 63,
4225
- atSign: 64,
4226
- uppercaseA: 65,
4227
- uppercaseB: 66,
4228
- uppercaseC: 67,
4229
- uppercaseD: 68,
4230
- uppercaseE: 69,
4231
- uppercaseF: 70,
4232
- uppercaseG: 71,
4233
- uppercaseH: 72,
4234
- uppercaseI: 73,
4235
- uppercaseJ: 74,
4236
- uppercaseK: 75,
4237
- uppercaseL: 76,
4238
- uppercaseM: 77,
4239
- uppercaseN: 78,
4240
- uppercaseO: 79,
4241
- uppercaseP: 80,
4242
- uppercaseQ: 81,
4243
- uppercaseR: 82,
4244
- uppercaseS: 83,
4245
- uppercaseT: 84,
4246
- uppercaseU: 85,
4247
- uppercaseV: 86,
4248
- uppercaseW: 87,
4249
- uppercaseX: 88,
4250
- uppercaseY: 89,
4251
- uppercaseZ: 90,
4252
- leftSquareBracket: 91,
4253
- backslash: 92,
4254
- rightSquareBracket: 93,
4255
- caret: 94,
4256
- underscore: 95,
4257
- graveAccent: 96,
4258
- lowercaseA: 97,
4259
- lowercaseB: 98,
4260
- lowercaseC: 99,
4261
- lowercaseD: 100,
4262
- lowercaseE: 101,
4263
- lowercaseF: 102,
4264
- lowercaseG: 103,
4265
- lowercaseH: 104,
4266
- lowercaseI: 105,
4267
- lowercaseJ: 106,
4268
- lowercaseK: 107,
4269
- lowercaseL: 108,
4270
- lowercaseM: 109,
4271
- lowercaseN: 110,
4272
- lowercaseO: 111,
4273
- lowercaseP: 112,
4274
- lowercaseQ: 113,
4275
- lowercaseR: 114,
4276
- lowercaseS: 115,
4277
- lowercaseT: 116,
4278
- lowercaseU: 117,
4279
- lowercaseV: 118,
4280
- lowercaseW: 119,
4281
- lowercaseX: 120,
4282
- lowercaseY: 121,
4283
- lowercaseZ: 122,
4284
- leftCurlyBrace: 123,
4285
- verticalBar: 124,
4286
- rightCurlyBrace: 125,
4287
- tilde: 126,
4288
- del: 127,
4289
- byteOrderMarker: 65279,
4290
- replacementCharacter: 65533
4291
- };
4292
- //#endregion
4293
- //#region ../../../node_modules/.pnpm/micromark-util-symbol@2.0.1/node_modules/micromark-util-symbol/lib/types.js
4294
- /**
4295
- * This module is compiled away!
4296
- *
4297
- * Here is the list of all types of tokens exposed by micromark, with a short
4298
- * explanation of what they include and where they are found.
4299
- * In picking names, generally, the rule is to be as explicit as possible
4300
- * instead of reusing names.
4301
- * For example, there is a `definitionDestination` and a `resourceDestination`,
4302
- * instead of one shared name.
4303
- */
4304
- const types = {
4305
- data: "data",
4306
- whitespace: "whitespace",
4307
- lineEnding: "lineEnding",
4308
- lineEndingBlank: "lineEndingBlank",
4309
- linePrefix: "linePrefix",
4310
- lineSuffix: "lineSuffix",
4311
- atxHeading: "atxHeading",
4312
- atxHeadingSequence: "atxHeadingSequence",
4313
- atxHeadingText: "atxHeadingText",
4314
- autolink: "autolink",
4315
- autolinkEmail: "autolinkEmail",
4316
- autolinkMarker: "autolinkMarker",
4317
- autolinkProtocol: "autolinkProtocol",
4318
- characterEscape: "characterEscape",
4319
- characterEscapeValue: "characterEscapeValue",
4320
- characterReference: "characterReference",
4321
- characterReferenceMarker: "characterReferenceMarker",
4322
- characterReferenceMarkerNumeric: "characterReferenceMarkerNumeric",
4323
- characterReferenceMarkerHexadecimal: "characterReferenceMarkerHexadecimal",
4324
- characterReferenceValue: "characterReferenceValue",
4325
- codeFenced: "codeFenced",
4326
- codeFencedFence: "codeFencedFence",
4327
- codeFencedFenceSequence: "codeFencedFenceSequence",
4328
- codeFencedFenceInfo: "codeFencedFenceInfo",
4329
- codeFencedFenceMeta: "codeFencedFenceMeta",
4330
- codeFlowValue: "codeFlowValue",
4331
- codeIndented: "codeIndented",
4332
- codeText: "codeText",
4333
- codeTextData: "codeTextData",
4334
- codeTextPadding: "codeTextPadding",
4335
- codeTextSequence: "codeTextSequence",
4336
- content: "content",
4337
- definition: "definition",
4338
- definitionDestination: "definitionDestination",
4339
- definitionDestinationLiteral: "definitionDestinationLiteral",
4340
- definitionDestinationLiteralMarker: "definitionDestinationLiteralMarker",
4341
- definitionDestinationRaw: "definitionDestinationRaw",
4342
- definitionDestinationString: "definitionDestinationString",
4343
- definitionLabel: "definitionLabel",
4344
- definitionLabelMarker: "definitionLabelMarker",
4345
- definitionLabelString: "definitionLabelString",
4346
- definitionMarker: "definitionMarker",
4347
- definitionTitle: "definitionTitle",
4348
- definitionTitleMarker: "definitionTitleMarker",
4349
- definitionTitleString: "definitionTitleString",
4350
- emphasis: "emphasis",
4351
- emphasisSequence: "emphasisSequence",
4352
- emphasisText: "emphasisText",
4353
- escapeMarker: "escapeMarker",
4354
- hardBreakEscape: "hardBreakEscape",
4355
- hardBreakTrailing: "hardBreakTrailing",
4356
- htmlFlow: "htmlFlow",
4357
- htmlFlowData: "htmlFlowData",
4358
- htmlText: "htmlText",
4359
- htmlTextData: "htmlTextData",
4360
- image: "image",
4361
- label: "label",
4362
- labelText: "labelText",
4363
- labelLink: "labelLink",
4364
- labelImage: "labelImage",
4365
- labelMarker: "labelMarker",
4366
- labelImageMarker: "labelImageMarker",
4367
- labelEnd: "labelEnd",
4368
- link: "link",
4369
- paragraph: "paragraph",
4370
- reference: "reference",
4371
- referenceMarker: "referenceMarker",
4372
- referenceString: "referenceString",
4373
- resource: "resource",
4374
- resourceDestination: "resourceDestination",
4375
- resourceDestinationLiteral: "resourceDestinationLiteral",
4376
- resourceDestinationLiteralMarker: "resourceDestinationLiteralMarker",
4377
- resourceDestinationRaw: "resourceDestinationRaw",
4378
- resourceDestinationString: "resourceDestinationString",
4379
- resourceMarker: "resourceMarker",
4380
- resourceTitle: "resourceTitle",
4381
- resourceTitleMarker: "resourceTitleMarker",
4382
- resourceTitleString: "resourceTitleString",
4383
- setextHeading: "setextHeading",
4384
- setextHeadingText: "setextHeadingText",
4385
- setextHeadingLine: "setextHeadingLine",
4386
- setextHeadingLineSequence: "setextHeadingLineSequence",
4387
- strong: "strong",
4388
- strongSequence: "strongSequence",
4389
- strongText: "strongText",
4390
- thematicBreak: "thematicBreak",
4391
- thematicBreakSequence: "thematicBreakSequence",
4392
- blockQuote: "blockQuote",
4393
- blockQuotePrefix: "blockQuotePrefix",
4394
- blockQuoteMarker: "blockQuoteMarker",
4395
- blockQuotePrefixWhitespace: "blockQuotePrefixWhitespace",
4396
- listOrdered: "listOrdered",
4397
- listUnordered: "listUnordered",
4398
- listItemIndent: "listItemIndent",
4399
- listItemMarker: "listItemMarker",
4400
- listItemPrefix: "listItemPrefix",
4401
- listItemPrefixWhitespace: "listItemPrefixWhitespace",
4402
- listItemValue: "listItemValue",
4403
- chunkDocument: "chunkDocument",
4404
- chunkContent: "chunkContent",
4405
- chunkFlow: "chunkFlow",
4406
- chunkText: "chunkText",
4407
- chunkString: "chunkString"
4408
- };
4409
- //#endregion
4410
- //#region ../../client/ui-primitives/src/reference.ts
99
+ //#region ../../client/dsh-client-ui-primitives/src/reference.ts
4411
100
  const DEFAULT_PROTOCOL = "file";
4412
101
  const LINE_FRAGMENT = /^L(\d+)(?:C(\d+))?(?:-L(\d+))?$/u;
4413
102
  const SCHEME = /^([A-Za-z][A-Za-z0-9+.-]*):/u;