@cmodjs/core 5.1.1 → 5.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/docs/commands.md +22 -10
- package/docs/dependencies.md +3 -3
- package/docs/index.md +2 -1
- package/docs/install-steps.md +1 -1
- package/docs/mod.md +44 -1
- package/docs/options.md +1 -1
- package/docs/session.md +5 -1
- package/docs/testing.md +7 -3
- package/mod.d.ts +11 -0
- package/mod.d.ts.map +1 -1
- package/mod.js +3 -0
- package/package.json +1 -1
- package/records.d.ts +2 -2
- package/records.d.ts.map +1 -1
- package/records.js +5 -4
- package/register.d.ts.map +1 -1
- package/register.js +4 -2
- package/runtime/before.d.ts +1 -1
- package/runtime/before.d.ts.map +1 -1
- package/runtime/before.js +33 -21
- package/runtime/claude.d.ts +4 -0
- package/runtime/claude.d.ts.map +1 -1
- package/runtime/conversations.d.ts.map +1 -1
- package/runtime/conversations.js +58 -26
- package/runtime/deadline.d.ts +1 -1
- package/runtime/deadline.d.ts.map +1 -1
- package/runtime/deadline.js +7 -2
- package/runtime/device.d.ts +6 -0
- package/runtime/device.d.ts.map +1 -0
- package/runtime/device.js +58 -0
- package/runtime/hooks.d.ts +1 -1
- package/runtime/hooks.d.ts.map +1 -1
- package/runtime/hooks.js +1 -1
- package/runtime/lifecycle.d.ts +1 -1
- package/runtime/lifecycle.d.ts.map +1 -1
- package/runtime/lifecycle.js +24 -6
- package/runtime/permission-check.d.ts +1 -1
- package/runtime/permission-check.d.ts.map +1 -1
- package/runtime/permission-check.js +5 -5
- package/runtime/router.d.ts +7 -3
- package/runtime/router.d.ts.map +1 -1
- package/runtime/router.js +5 -3
- package/runtime/sessions.d.ts +10 -6
- package/runtime/sessions.d.ts.map +1 -1
- package/runtime/sessions.js +15 -15
- package/session/context/turn/device.d.ts +10 -0
- package/session/context/turn/device.d.ts.map +1 -0
- package/session/context/turn/device.js +11 -0
- package/session/context/turn/turn.d.ts +2 -0
- package/session/context/turn/turn.d.ts.map +1 -1
- package/session/conversation.d.ts +4 -1
- package/session/conversation.d.ts.map +1 -1
- package/session/conversation.js +8 -3
- package/src/mod.ts +12 -0
- package/src/records.ts +5 -4
- package/src/register.ts +5 -3
- package/src/runtime/before.ts +35 -24
- package/src/runtime/claude.ts +2 -0
- package/src/runtime/conversations.ts +63 -34
- package/src/runtime/deadline.ts +7 -2
- package/src/runtime/device.ts +65 -0
- package/src/runtime/hooks.ts +3 -3
- package/src/runtime/lifecycle.ts +26 -7
- package/src/runtime/permission-check.ts +6 -6
- package/src/runtime/router.ts +14 -7
- package/src/runtime/sessions.ts +22 -22
- package/src/session/context/turn/device.ts +21 -0
- package/src/session/context/turn/turn.ts +2 -0
- package/src/session/conversation.ts +10 -5
- package/src/testing/claude-code.ts +2 -2
- package/src/testing/fake-claude.ts +6 -1
- package/src/testing.ts +50 -13
- package/testing/claude-code.d.ts +2 -2
- package/testing/claude-code.d.ts.map +1 -1
- package/testing/fake-claude.d.ts +3 -0
- package/testing/fake-claude.d.ts.map +1 -1
- package/testing/fake-claude.js +3 -1
- package/testing.d.ts +1 -0
- package/testing.d.ts.map +1 -1
- package/testing.js +53 -12
- package/vendor-markdown.js +744 -738
- package/vendor.js +122 -106
package/vendor-markdown.js
CHANGED
|
@@ -1,14 +1,32 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
|
+
var __returnValue = (v) => v;
|
|
3
|
+
function __exportSetter(name, newValue) {
|
|
4
|
+
this[name] = __returnValue.bind(null, newValue);
|
|
5
|
+
}
|
|
2
6
|
var __export = (target, all) => {
|
|
3
7
|
for (var name in all)
|
|
4
8
|
__defProp(target, name, {
|
|
5
9
|
get: all[name],
|
|
6
10
|
enumerable: true,
|
|
7
11
|
configurable: true,
|
|
8
|
-
set: (
|
|
12
|
+
set: __exportSetter.bind(all, name)
|
|
9
13
|
});
|
|
10
14
|
};
|
|
11
15
|
|
|
16
|
+
// node_modules/micromark/lib/constructs.js
|
|
17
|
+
var exports_constructs = {};
|
|
18
|
+
__export(exports_constructs, {
|
|
19
|
+
attentionMarkers: () => attentionMarkers,
|
|
20
|
+
contentInitial: () => contentInitial,
|
|
21
|
+
disable: () => disable,
|
|
22
|
+
document: () => document2,
|
|
23
|
+
flow: () => flow2,
|
|
24
|
+
flowInitial: () => flowInitial,
|
|
25
|
+
insideSpan: () => insideSpan,
|
|
26
|
+
string: () => string2,
|
|
27
|
+
text: () => text2
|
|
28
|
+
});
|
|
29
|
+
|
|
12
30
|
// node_modules/mdast-util-to-string/lib/index.js
|
|
13
31
|
var emptyOptions = {};
|
|
14
32
|
function toString(value, options) {
|
|
@@ -2219,18 +2237,18 @@ function push(list, items) {
|
|
|
2219
2237
|
// node_modules/micromark-util-combine-extensions/index.js
|
|
2220
2238
|
var hasOwnProperty = {}.hasOwnProperty;
|
|
2221
2239
|
function combineExtensions(extensions) {
|
|
2222
|
-
const
|
|
2240
|
+
const all = {};
|
|
2223
2241
|
let index = -1;
|
|
2224
2242
|
while (++index < extensions.length) {
|
|
2225
|
-
syntaxExtension(
|
|
2243
|
+
syntaxExtension(all, extensions[index]);
|
|
2226
2244
|
}
|
|
2227
|
-
return
|
|
2245
|
+
return all;
|
|
2228
2246
|
}
|
|
2229
|
-
function syntaxExtension(
|
|
2247
|
+
function syntaxExtension(all, extension) {
|
|
2230
2248
|
let hook;
|
|
2231
2249
|
for (hook in extension) {
|
|
2232
|
-
const maybe = hasOwnProperty.call(
|
|
2233
|
-
const left = maybe || (
|
|
2250
|
+
const maybe = hasOwnProperty.call(all, hook) ? all[hook] : undefined;
|
|
2251
|
+
const left = maybe || (all[hook] = {});
|
|
2234
2252
|
const right = extension[hook];
|
|
2235
2253
|
let code;
|
|
2236
2254
|
if (right) {
|
|
@@ -2648,11 +2666,11 @@ function classifyCharacter(code) {
|
|
|
2648
2666
|
}
|
|
2649
2667
|
|
|
2650
2668
|
// node_modules/micromark-util-resolve-all/index.js
|
|
2651
|
-
function resolveAll(
|
|
2669
|
+
function resolveAll(constructs, events, context) {
|
|
2652
2670
|
const called = [];
|
|
2653
2671
|
let index = -1;
|
|
2654
|
-
while (++index <
|
|
2655
|
-
const resolve =
|
|
2672
|
+
while (++index < constructs.length) {
|
|
2673
|
+
const resolve = constructs[index].resolveAll;
|
|
2656
2674
|
if (resolve && !called.includes(resolve)) {
|
|
2657
2675
|
events = resolve(events, context);
|
|
2658
2676
|
called.push(resolve);
|
|
@@ -3185,44 +3203,44 @@ function tokenizeCodeFenced(effects, ok, nok) {
|
|
|
3185
3203
|
effects.exit("codeFenced");
|
|
3186
3204
|
return ok(code);
|
|
3187
3205
|
}
|
|
3188
|
-
function tokenizeCloseStart(
|
|
3206
|
+
function tokenizeCloseStart(effects, ok, nok) {
|
|
3189
3207
|
let size = 0;
|
|
3190
3208
|
return startBefore;
|
|
3191
3209
|
function startBefore(code) {
|
|
3192
|
-
|
|
3193
|
-
|
|
3194
|
-
|
|
3195
|
-
return
|
|
3210
|
+
effects.enter("lineEnding");
|
|
3211
|
+
effects.consume(code);
|
|
3212
|
+
effects.exit("lineEnding");
|
|
3213
|
+
return start;
|
|
3196
3214
|
}
|
|
3197
|
-
function
|
|
3198
|
-
|
|
3199
|
-
return markdownSpace(code) ? factorySpace(
|
|
3215
|
+
function start(code) {
|
|
3216
|
+
effects.enter("codeFencedFence");
|
|
3217
|
+
return markdownSpace(code) ? factorySpace(effects, beforeSequenceClose, "linePrefix", self.parser.constructs.disable.null.includes("codeIndented") ? undefined : 4)(code) : beforeSequenceClose(code);
|
|
3200
3218
|
}
|
|
3201
3219
|
function beforeSequenceClose(code) {
|
|
3202
3220
|
if (code === marker) {
|
|
3203
|
-
|
|
3221
|
+
effects.enter("codeFencedFenceSequence");
|
|
3204
3222
|
return sequenceClose(code);
|
|
3205
3223
|
}
|
|
3206
|
-
return
|
|
3224
|
+
return nok(code);
|
|
3207
3225
|
}
|
|
3208
3226
|
function sequenceClose(code) {
|
|
3209
3227
|
if (code === marker) {
|
|
3210
3228
|
size++;
|
|
3211
|
-
|
|
3229
|
+
effects.consume(code);
|
|
3212
3230
|
return sequenceClose;
|
|
3213
3231
|
}
|
|
3214
3232
|
if (size >= sizeOpen) {
|
|
3215
|
-
|
|
3216
|
-
return markdownSpace(code) ? factorySpace(
|
|
3233
|
+
effects.exit("codeFencedFenceSequence");
|
|
3234
|
+
return markdownSpace(code) ? factorySpace(effects, sequenceCloseAfter, "whitespace")(code) : sequenceCloseAfter(code);
|
|
3217
3235
|
}
|
|
3218
|
-
return
|
|
3236
|
+
return nok(code);
|
|
3219
3237
|
}
|
|
3220
3238
|
function sequenceCloseAfter(code) {
|
|
3221
3239
|
if (code === null || markdownLineEnding(code)) {
|
|
3222
|
-
|
|
3223
|
-
return
|
|
3240
|
+
effects.exit("codeFencedFence");
|
|
3241
|
+
return ok(code);
|
|
3224
3242
|
}
|
|
3225
|
-
return
|
|
3243
|
+
return nok(code);
|
|
3226
3244
|
}
|
|
3227
3245
|
}
|
|
3228
3246
|
}
|
|
@@ -3266,8 +3284,8 @@ function tokenizeCodeIndented(effects, ok, nok) {
|
|
|
3266
3284
|
}
|
|
3267
3285
|
function tokenizeFurtherStart(effects, ok, nok) {
|
|
3268
3286
|
const self = this;
|
|
3269
|
-
return
|
|
3270
|
-
function
|
|
3287
|
+
return furtherStart;
|
|
3288
|
+
function furtherStart(code) {
|
|
3271
3289
|
if (self.parser.lazy[self.now().line]) {
|
|
3272
3290
|
return nok(code);
|
|
3273
3291
|
}
|
|
@@ -3275,12 +3293,12 @@ function tokenizeFurtherStart(effects, ok, nok) {
|
|
|
3275
3293
|
effects.enter("lineEnding");
|
|
3276
3294
|
effects.consume(code);
|
|
3277
3295
|
effects.exit("lineEnding");
|
|
3278
|
-
return
|
|
3296
|
+
return furtherStart;
|
|
3279
3297
|
}
|
|
3280
3298
|
return factorySpaceMinMax(effects, ok, onNotEnoughPrefix, "linePrefix", 4, 4)(code);
|
|
3281
3299
|
}
|
|
3282
3300
|
function onNotEnoughPrefix(code) {
|
|
3283
|
-
return markdownLineEnding(code) ?
|
|
3301
|
+
return markdownLineEnding(code) ? furtherStart(code) : nok(code);
|
|
3284
3302
|
}
|
|
3285
3303
|
}
|
|
3286
3304
|
// node_modules/micromark-core-commonmark/lib/code-text.js
|
|
@@ -3567,7 +3585,7 @@ function subcontent(events, eventIndex) {
|
|
|
3567
3585
|
const jumps = [];
|
|
3568
3586
|
const gaps = {};
|
|
3569
3587
|
let stream;
|
|
3570
|
-
let
|
|
3588
|
+
let previous;
|
|
3571
3589
|
let index = -1;
|
|
3572
3590
|
let current = token;
|
|
3573
3591
|
let adjust = 0;
|
|
@@ -3581,7 +3599,7 @@ function subcontent(events, eventIndex) {
|
|
|
3581
3599
|
if (!current.next) {
|
|
3582
3600
|
stream.push(null);
|
|
3583
3601
|
}
|
|
3584
|
-
if (
|
|
3602
|
+
if (previous) {
|
|
3585
3603
|
tokenizer.defineSkip(current.start);
|
|
3586
3604
|
}
|
|
3587
3605
|
if (current._isInFirstContentOfListItem) {
|
|
@@ -3592,7 +3610,7 @@ function subcontent(events, eventIndex) {
|
|
|
3592
3610
|
tokenizer._gfmTasklistFirstContentOfListItem = undefined;
|
|
3593
3611
|
}
|
|
3594
3612
|
}
|
|
3595
|
-
|
|
3613
|
+
previous = current;
|
|
3596
3614
|
current = current.next;
|
|
3597
3615
|
}
|
|
3598
3616
|
current = token;
|
|
@@ -3615,9 +3633,9 @@ function subcontent(events, eventIndex) {
|
|
|
3615
3633
|
index = breaks.length;
|
|
3616
3634
|
while (index--) {
|
|
3617
3635
|
const slice = childEvents.slice(breaks[index], breaks[index + 1]);
|
|
3618
|
-
const
|
|
3619
|
-
jumps.push([
|
|
3620
|
-
events.splice(
|
|
3636
|
+
const start = startPositions.pop();
|
|
3637
|
+
jumps.push([start, start + slice.length - 1]);
|
|
3638
|
+
events.splice(start, 2, slice);
|
|
3621
3639
|
}
|
|
3622
3640
|
jumps.reverse();
|
|
3623
3641
|
index = -1;
|
|
@@ -3642,11 +3660,11 @@ function resolveContent(events) {
|
|
|
3642
3660
|
return events;
|
|
3643
3661
|
}
|
|
3644
3662
|
function tokenizeContent(effects, ok) {
|
|
3645
|
-
let
|
|
3663
|
+
let previous;
|
|
3646
3664
|
return chunkStart;
|
|
3647
3665
|
function chunkStart(code) {
|
|
3648
3666
|
effects.enter("content");
|
|
3649
|
-
|
|
3667
|
+
previous = effects.enter("chunkContent", {
|
|
3650
3668
|
contentType: "content"
|
|
3651
3669
|
});
|
|
3652
3670
|
return chunkInside(code);
|
|
@@ -3669,11 +3687,11 @@ function tokenizeContent(effects, ok) {
|
|
|
3669
3687
|
function contentContinue(code) {
|
|
3670
3688
|
effects.consume(code);
|
|
3671
3689
|
effects.exit("chunkContent");
|
|
3672
|
-
|
|
3690
|
+
previous.next = effects.enter("chunkContent", {
|
|
3673
3691
|
contentType: "content",
|
|
3674
|
-
previous
|
|
3692
|
+
previous
|
|
3675
3693
|
});
|
|
3676
|
-
|
|
3694
|
+
previous = previous.next;
|
|
3677
3695
|
return chunkInside;
|
|
3678
3696
|
}
|
|
3679
3697
|
}
|
|
@@ -3980,8 +3998,8 @@ function tokenizeDefinition(effects, ok, nok) {
|
|
|
3980
3998
|
}
|
|
3981
3999
|
}
|
|
3982
4000
|
function tokenizeTitleBefore(effects, ok, nok) {
|
|
3983
|
-
return
|
|
3984
|
-
function
|
|
4001
|
+
return titleBefore;
|
|
4002
|
+
function titleBefore(code) {
|
|
3985
4003
|
return markdownLineEndingOrSpace(code) ? factoryWhitespace(effects, beforeMarker)(code) : nok(code);
|
|
3986
4004
|
}
|
|
3987
4005
|
function beforeMarker(code) {
|
|
@@ -4033,7 +4051,7 @@ function resolveHeadingAtx(events, context) {
|
|
|
4033
4051
|
contentEnd -= contentStart + 1 === contentEnd ? 2 : 4;
|
|
4034
4052
|
}
|
|
4035
4053
|
if (contentEnd > contentStart) {
|
|
4036
|
-
const
|
|
4054
|
+
const content = {
|
|
4037
4055
|
type: "atxHeadingText",
|
|
4038
4056
|
start: events[contentStart][1].start,
|
|
4039
4057
|
end: events[contentEnd][1].end
|
|
@@ -4044,7 +4062,7 @@ function resolveHeadingAtx(events, context) {
|
|
|
4044
4062
|
end: events[contentEnd][1].end,
|
|
4045
4063
|
contentType: "text"
|
|
4046
4064
|
};
|
|
4047
|
-
splice(events, contentStart, contentEnd - contentStart + 1, [["enter",
|
|
4065
|
+
splice(events, contentStart, contentEnd - contentStart + 1, [["enter", content, context], ["enter", text, context], ["exit", text, context], ["exit", content, context]]);
|
|
4048
4066
|
}
|
|
4049
4067
|
return events;
|
|
4050
4068
|
}
|
|
@@ -5306,13 +5324,13 @@ var setextUnderline = {
|
|
|
5306
5324
|
function resolveToSetextUnderline(events, context) {
|
|
5307
5325
|
const editMap = new EditMap;
|
|
5308
5326
|
let index = events.length;
|
|
5309
|
-
let
|
|
5327
|
+
let content;
|
|
5310
5328
|
let text;
|
|
5311
|
-
let
|
|
5329
|
+
let definition;
|
|
5312
5330
|
while (index--) {
|
|
5313
5331
|
if (events[index][0] === "enter") {
|
|
5314
5332
|
if (events[index][1].type === "content") {
|
|
5315
|
-
|
|
5333
|
+
content = index;
|
|
5316
5334
|
break;
|
|
5317
5335
|
}
|
|
5318
5336
|
if (events[index][1].type === "paragraph") {
|
|
@@ -5322,29 +5340,29 @@ function resolveToSetextUnderline(events, context) {
|
|
|
5322
5340
|
if (events[index][1].type === "content") {
|
|
5323
5341
|
editMap.add(index, 1, []);
|
|
5324
5342
|
}
|
|
5325
|
-
if (!
|
|
5326
|
-
|
|
5343
|
+
if (!definition && events[index][1].type === "definition") {
|
|
5344
|
+
definition = index;
|
|
5327
5345
|
}
|
|
5328
5346
|
}
|
|
5329
5347
|
}
|
|
5330
5348
|
const heading = {
|
|
5331
5349
|
type: "setextHeading",
|
|
5332
5350
|
start: {
|
|
5333
|
-
...events[
|
|
5351
|
+
...events[content][1].start
|
|
5334
5352
|
},
|
|
5335
5353
|
end: {
|
|
5336
5354
|
...events[events.length - 1][1].end
|
|
5337
5355
|
}
|
|
5338
5356
|
};
|
|
5339
5357
|
events[text][1].type = "setextHeadingText";
|
|
5340
|
-
if (
|
|
5358
|
+
if (definition) {
|
|
5341
5359
|
editMap.add(text, 0, [["enter", heading, context]]);
|
|
5342
|
-
editMap.add(
|
|
5343
|
-
events[
|
|
5344
|
-
...events[
|
|
5360
|
+
editMap.add(definition + 1, 0, [["exit", events[content][1], context]]);
|
|
5361
|
+
events[content][1].end = {
|
|
5362
|
+
...events[definition][1].end
|
|
5345
5363
|
};
|
|
5346
5364
|
} else {
|
|
5347
|
-
events[
|
|
5365
|
+
events[content][1] = heading;
|
|
5348
5366
|
}
|
|
5349
5367
|
editMap.add(events.length, 0, [["exit", heading, context]]);
|
|
5350
5368
|
editMap.consume(events);
|
|
@@ -5435,11 +5453,11 @@ function initializeFactory(field) {
|
|
|
5435
5453
|
};
|
|
5436
5454
|
function initializeText(effects) {
|
|
5437
5455
|
const self = this;
|
|
5438
|
-
const
|
|
5439
|
-
const
|
|
5456
|
+
const constructs = this.parser.constructs[field];
|
|
5457
|
+
const text = effects.attempt(constructs, start, notText);
|
|
5440
5458
|
return start;
|
|
5441
5459
|
function start(code) {
|
|
5442
|
-
return atBreak(code) ?
|
|
5460
|
+
return atBreak(code) ? text(code) : notText(code);
|
|
5443
5461
|
}
|
|
5444
5462
|
function notText(code) {
|
|
5445
5463
|
if (code === null) {
|
|
@@ -5453,7 +5471,7 @@ function initializeFactory(field) {
|
|
|
5453
5471
|
function data(code) {
|
|
5454
5472
|
if (atBreak(code)) {
|
|
5455
5473
|
effects.exit("data");
|
|
5456
|
-
return
|
|
5474
|
+
return text(code);
|
|
5457
5475
|
}
|
|
5458
5476
|
effects.consume(code);
|
|
5459
5477
|
return data;
|
|
@@ -5462,11 +5480,11 @@ function initializeFactory(field) {
|
|
|
5462
5480
|
if (code === null) {
|
|
5463
5481
|
return true;
|
|
5464
5482
|
}
|
|
5465
|
-
const
|
|
5483
|
+
const list = constructs[code];
|
|
5466
5484
|
let index = -1;
|
|
5467
|
-
if (
|
|
5468
|
-
while (++index <
|
|
5469
|
-
const item =
|
|
5485
|
+
if (list) {
|
|
5486
|
+
while (++index < list.length) {
|
|
5487
|
+
const item = list[index];
|
|
5470
5488
|
if (!item.previous || item.previous.call(self, self.previous)) {
|
|
5471
5489
|
return true;
|
|
5472
5490
|
}
|
|
@@ -5564,18 +5582,6 @@ function resolveAllLineSuffixes(events, context) {
|
|
|
5564
5582
|
}
|
|
5565
5583
|
|
|
5566
5584
|
// node_modules/micromark/lib/constructs.js
|
|
5567
|
-
var exports_constructs = {};
|
|
5568
|
-
__export(exports_constructs, {
|
|
5569
|
-
text: () => text2,
|
|
5570
|
-
string: () => string2,
|
|
5571
|
-
insideSpan: () => insideSpan,
|
|
5572
|
-
flowInitial: () => flowInitial,
|
|
5573
|
-
flow: () => flow2,
|
|
5574
|
-
document: () => document2,
|
|
5575
|
-
disable: () => disable,
|
|
5576
|
-
contentInitial: () => contentInitial,
|
|
5577
|
-
attentionMarkers: () => attentionMarkers
|
|
5578
|
-
});
|
|
5579
5585
|
var document2 = {
|
|
5580
5586
|
[42]: list,
|
|
5581
5587
|
[43]: list,
|
|
@@ -5657,7 +5663,7 @@ function createTokenizer(parser, initialize, from) {
|
|
|
5657
5663
|
check: constructFactory(onsuccessfulcheck),
|
|
5658
5664
|
consume,
|
|
5659
5665
|
enter,
|
|
5660
|
-
exit
|
|
5666
|
+
exit,
|
|
5661
5667
|
interrupt: constructFactory(onsuccessfulcheck, {
|
|
5662
5668
|
interrupt: true
|
|
5663
5669
|
})
|
|
@@ -5767,7 +5773,7 @@ function createTokenizer(parser, initialize, from) {
|
|
|
5767
5773
|
stack.push(token);
|
|
5768
5774
|
return token;
|
|
5769
5775
|
}
|
|
5770
|
-
function
|
|
5776
|
+
function exit(type) {
|
|
5771
5777
|
const token = stack.pop();
|
|
5772
5778
|
token.end = now();
|
|
5773
5779
|
context.events.push(["exit", token, context]);
|
|
@@ -5781,31 +5787,31 @@ function createTokenizer(parser, initialize, from) {
|
|
|
5781
5787
|
}
|
|
5782
5788
|
function constructFactory(onreturn, fields) {
|
|
5783
5789
|
return hook;
|
|
5784
|
-
function hook(
|
|
5790
|
+
function hook(constructs, returnState, bogusState) {
|
|
5785
5791
|
let listOfConstructs;
|
|
5786
5792
|
let constructIndex;
|
|
5787
5793
|
let currentConstruct;
|
|
5788
5794
|
let info;
|
|
5789
|
-
return Array.isArray(
|
|
5795
|
+
return Array.isArray(constructs) ? handleListOfConstructs(constructs) : ("tokenize" in constructs) ? handleListOfConstructs([constructs]) : handleMapOfConstructs(constructs);
|
|
5790
5796
|
function handleMapOfConstructs(map) {
|
|
5791
5797
|
return start;
|
|
5792
5798
|
function start(code) {
|
|
5793
5799
|
const left = code !== null && map[code];
|
|
5794
|
-
const
|
|
5795
|
-
const
|
|
5800
|
+
const all = code !== null && map.null;
|
|
5801
|
+
const list = [
|
|
5796
5802
|
...Array.isArray(left) ? left : left ? [left] : [],
|
|
5797
|
-
...Array.isArray(
|
|
5803
|
+
...Array.isArray(all) ? all : all ? [all] : []
|
|
5798
5804
|
];
|
|
5799
|
-
return handleListOfConstructs(
|
|
5805
|
+
return handleListOfConstructs(list)(code);
|
|
5800
5806
|
}
|
|
5801
5807
|
}
|
|
5802
|
-
function handleListOfConstructs(
|
|
5803
|
-
listOfConstructs =
|
|
5808
|
+
function handleListOfConstructs(list) {
|
|
5809
|
+
listOfConstructs = list;
|
|
5804
5810
|
constructIndex = 0;
|
|
5805
|
-
if (
|
|
5811
|
+
if (list.length === 0) {
|
|
5806
5812
|
return bogusState;
|
|
5807
5813
|
}
|
|
5808
|
-
return handleConstruct(
|
|
5814
|
+
return handleConstruct(list[constructIndex]);
|
|
5809
5815
|
}
|
|
5810
5816
|
function handleConstruct(construct) {
|
|
5811
5817
|
return start;
|
|
@@ -5836,12 +5842,12 @@ function createTokenizer(parser, initialize, from) {
|
|
|
5836
5842
|
}
|
|
5837
5843
|
}
|
|
5838
5844
|
}
|
|
5839
|
-
function addResult(construct,
|
|
5845
|
+
function addResult(construct, from) {
|
|
5840
5846
|
if (construct.resolveAll && !resolveAllConstructs.includes(construct)) {
|
|
5841
5847
|
resolveAllConstructs.push(construct);
|
|
5842
5848
|
}
|
|
5843
5849
|
if (construct.resolve) {
|
|
5844
|
-
splice(context.events,
|
|
5850
|
+
splice(context.events, from, context.events.length - from, construct.resolve(context.events.slice(from), context));
|
|
5845
5851
|
}
|
|
5846
5852
|
if (construct.resolveTo) {
|
|
5847
5853
|
context.events = construct.resolveTo(context.events, context);
|
|
@@ -5947,9 +5953,9 @@ function serializeChunks(chunks, expandTabs) {
|
|
|
5947
5953
|
// node_modules/micromark/lib/parse.js
|
|
5948
5954
|
function parse(options) {
|
|
5949
5955
|
const settings = options || {};
|
|
5950
|
-
const
|
|
5956
|
+
const constructs = combineExtensions([exports_constructs, ...settings.extensions || []]);
|
|
5951
5957
|
const parser = {
|
|
5952
|
-
constructs
|
|
5958
|
+
constructs,
|
|
5953
5959
|
content: create(content),
|
|
5954
5960
|
defined: [],
|
|
5955
5961
|
document: create(document),
|
|
@@ -6063,8 +6069,8 @@ function decode($0, $1, $2) {
|
|
|
6063
6069
|
}
|
|
6064
6070
|
const head = $2.charCodeAt(0);
|
|
6065
6071
|
if (head === 35) {
|
|
6066
|
-
const
|
|
6067
|
-
const hex =
|
|
6072
|
+
const head = $2.charCodeAt(1);
|
|
6073
|
+
const hex = head === 120 || head === 88;
|
|
6068
6074
|
return decodeNumericCharacterReference($2.slice(hex ? 2 : 1), hex ? 16 : 10);
|
|
6069
6075
|
}
|
|
6070
6076
|
return decodeNamedCharacterReference($2) || $0;
|
|
@@ -6086,8 +6092,8 @@ function stringifyPosition(value) {
|
|
|
6086
6092
|
}
|
|
6087
6093
|
return "";
|
|
6088
6094
|
}
|
|
6089
|
-
function point(
|
|
6090
|
-
return index(
|
|
6095
|
+
function point(point) {
|
|
6096
|
+
return index(point && point.line) + ":" + index(point && point.column);
|
|
6091
6097
|
}
|
|
6092
6098
|
function position(pos) {
|
|
6093
6099
|
return point(pos && pos.start) + "-" + point(pos && pos.end);
|
|
@@ -6115,18 +6121,18 @@ function compiler(options) {
|
|
|
6115
6121
|
autolinkProtocol: onenterdata,
|
|
6116
6122
|
autolinkEmail: onenterdata,
|
|
6117
6123
|
atxHeading: opener(heading),
|
|
6118
|
-
blockQuote: opener(
|
|
6124
|
+
blockQuote: opener(blockQuote),
|
|
6119
6125
|
characterEscape: onenterdata,
|
|
6120
6126
|
characterReference: onenterdata,
|
|
6121
6127
|
codeFenced: opener(codeFlow),
|
|
6122
6128
|
codeFencedFenceInfo: buffer,
|
|
6123
6129
|
codeFencedFenceMeta: buffer,
|
|
6124
6130
|
codeIndented: opener(codeFlow, buffer),
|
|
6125
|
-
codeText: opener(
|
|
6131
|
+
codeText: opener(codeText, buffer),
|
|
6126
6132
|
codeTextData: onenterdata,
|
|
6127
6133
|
data: onenterdata,
|
|
6128
6134
|
codeFlowValue: onenterdata,
|
|
6129
|
-
definition: opener(
|
|
6135
|
+
definition: opener(definition),
|
|
6130
6136
|
definitionDestinationString: buffer,
|
|
6131
6137
|
definitionLabelString: buffer,
|
|
6132
6138
|
definitionTitleString: buffer,
|
|
@@ -6142,8 +6148,8 @@ function compiler(options) {
|
|
|
6142
6148
|
link: opener(link),
|
|
6143
6149
|
listItem: opener(listItem),
|
|
6144
6150
|
listItemValue: onenterlistitemvalue,
|
|
6145
|
-
listOrdered: opener(
|
|
6146
|
-
listUnordered: opener(
|
|
6151
|
+
listOrdered: opener(list, onenterlistordered),
|
|
6152
|
+
listUnordered: opener(list),
|
|
6147
6153
|
paragraph: opener(paragraph),
|
|
6148
6154
|
reference: onenterreference,
|
|
6149
6155
|
referenceString: buffer,
|
|
@@ -6151,7 +6157,7 @@ function compiler(options) {
|
|
|
6151
6157
|
resourceTitleString: buffer,
|
|
6152
6158
|
setextHeading: opener(heading),
|
|
6153
6159
|
strong: opener(strong),
|
|
6154
|
-
thematicBreak: opener(
|
|
6160
|
+
thematicBreak: opener(thematicBreak)
|
|
6155
6161
|
},
|
|
6156
6162
|
exit: {
|
|
6157
6163
|
atxHeading: closer(),
|
|
@@ -6219,18 +6225,18 @@ function compiler(options) {
|
|
|
6219
6225
|
tokenStack: [],
|
|
6220
6226
|
config,
|
|
6221
6227
|
enter,
|
|
6222
|
-
exit
|
|
6228
|
+
exit,
|
|
6223
6229
|
buffer,
|
|
6224
6230
|
resume,
|
|
6225
6231
|
data
|
|
6226
6232
|
};
|
|
6227
6233
|
const listStack = [];
|
|
6228
6234
|
const prepared = [];
|
|
6229
|
-
let
|
|
6230
|
-
while (++
|
|
6231
|
-
prepared.push(events[
|
|
6232
|
-
if (events[
|
|
6233
|
-
if (events[
|
|
6235
|
+
let index = -1;
|
|
6236
|
+
while (++index < events.length) {
|
|
6237
|
+
prepared.push(events[index]);
|
|
6238
|
+
if (events[index][1].type === "listOrdered" || events[index][1].type === "listUnordered") {
|
|
6239
|
+
if (events[index][0] === "enter") {
|
|
6234
6240
|
listStack.push(prepared.length - 1);
|
|
6235
6241
|
} else {
|
|
6236
6242
|
const tail = listStack.pop();
|
|
@@ -6239,26 +6245,26 @@ function compiler(options) {
|
|
|
6239
6245
|
}
|
|
6240
6246
|
}
|
|
6241
6247
|
events = prepared;
|
|
6242
|
-
|
|
6243
|
-
while (++
|
|
6244
|
-
const handler = config[events[
|
|
6245
|
-
if (events[
|
|
6248
|
+
index = -1;
|
|
6249
|
+
while (++index < events.length) {
|
|
6250
|
+
const handler = config[events[index][0]];
|
|
6251
|
+
if (events[index][0] === "enter" && config.beforeEnter.length > 0) {
|
|
6246
6252
|
callListeners(config.beforeEnter, {
|
|
6247
6253
|
...context,
|
|
6248
|
-
sliceSerialize: events[
|
|
6249
|
-
}, events[
|
|
6254
|
+
sliceSerialize: events[index][2].sliceSerialize
|
|
6255
|
+
}, events[index][1]);
|
|
6250
6256
|
}
|
|
6251
|
-
if (own2.call(handler, events[
|
|
6252
|
-
handler[events[
|
|
6257
|
+
if (own2.call(handler, events[index][1].type)) {
|
|
6258
|
+
handler[events[index][1].type].call({
|
|
6253
6259
|
...context,
|
|
6254
|
-
sliceSerialize: events[
|
|
6255
|
-
}, events[
|
|
6260
|
+
sliceSerialize: events[index][2].sliceSerialize
|
|
6261
|
+
}, events[index][1]);
|
|
6256
6262
|
}
|
|
6257
|
-
if (events[
|
|
6263
|
+
if (events[index][0] === "exit" && config.afterExit.length > 0) {
|
|
6258
6264
|
callListeners(config.afterExit, {
|
|
6259
6265
|
...context,
|
|
6260
|
-
sliceSerialize: events[
|
|
6261
|
-
}, events[
|
|
6266
|
+
sliceSerialize: events[index][2].sliceSerialize
|
|
6267
|
+
}, events[index][1]);
|
|
6262
6268
|
}
|
|
6263
6269
|
}
|
|
6264
6270
|
if (context.tokenStack.length > 0) {
|
|
@@ -6278,30 +6284,30 @@ function compiler(options) {
|
|
|
6278
6284
|
offset: 0
|
|
6279
6285
|
})
|
|
6280
6286
|
};
|
|
6281
|
-
|
|
6282
|
-
while (++
|
|
6283
|
-
tree = config.transforms[
|
|
6287
|
+
index = -1;
|
|
6288
|
+
while (++index < config.transforms.length) {
|
|
6289
|
+
tree = config.transforms[index](tree) || tree;
|
|
6284
6290
|
}
|
|
6285
6291
|
return tree;
|
|
6286
6292
|
}
|
|
6287
6293
|
function callListeners(listeners, context, token) {
|
|
6288
|
-
let
|
|
6289
|
-
while (++
|
|
6290
|
-
listeners[
|
|
6294
|
+
let index = -1;
|
|
6295
|
+
while (++index < listeners.length) {
|
|
6296
|
+
listeners[index].call(context, token);
|
|
6291
6297
|
}
|
|
6292
6298
|
}
|
|
6293
6299
|
function prepareList(events, start) {
|
|
6294
6300
|
const end = events.length - 1;
|
|
6295
|
-
let
|
|
6301
|
+
let index = start - 1;
|
|
6296
6302
|
let containerBalance = -1;
|
|
6297
6303
|
let listSpread = false;
|
|
6298
|
-
let
|
|
6304
|
+
let listItem;
|
|
6299
6305
|
let lineIndex;
|
|
6300
6306
|
let firstBlankLineIndex;
|
|
6301
6307
|
let atMarker;
|
|
6302
6308
|
const insertions = [];
|
|
6303
|
-
while (++
|
|
6304
|
-
const event = events[
|
|
6309
|
+
while (++index <= end) {
|
|
6310
|
+
const event = events[index];
|
|
6305
6311
|
switch (event[1].type) {
|
|
6306
6312
|
case "listUnordered":
|
|
6307
6313
|
case "listOrdered":
|
|
@@ -6316,8 +6322,8 @@ function compiler(options) {
|
|
|
6316
6322
|
}
|
|
6317
6323
|
case "lineEndingBlank": {
|
|
6318
6324
|
if (event[0] === "enter") {
|
|
6319
|
-
if (
|
|
6320
|
-
firstBlankLineIndex =
|
|
6325
|
+
if (listItem && !atMarker && !containerBalance && !firstBlankLineIndex) {
|
|
6326
|
+
firstBlankLineIndex = index;
|
|
6321
6327
|
}
|
|
6322
6328
|
atMarker = undefined;
|
|
6323
6329
|
}
|
|
@@ -6335,8 +6341,8 @@ function compiler(options) {
|
|
|
6335
6341
|
}
|
|
6336
6342
|
}
|
|
6337
6343
|
if (!containerBalance && event[0] === "enter" && event[1].type === "listItemPrefix" || containerBalance === -1 && event[0] === "exit" && (event[1].type === "listUnordered" || event[1].type === "listOrdered")) {
|
|
6338
|
-
if (
|
|
6339
|
-
let tailIndex =
|
|
6344
|
+
if (listItem) {
|
|
6345
|
+
let tailIndex = index;
|
|
6340
6346
|
lineIndex = undefined;
|
|
6341
6347
|
while (tailIndex--) {
|
|
6342
6348
|
const tailEvent = events[tailIndex];
|
|
@@ -6354,12 +6360,12 @@ function compiler(options) {
|
|
|
6354
6360
|
}
|
|
6355
6361
|
}
|
|
6356
6362
|
if (firstBlankLineIndex && (!lineIndex || firstBlankLineIndex < lineIndex)) {
|
|
6357
|
-
|
|
6363
|
+
listItem._spread = true;
|
|
6358
6364
|
}
|
|
6359
|
-
|
|
6365
|
+
listItem.end = Object.assign({}, lineIndex ? events[lineIndex][1].start : event[1].end);
|
|
6360
6366
|
insertions.push({
|
|
6361
|
-
at: lineIndex ||
|
|
6362
|
-
event: ["exit",
|
|
6367
|
+
at: lineIndex || index,
|
|
6368
|
+
event: ["exit", listItem, event[2]]
|
|
6363
6369
|
});
|
|
6364
6370
|
}
|
|
6365
6371
|
if (event[1].type === "listItemPrefix") {
|
|
@@ -6369,9 +6375,9 @@ function compiler(options) {
|
|
|
6369
6375
|
start: Object.assign({}, event[1].start),
|
|
6370
6376
|
end: undefined
|
|
6371
6377
|
};
|
|
6372
|
-
|
|
6378
|
+
listItem = item;
|
|
6373
6379
|
insertions.push({
|
|
6374
|
-
at:
|
|
6380
|
+
at: index,
|
|
6375
6381
|
event: ["enter", item, event[2]]
|
|
6376
6382
|
});
|
|
6377
6383
|
firstBlankLineIndex = undefined;
|
|
@@ -6381,12 +6387,12 @@ function compiler(options) {
|
|
|
6381
6387
|
}
|
|
6382
6388
|
const listEvents = events.splice(start);
|
|
6383
6389
|
let insertion = 0;
|
|
6384
|
-
|
|
6385
|
-
while (++
|
|
6386
|
-
while (insertion < insertions.length && insertions[insertion].at === start +
|
|
6390
|
+
index = -1;
|
|
6391
|
+
while (++index < listEvents.length) {
|
|
6392
|
+
while (insertion < insertions.length && insertions[insertion].at === start + index) {
|
|
6387
6393
|
events.push(insertions[insertion++].event);
|
|
6388
6394
|
}
|
|
6389
|
-
events.push(listEvents[
|
|
6395
|
+
events.push(listEvents[index]);
|
|
6390
6396
|
}
|
|
6391
6397
|
events[start][1]._spread = listSpread;
|
|
6392
6398
|
}
|
|
@@ -6404,13 +6410,13 @@ function compiler(options) {
|
|
|
6404
6410
|
children: []
|
|
6405
6411
|
});
|
|
6406
6412
|
}
|
|
6407
|
-
function enter(
|
|
6413
|
+
function enter(node, token, errorHandler) {
|
|
6408
6414
|
const parent = this.stack[this.stack.length - 1];
|
|
6409
6415
|
const siblings = parent.children;
|
|
6410
|
-
siblings.push(
|
|
6411
|
-
this.stack.push(
|
|
6416
|
+
siblings.push(node);
|
|
6417
|
+
this.stack.push(node);
|
|
6412
6418
|
this.tokenStack.push([token, errorHandler || undefined]);
|
|
6413
|
-
|
|
6419
|
+
node.position = {
|
|
6414
6420
|
start: point2(token.start),
|
|
6415
6421
|
end: undefined
|
|
6416
6422
|
};
|
|
@@ -6420,11 +6426,11 @@ function compiler(options) {
|
|
|
6420
6426
|
function close(token) {
|
|
6421
6427
|
if (and)
|
|
6422
6428
|
and.call(this, token);
|
|
6423
|
-
|
|
6429
|
+
exit.call(this, token);
|
|
6424
6430
|
}
|
|
6425
6431
|
}
|
|
6426
|
-
function
|
|
6427
|
-
const
|
|
6432
|
+
function exit(token, onExitError) {
|
|
6433
|
+
const node = this.stack.pop();
|
|
6428
6434
|
const open = this.tokenStack.pop();
|
|
6429
6435
|
if (!open) {
|
|
6430
6436
|
throw new Error("Cannot close `" + token.type + "` (" + stringifyPosition({
|
|
@@ -6440,7 +6446,7 @@ function compiler(options) {
|
|
|
6440
6446
|
handler.call(this, token, open[0]);
|
|
6441
6447
|
}
|
|
6442
6448
|
}
|
|
6443
|
-
|
|
6449
|
+
node.position.end = point2(token.end);
|
|
6444
6450
|
}
|
|
6445
6451
|
function resume() {
|
|
6446
6452
|
return toString(this.stack.pop());
|
|
@@ -6456,14 +6462,14 @@ function compiler(options) {
|
|
|
6456
6462
|
}
|
|
6457
6463
|
}
|
|
6458
6464
|
function onexitcodefencedfenceinfo() {
|
|
6459
|
-
const
|
|
6460
|
-
const
|
|
6461
|
-
|
|
6465
|
+
const data = this.resume();
|
|
6466
|
+
const node = this.stack[this.stack.length - 1];
|
|
6467
|
+
node.lang = data;
|
|
6462
6468
|
}
|
|
6463
6469
|
function onexitcodefencedfencemeta() {
|
|
6464
|
-
const
|
|
6465
|
-
const
|
|
6466
|
-
|
|
6470
|
+
const data = this.resume();
|
|
6471
|
+
const node = this.stack[this.stack.length - 1];
|
|
6472
|
+
node.meta = data;
|
|
6467
6473
|
}
|
|
6468
6474
|
function onexitcodefencedfence() {
|
|
6469
6475
|
if (this.data.flowCodeInside)
|
|
@@ -6472,55 +6478,55 @@ function compiler(options) {
|
|
|
6472
6478
|
this.data.flowCodeInside = true;
|
|
6473
6479
|
}
|
|
6474
6480
|
function onexitcodefenced() {
|
|
6475
|
-
const
|
|
6476
|
-
const
|
|
6477
|
-
|
|
6481
|
+
const data = this.resume();
|
|
6482
|
+
const node = this.stack[this.stack.length - 1];
|
|
6483
|
+
node.value = data.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g, "");
|
|
6478
6484
|
this.data.flowCodeInside = undefined;
|
|
6479
6485
|
}
|
|
6480
6486
|
function onexitcodeindented() {
|
|
6481
|
-
const
|
|
6482
|
-
const
|
|
6483
|
-
|
|
6487
|
+
const data = this.resume();
|
|
6488
|
+
const node = this.stack[this.stack.length - 1];
|
|
6489
|
+
node.value = data.replace(/(\r?\n|\r)$/g, "");
|
|
6484
6490
|
}
|
|
6485
6491
|
function onexitdefinitionlabelstring(token) {
|
|
6486
6492
|
const label = this.resume();
|
|
6487
|
-
const
|
|
6488
|
-
|
|
6489
|
-
|
|
6493
|
+
const node = this.stack[this.stack.length - 1];
|
|
6494
|
+
node.label = label;
|
|
6495
|
+
node.identifier = normalizeIdentifier(this.sliceSerialize(token)).toLowerCase();
|
|
6490
6496
|
}
|
|
6491
6497
|
function onexitdefinitiontitlestring() {
|
|
6492
|
-
const
|
|
6493
|
-
const
|
|
6494
|
-
|
|
6498
|
+
const data = this.resume();
|
|
6499
|
+
const node = this.stack[this.stack.length - 1];
|
|
6500
|
+
node.title = data;
|
|
6495
6501
|
}
|
|
6496
6502
|
function onexitdefinitiondestinationstring() {
|
|
6497
|
-
const
|
|
6498
|
-
const
|
|
6499
|
-
|
|
6503
|
+
const data = this.resume();
|
|
6504
|
+
const node = this.stack[this.stack.length - 1];
|
|
6505
|
+
node.url = data;
|
|
6500
6506
|
}
|
|
6501
6507
|
function onexitatxheadingsequence(token) {
|
|
6502
|
-
const
|
|
6503
|
-
if (!
|
|
6508
|
+
const node = this.stack[this.stack.length - 1];
|
|
6509
|
+
if (!node.depth) {
|
|
6504
6510
|
const depth = this.sliceSerialize(token).length;
|
|
6505
|
-
|
|
6511
|
+
node.depth = depth;
|
|
6506
6512
|
}
|
|
6507
6513
|
}
|
|
6508
6514
|
function onexitsetextheadingtext() {
|
|
6509
6515
|
this.data.setextHeadingSlurpLineEnding = true;
|
|
6510
6516
|
}
|
|
6511
6517
|
function onexitsetextheadinglinesequence(token) {
|
|
6512
|
-
const
|
|
6513
|
-
|
|
6518
|
+
const node = this.stack[this.stack.length - 1];
|
|
6519
|
+
node.depth = this.sliceSerialize(token).codePointAt(0) === 61 ? 1 : 2;
|
|
6514
6520
|
}
|
|
6515
6521
|
function onexitsetextheading() {
|
|
6516
6522
|
this.data.setextHeadingSlurpLineEnding = undefined;
|
|
6517
6523
|
}
|
|
6518
6524
|
function onenterdata(token) {
|
|
6519
|
-
const
|
|
6520
|
-
const siblings =
|
|
6525
|
+
const node = this.stack[this.stack.length - 1];
|
|
6526
|
+
const siblings = node.children;
|
|
6521
6527
|
let tail = siblings[siblings.length - 1];
|
|
6522
6528
|
if (!tail || tail.type !== "text") {
|
|
6523
|
-
tail =
|
|
6529
|
+
tail = text();
|
|
6524
6530
|
tail.position = {
|
|
6525
6531
|
start: point2(token.start),
|
|
6526
6532
|
end: undefined
|
|
@@ -6551,75 +6557,75 @@ function compiler(options) {
|
|
|
6551
6557
|
this.data.atHardBreak = true;
|
|
6552
6558
|
}
|
|
6553
6559
|
function onexithtmlflow() {
|
|
6554
|
-
const
|
|
6555
|
-
const
|
|
6556
|
-
|
|
6560
|
+
const data = this.resume();
|
|
6561
|
+
const node = this.stack[this.stack.length - 1];
|
|
6562
|
+
node.value = data;
|
|
6557
6563
|
}
|
|
6558
6564
|
function onexithtmltext() {
|
|
6559
|
-
const
|
|
6560
|
-
const
|
|
6561
|
-
|
|
6565
|
+
const data = this.resume();
|
|
6566
|
+
const node = this.stack[this.stack.length - 1];
|
|
6567
|
+
node.value = data;
|
|
6562
6568
|
}
|
|
6563
6569
|
function onexitcodetext() {
|
|
6564
|
-
const
|
|
6565
|
-
const
|
|
6566
|
-
|
|
6570
|
+
const data = this.resume();
|
|
6571
|
+
const node = this.stack[this.stack.length - 1];
|
|
6572
|
+
node.value = data;
|
|
6567
6573
|
}
|
|
6568
6574
|
function onexitlink() {
|
|
6569
|
-
const
|
|
6575
|
+
const node = this.stack[this.stack.length - 1];
|
|
6570
6576
|
if (this.data.inReference) {
|
|
6571
6577
|
const referenceType = this.data.referenceType || "shortcut";
|
|
6572
|
-
|
|
6573
|
-
|
|
6574
|
-
delete
|
|
6575
|
-
delete
|
|
6578
|
+
node.type += "Reference";
|
|
6579
|
+
node.referenceType = referenceType;
|
|
6580
|
+
delete node.url;
|
|
6581
|
+
delete node.title;
|
|
6576
6582
|
} else {
|
|
6577
|
-
delete
|
|
6578
|
-
delete
|
|
6583
|
+
delete node.identifier;
|
|
6584
|
+
delete node.label;
|
|
6579
6585
|
}
|
|
6580
6586
|
this.data.referenceType = undefined;
|
|
6581
6587
|
}
|
|
6582
6588
|
function onexitimage() {
|
|
6583
|
-
const
|
|
6589
|
+
const node = this.stack[this.stack.length - 1];
|
|
6584
6590
|
if (this.data.inReference) {
|
|
6585
6591
|
const referenceType = this.data.referenceType || "shortcut";
|
|
6586
|
-
|
|
6587
|
-
|
|
6588
|
-
delete
|
|
6589
|
-
delete
|
|
6592
|
+
node.type += "Reference";
|
|
6593
|
+
node.referenceType = referenceType;
|
|
6594
|
+
delete node.url;
|
|
6595
|
+
delete node.title;
|
|
6590
6596
|
} else {
|
|
6591
|
-
delete
|
|
6592
|
-
delete
|
|
6597
|
+
delete node.identifier;
|
|
6598
|
+
delete node.label;
|
|
6593
6599
|
}
|
|
6594
6600
|
this.data.referenceType = undefined;
|
|
6595
6601
|
}
|
|
6596
6602
|
function onexitlabeltext(token) {
|
|
6597
|
-
const
|
|
6603
|
+
const string = this.sliceSerialize(token);
|
|
6598
6604
|
const ancestor = this.stack[this.stack.length - 2];
|
|
6599
|
-
ancestor.label = decodeString(
|
|
6600
|
-
ancestor.identifier = normalizeIdentifier(
|
|
6605
|
+
ancestor.label = decodeString(string);
|
|
6606
|
+
ancestor.identifier = normalizeIdentifier(string).toLowerCase();
|
|
6601
6607
|
}
|
|
6602
6608
|
function onexitlabel() {
|
|
6603
6609
|
const fragment = this.stack[this.stack.length - 1];
|
|
6604
6610
|
const value = this.resume();
|
|
6605
|
-
const
|
|
6611
|
+
const node = this.stack[this.stack.length - 1];
|
|
6606
6612
|
this.data.inReference = true;
|
|
6607
|
-
if (
|
|
6613
|
+
if (node.type === "link") {
|
|
6608
6614
|
const children = fragment.children;
|
|
6609
|
-
|
|
6615
|
+
node.children = children;
|
|
6610
6616
|
} else {
|
|
6611
|
-
|
|
6617
|
+
node.alt = value;
|
|
6612
6618
|
}
|
|
6613
6619
|
}
|
|
6614
6620
|
function onexitresourcedestinationstring() {
|
|
6615
|
-
const
|
|
6616
|
-
const
|
|
6617
|
-
|
|
6621
|
+
const data = this.resume();
|
|
6622
|
+
const node = this.stack[this.stack.length - 1];
|
|
6623
|
+
node.url = data;
|
|
6618
6624
|
}
|
|
6619
6625
|
function onexitresourcetitlestring() {
|
|
6620
|
-
const
|
|
6621
|
-
const
|
|
6622
|
-
|
|
6626
|
+
const data = this.resume();
|
|
6627
|
+
const node = this.stack[this.stack.length - 1];
|
|
6628
|
+
node.title = data;
|
|
6623
6629
|
}
|
|
6624
6630
|
function onexitresource() {
|
|
6625
6631
|
this.data.inReference = undefined;
|
|
@@ -6629,23 +6635,23 @@ function compiler(options) {
|
|
|
6629
6635
|
}
|
|
6630
6636
|
function onexitreferencestring(token) {
|
|
6631
6637
|
const label = this.resume();
|
|
6632
|
-
const
|
|
6633
|
-
|
|
6634
|
-
|
|
6638
|
+
const node = this.stack[this.stack.length - 1];
|
|
6639
|
+
node.label = label;
|
|
6640
|
+
node.identifier = normalizeIdentifier(this.sliceSerialize(token)).toLowerCase();
|
|
6635
6641
|
this.data.referenceType = "full";
|
|
6636
6642
|
}
|
|
6637
6643
|
function onexitcharacterreferencemarker(token) {
|
|
6638
6644
|
this.data.characterReferenceType = token.type;
|
|
6639
6645
|
}
|
|
6640
6646
|
function onexitcharacterreferencevalue(token) {
|
|
6641
|
-
const
|
|
6647
|
+
const data = this.sliceSerialize(token);
|
|
6642
6648
|
const type = this.data.characterReferenceType;
|
|
6643
6649
|
let value;
|
|
6644
6650
|
if (type) {
|
|
6645
|
-
value = decodeNumericCharacterReference(
|
|
6651
|
+
value = decodeNumericCharacterReference(data, type === "characterReferenceMarkerNumeric" ? 10 : 16);
|
|
6646
6652
|
this.data.characterReferenceType = undefined;
|
|
6647
6653
|
} else {
|
|
6648
|
-
const result = decodeNamedCharacterReference(
|
|
6654
|
+
const result = decodeNamedCharacterReference(data);
|
|
6649
6655
|
value = result;
|
|
6650
6656
|
}
|
|
6651
6657
|
const tail = this.stack[this.stack.length - 1];
|
|
@@ -6657,15 +6663,15 @@ function compiler(options) {
|
|
|
6657
6663
|
}
|
|
6658
6664
|
function onexitautolinkprotocol(token) {
|
|
6659
6665
|
onexitdata.call(this, token);
|
|
6660
|
-
const
|
|
6661
|
-
|
|
6666
|
+
const node = this.stack[this.stack.length - 1];
|
|
6667
|
+
node.url = this.sliceSerialize(token);
|
|
6662
6668
|
}
|
|
6663
6669
|
function onexitautolinkemail(token) {
|
|
6664
6670
|
onexitdata.call(this, token);
|
|
6665
|
-
const
|
|
6666
|
-
|
|
6671
|
+
const node = this.stack[this.stack.length - 1];
|
|
6672
|
+
node.url = "mailto:" + this.sliceSerialize(token);
|
|
6667
6673
|
}
|
|
6668
|
-
function
|
|
6674
|
+
function blockQuote() {
|
|
6669
6675
|
return {
|
|
6670
6676
|
type: "blockquote",
|
|
6671
6677
|
children: [],
|
|
@@ -6681,14 +6687,14 @@ function compiler(options) {
|
|
|
6681
6687
|
position: undefined
|
|
6682
6688
|
};
|
|
6683
6689
|
}
|
|
6684
|
-
function
|
|
6690
|
+
function codeText() {
|
|
6685
6691
|
return {
|
|
6686
6692
|
type: "inlineCode",
|
|
6687
6693
|
value: "",
|
|
6688
6694
|
position: undefined
|
|
6689
6695
|
};
|
|
6690
6696
|
}
|
|
6691
|
-
function
|
|
6697
|
+
function definition() {
|
|
6692
6698
|
return {
|
|
6693
6699
|
type: "definition",
|
|
6694
6700
|
identifier: "",
|
|
@@ -6744,7 +6750,7 @@ function compiler(options) {
|
|
|
6744
6750
|
position: undefined
|
|
6745
6751
|
};
|
|
6746
6752
|
}
|
|
6747
|
-
function
|
|
6753
|
+
function list(token) {
|
|
6748
6754
|
return {
|
|
6749
6755
|
type: "list",
|
|
6750
6756
|
ordered: token.type === "listOrdered",
|
|
@@ -6777,14 +6783,14 @@ function compiler(options) {
|
|
|
6777
6783
|
position: undefined
|
|
6778
6784
|
};
|
|
6779
6785
|
}
|
|
6780
|
-
function
|
|
6786
|
+
function text() {
|
|
6781
6787
|
return {
|
|
6782
6788
|
type: "text",
|
|
6783
6789
|
value: "",
|
|
6784
6790
|
position: undefined
|
|
6785
6791
|
};
|
|
6786
6792
|
}
|
|
6787
|
-
function
|
|
6793
|
+
function thematicBreak() {
|
|
6788
6794
|
return {
|
|
6789
6795
|
type: "thematicBreak",
|
|
6790
6796
|
position: undefined
|
|
@@ -6799,9 +6805,9 @@ function point2(d) {
|
|
|
6799
6805
|
};
|
|
6800
6806
|
}
|
|
6801
6807
|
function configure(combined, extensions) {
|
|
6802
|
-
let
|
|
6803
|
-
while (++
|
|
6804
|
-
const value = extensions[
|
|
6808
|
+
let index = -1;
|
|
6809
|
+
while (++index < extensions.length) {
|
|
6810
|
+
const value = extensions[index];
|
|
6805
6811
|
if (Array.isArray(value)) {
|
|
6806
6812
|
configure(combined, value);
|
|
6807
6813
|
} else {
|
|
@@ -6809,20 +6815,20 @@ function configure(combined, extensions) {
|
|
|
6809
6815
|
}
|
|
6810
6816
|
}
|
|
6811
6817
|
}
|
|
6812
|
-
function extension(combined,
|
|
6818
|
+
function extension(combined, extension) {
|
|
6813
6819
|
let key;
|
|
6814
|
-
for (key in
|
|
6815
|
-
if (own2.call(
|
|
6820
|
+
for (key in extension) {
|
|
6821
|
+
if (own2.call(extension, key)) {
|
|
6816
6822
|
switch (key) {
|
|
6817
6823
|
case "canContainEols": {
|
|
6818
|
-
const right =
|
|
6824
|
+
const right = extension[key];
|
|
6819
6825
|
if (right) {
|
|
6820
6826
|
combined[key].push(...right);
|
|
6821
6827
|
}
|
|
6822
6828
|
break;
|
|
6823
6829
|
}
|
|
6824
6830
|
case "transforms": {
|
|
6825
|
-
const right =
|
|
6831
|
+
const right = extension[key];
|
|
6826
6832
|
if (right) {
|
|
6827
6833
|
combined[key].push(...right);
|
|
6828
6834
|
}
|
|
@@ -6830,7 +6836,7 @@ function extension(combined, extension2) {
|
|
|
6830
6836
|
}
|
|
6831
6837
|
case "afterExit":
|
|
6832
6838
|
case "beforeEnter": {
|
|
6833
|
-
const right =
|
|
6839
|
+
const right = extension[key];
|
|
6834
6840
|
if (right) {
|
|
6835
6841
|
combined[key].push(right);
|
|
6836
6842
|
}
|
|
@@ -6838,7 +6844,7 @@ function extension(combined, extension2) {
|
|
|
6838
6844
|
}
|
|
6839
6845
|
case "enter":
|
|
6840
6846
|
case "exit": {
|
|
6841
|
-
const right =
|
|
6847
|
+
const right = extension[key];
|
|
6842
6848
|
if (right) {
|
|
6843
6849
|
Object.assign(combined[key], right);
|
|
6844
6850
|
}
|
|
@@ -6870,10 +6876,10 @@ function ccount(value, character) {
|
|
|
6870
6876
|
throw new TypeError("Expected character");
|
|
6871
6877
|
}
|
|
6872
6878
|
let count = 0;
|
|
6873
|
-
let
|
|
6874
|
-
while (
|
|
6879
|
+
let index = source.indexOf(character);
|
|
6880
|
+
while (index !== -1) {
|
|
6875
6881
|
count++;
|
|
6876
|
-
|
|
6882
|
+
index = source.indexOf(character, index + character.length);
|
|
6877
6883
|
}
|
|
6878
6884
|
return count;
|
|
6879
6885
|
}
|
|
@@ -6882,11 +6888,11 @@ function ccount(value, character) {
|
|
|
6882
6888
|
function ok() {}
|
|
6883
6889
|
|
|
6884
6890
|
// node_modules/escape-string-regexp/index.js
|
|
6885
|
-
function escapeStringRegexp(
|
|
6886
|
-
if (typeof
|
|
6891
|
+
function escapeStringRegexp(string) {
|
|
6892
|
+
if (typeof string !== "string") {
|
|
6887
6893
|
throw new TypeError("Expected a string");
|
|
6888
6894
|
}
|
|
6889
|
-
return
|
|
6895
|
+
return string.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&").replace(/-/g, "\\x2d");
|
|
6890
6896
|
}
|
|
6891
6897
|
|
|
6892
6898
|
// node_modules/unist-util-is/lib/index.js
|
|
@@ -6907,15 +6913,15 @@ var convert = function(test) {
|
|
|
6907
6913
|
};
|
|
6908
6914
|
function anyFactory(tests) {
|
|
6909
6915
|
const checks = [];
|
|
6910
|
-
let
|
|
6911
|
-
while (++
|
|
6912
|
-
checks[
|
|
6916
|
+
let index = -1;
|
|
6917
|
+
while (++index < tests.length) {
|
|
6918
|
+
checks[index] = convert(tests[index]);
|
|
6913
6919
|
}
|
|
6914
6920
|
return castFactory(any);
|
|
6915
6921
|
function any(...parameters) {
|
|
6916
|
-
let
|
|
6917
|
-
while (++
|
|
6918
|
-
if (checks[
|
|
6922
|
+
let index = -1;
|
|
6923
|
+
while (++index < checks.length) {
|
|
6924
|
+
if (checks[index].apply(this, parameters))
|
|
6919
6925
|
return true;
|
|
6920
6926
|
}
|
|
6921
6927
|
return false;
|
|
@@ -6923,9 +6929,9 @@ function anyFactory(tests) {
|
|
|
6923
6929
|
}
|
|
6924
6930
|
function propertiesFactory(check) {
|
|
6925
6931
|
const checkAsRecord = check;
|
|
6926
|
-
return castFactory(
|
|
6927
|
-
function
|
|
6928
|
-
const nodeAsRecord =
|
|
6932
|
+
return castFactory(all);
|
|
6933
|
+
function all(node) {
|
|
6934
|
+
const nodeAsRecord = node;
|
|
6929
6935
|
let key;
|
|
6930
6936
|
for (key in check) {
|
|
6931
6937
|
if (nodeAsRecord[key] !== checkAsRecord[key])
|
|
@@ -6936,14 +6942,14 @@ function propertiesFactory(check) {
|
|
|
6936
6942
|
}
|
|
6937
6943
|
function typeFactory(check) {
|
|
6938
6944
|
return castFactory(type);
|
|
6939
|
-
function type(
|
|
6940
|
-
return
|
|
6945
|
+
function type(node) {
|
|
6946
|
+
return node && node.type === check;
|
|
6941
6947
|
}
|
|
6942
6948
|
}
|
|
6943
6949
|
function castFactory(testFunction) {
|
|
6944
6950
|
return check;
|
|
6945
|
-
function check(value,
|
|
6946
|
-
return Boolean(looksLikeANode(value) && testFunction.call(this, value, typeof
|
|
6951
|
+
function check(value, index, parent) {
|
|
6952
|
+
return Boolean(looksLikeANode(value) && testFunction.call(this, value, typeof index === "number" ? index : undefined, parent || undefined));
|
|
6947
6953
|
}
|
|
6948
6954
|
}
|
|
6949
6955
|
function ok2() {
|
|
@@ -6970,15 +6976,15 @@ function visitParents(tree, test, visitor, reverse) {
|
|
|
6970
6976
|
} else {
|
|
6971
6977
|
check = test;
|
|
6972
6978
|
}
|
|
6973
|
-
const
|
|
6979
|
+
const is = convert(check);
|
|
6974
6980
|
const step = reverse ? -1 : 1;
|
|
6975
6981
|
factory(tree, undefined, [])();
|
|
6976
|
-
function factory(
|
|
6977
|
-
const value =
|
|
6982
|
+
function factory(node, index, parents) {
|
|
6983
|
+
const value = node && typeof node === "object" ? node : {};
|
|
6978
6984
|
if (typeof value.type === "string") {
|
|
6979
6985
|
const name = typeof value.tagName === "string" ? value.tagName : typeof value.name === "string" ? value.name : undefined;
|
|
6980
6986
|
Object.defineProperty(visit, "name", {
|
|
6981
|
-
value: "node (" + color(
|
|
6987
|
+
value: "node (" + color(node.type + (name ? "<" + name + ">" : "")) + ")"
|
|
6982
6988
|
});
|
|
6983
6989
|
}
|
|
6984
6990
|
return visit;
|
|
@@ -6987,14 +6993,14 @@ function visitParents(tree, test, visitor, reverse) {
|
|
|
6987
6993
|
let subresult;
|
|
6988
6994
|
let offset;
|
|
6989
6995
|
let grandparents;
|
|
6990
|
-
if (!test ||
|
|
6991
|
-
result = toResult(visitor(
|
|
6996
|
+
if (!test || is(node, index, parents[parents.length - 1] || undefined)) {
|
|
6997
|
+
result = toResult(visitor(node, parents));
|
|
6992
6998
|
if (result[0] === EXIT) {
|
|
6993
6999
|
return result;
|
|
6994
7000
|
}
|
|
6995
7001
|
}
|
|
6996
|
-
if ("children" in
|
|
6997
|
-
const nodeAsParent =
|
|
7002
|
+
if ("children" in node && node.children) {
|
|
7003
|
+
const nodeAsParent = node;
|
|
6998
7004
|
if (nodeAsParent.children && result[0] !== SKIP) {
|
|
6999
7005
|
offset = (reverse ? nodeAsParent.children.length : -1) + step;
|
|
7000
7006
|
grandparents = parents.concat(nodeAsParent);
|
|
@@ -7022,19 +7028,19 @@ function toResult(value) {
|
|
|
7022
7028
|
return value === null || value === undefined ? empty : [value];
|
|
7023
7029
|
}
|
|
7024
7030
|
// node_modules/mdast-util-find-and-replace/lib/index.js
|
|
7025
|
-
function findAndReplace(tree,
|
|
7031
|
+
function findAndReplace(tree, list, options) {
|
|
7026
7032
|
const settings = options || {};
|
|
7027
7033
|
const ignored = convert(settings.ignore || []);
|
|
7028
|
-
const pairs = toPairs(
|
|
7034
|
+
const pairs = toPairs(list);
|
|
7029
7035
|
let pairIndex = -1;
|
|
7030
7036
|
while (++pairIndex < pairs.length) {
|
|
7031
7037
|
visitParents(tree, "text", visitor);
|
|
7032
7038
|
}
|
|
7033
|
-
function visitor(
|
|
7034
|
-
let
|
|
7039
|
+
function visitor(node, parents) {
|
|
7040
|
+
let index = -1;
|
|
7035
7041
|
let grandparent;
|
|
7036
|
-
while (++
|
|
7037
|
-
const parent = parents[
|
|
7042
|
+
while (++index < parents.length) {
|
|
7043
|
+
const parent = parents[index];
|
|
7038
7044
|
const siblings = grandparent ? grandparent.children : undefined;
|
|
7039
7045
|
if (ignored(parent, siblings ? siblings.indexOf(parent) : undefined, grandparent)) {
|
|
7040
7046
|
return;
|
|
@@ -7042,36 +7048,36 @@ function findAndReplace(tree, list2, options) {
|
|
|
7042
7048
|
grandparent = parent;
|
|
7043
7049
|
}
|
|
7044
7050
|
if (grandparent) {
|
|
7045
|
-
return handler(
|
|
7051
|
+
return handler(node, parents);
|
|
7046
7052
|
}
|
|
7047
7053
|
}
|
|
7048
|
-
function handler(
|
|
7054
|
+
function handler(node, parents) {
|
|
7049
7055
|
const parent = parents[parents.length - 1];
|
|
7050
7056
|
const find = pairs[pairIndex][0];
|
|
7051
7057
|
const replace = pairs[pairIndex][1];
|
|
7052
7058
|
let start = 0;
|
|
7053
7059
|
const siblings = parent.children;
|
|
7054
|
-
const
|
|
7060
|
+
const index = siblings.indexOf(node);
|
|
7055
7061
|
let change = false;
|
|
7056
7062
|
let nodes = [];
|
|
7057
7063
|
find.lastIndex = 0;
|
|
7058
|
-
let match = find.exec(
|
|
7064
|
+
let match = find.exec(node.value);
|
|
7059
7065
|
while (match) {
|
|
7060
|
-
const
|
|
7066
|
+
const position = match.index;
|
|
7061
7067
|
const matchObject = {
|
|
7062
7068
|
index: match.index,
|
|
7063
7069
|
input: match.input,
|
|
7064
|
-
stack: [...parents,
|
|
7070
|
+
stack: [...parents, node]
|
|
7065
7071
|
};
|
|
7066
7072
|
let value = replace(...match, matchObject);
|
|
7067
7073
|
if (typeof value === "string") {
|
|
7068
7074
|
value = value.length > 0 ? { type: "text", value } : undefined;
|
|
7069
7075
|
}
|
|
7070
7076
|
if (value === false) {
|
|
7071
|
-
find.lastIndex =
|
|
7077
|
+
find.lastIndex = position + 1;
|
|
7072
7078
|
} else {
|
|
7073
|
-
if (start !==
|
|
7074
|
-
add({ type: "text", value:
|
|
7079
|
+
if (start !== position) {
|
|
7080
|
+
add({ type: "text", value: node.value.slice(start, position) });
|
|
7075
7081
|
}
|
|
7076
7082
|
if (Array.isArray(value)) {
|
|
7077
7083
|
for (const child of value)
|
|
@@ -7079,27 +7085,27 @@ function findAndReplace(tree, list2, options) {
|
|
|
7079
7085
|
} else if (value) {
|
|
7080
7086
|
add(value);
|
|
7081
7087
|
}
|
|
7082
|
-
start =
|
|
7088
|
+
start = position + match[0].length;
|
|
7083
7089
|
change = true;
|
|
7084
7090
|
}
|
|
7085
7091
|
if (!find.global) {
|
|
7086
7092
|
break;
|
|
7087
7093
|
}
|
|
7088
|
-
match = find.exec(
|
|
7094
|
+
match = find.exec(node.value);
|
|
7089
7095
|
}
|
|
7090
7096
|
if (change) {
|
|
7091
|
-
if (start <
|
|
7092
|
-
add({ type: "text", value:
|
|
7097
|
+
if (start < node.value.length) {
|
|
7098
|
+
add({ type: "text", value: node.value.slice(start) });
|
|
7093
7099
|
}
|
|
7094
|
-
parent.children.splice(
|
|
7100
|
+
parent.children.splice(index, 1, ...nodes);
|
|
7095
7101
|
} else {
|
|
7096
|
-
nodes = [
|
|
7102
|
+
nodes = [node];
|
|
7097
7103
|
}
|
|
7098
|
-
return
|
|
7104
|
+
return index + nodes.length;
|
|
7099
7105
|
function add(child) {
|
|
7100
|
-
const
|
|
7101
|
-
if (
|
|
7102
|
-
|
|
7106
|
+
const previous = nodes[nodes.length - 1];
|
|
7107
|
+
if (previous && previous.type === "text" && child.type === "text") {
|
|
7108
|
+
previous.value += child.value;
|
|
7103
7109
|
} else {
|
|
7104
7110
|
nodes.push(child);
|
|
7105
7111
|
}
|
|
@@ -7111,10 +7117,10 @@ function toPairs(tupleOrList) {
|
|
|
7111
7117
|
throw new TypeError("Expected find and replace tuple or list of tuples");
|
|
7112
7118
|
}
|
|
7113
7119
|
const result = [];
|
|
7114
|
-
const
|
|
7115
|
-
let
|
|
7116
|
-
while (++
|
|
7117
|
-
const tuple =
|
|
7120
|
+
const list = !tupleOrList[0] || Array.isArray(tupleOrList[0]) ? tupleOrList : [tupleOrList];
|
|
7121
|
+
let index = -1;
|
|
7122
|
+
while (++index < list.length) {
|
|
7123
|
+
const tuple = list[index];
|
|
7118
7124
|
result.push([toExpression(tuple[0]), toFunction(tuple[1])]);
|
|
7119
7125
|
}
|
|
7120
7126
|
return result;
|
|
@@ -7156,9 +7162,9 @@ function exitLiteralAutolinkHttp(token) {
|
|
|
7156
7162
|
}
|
|
7157
7163
|
function exitLiteralAutolinkWww(token) {
|
|
7158
7164
|
this.config.exit.data.call(this, token);
|
|
7159
|
-
const
|
|
7160
|
-
ok(
|
|
7161
|
-
|
|
7165
|
+
const node = this.stack[this.stack.length - 1];
|
|
7166
|
+
ok(node.type === "link");
|
|
7167
|
+
node.url = "http://" + this.sliceSerialize(token);
|
|
7162
7168
|
}
|
|
7163
7169
|
function exitLiteralAutolinkEmail(token) {
|
|
7164
7170
|
this.config.exit.autolinkEmail.call(this, token);
|
|
@@ -7255,20 +7261,20 @@ function enterFootnoteDefinition(token) {
|
|
|
7255
7261
|
}
|
|
7256
7262
|
function exitFootnoteCallString(token) {
|
|
7257
7263
|
const label = this.resume();
|
|
7258
|
-
const
|
|
7259
|
-
ok(
|
|
7260
|
-
|
|
7261
|
-
|
|
7264
|
+
const node = this.stack[this.stack.length - 1];
|
|
7265
|
+
ok(node.type === "footnoteReference");
|
|
7266
|
+
node.identifier = normalizeIdentifier(this.sliceSerialize(token)).toLowerCase();
|
|
7267
|
+
node.label = label;
|
|
7262
7268
|
}
|
|
7263
7269
|
function exitFootnoteCall(token) {
|
|
7264
7270
|
this.exit(token);
|
|
7265
7271
|
}
|
|
7266
7272
|
function exitFootnoteDefinitionLabelString(token) {
|
|
7267
7273
|
const label = this.resume();
|
|
7268
|
-
const
|
|
7269
|
-
ok(
|
|
7270
|
-
|
|
7271
|
-
|
|
7274
|
+
const node = this.stack[this.stack.length - 1];
|
|
7275
|
+
ok(node.type === "footnoteDefinition");
|
|
7276
|
+
node.identifier = normalizeIdentifier(this.sliceSerialize(token)).toLowerCase();
|
|
7277
|
+
node.label = label;
|
|
7272
7278
|
}
|
|
7273
7279
|
function exitFootnoteDefinition(token) {
|
|
7274
7280
|
this.exit(token);
|
|
@@ -7276,14 +7282,14 @@ function exitFootnoteDefinition(token) {
|
|
|
7276
7282
|
function footnoteReferencePeek() {
|
|
7277
7283
|
return "[";
|
|
7278
7284
|
}
|
|
7279
|
-
function footnoteReference(
|
|
7285
|
+
function footnoteReference(node, _, state, info) {
|
|
7280
7286
|
const tracker = state.createTracker(info);
|
|
7281
7287
|
let value = tracker.move("[^");
|
|
7282
|
-
const
|
|
7288
|
+
const exit = state.enter("footnoteReference");
|
|
7283
7289
|
const subexit = state.enter("reference");
|
|
7284
|
-
value += tracker.move(state.safe(state.associationId(
|
|
7290
|
+
value += tracker.move(state.safe(state.associationId(node), { after: "]", before: value }));
|
|
7285
7291
|
subexit();
|
|
7286
|
-
|
|
7292
|
+
exit();
|
|
7287
7293
|
value += tracker.move("]");
|
|
7288
7294
|
return value;
|
|
7289
7295
|
}
|
|
@@ -7319,18 +7325,18 @@ function enterStrikethrough(token) {
|
|
|
7319
7325
|
function exitStrikethrough(token) {
|
|
7320
7326
|
this.exit(token);
|
|
7321
7327
|
}
|
|
7322
|
-
function handleDelete(
|
|
7328
|
+
function handleDelete(node, _, state, info) {
|
|
7323
7329
|
const tracker = state.createTracker(info);
|
|
7324
7330
|
const sequence = state.stack.includes("strikethrough") ? "~" : "~~";
|
|
7325
|
-
const
|
|
7331
|
+
const exit = state.enter("strikethrough");
|
|
7326
7332
|
let value = tracker.move(sequence);
|
|
7327
|
-
value += state.containerPhrasing(
|
|
7333
|
+
value += state.containerPhrasing(node, {
|
|
7328
7334
|
...tracker.current(),
|
|
7329
7335
|
before: value,
|
|
7330
7336
|
after: "~"
|
|
7331
7337
|
});
|
|
7332
7338
|
value += tracker.move(sequence);
|
|
7333
|
-
|
|
7339
|
+
exit();
|
|
7334
7340
|
return value;
|
|
7335
7341
|
}
|
|
7336
7342
|
function attentionDelete() {
|
|
@@ -7387,9 +7393,9 @@ function exitCodeText(token) {
|
|
|
7387
7393
|
if (this.data.inTable) {
|
|
7388
7394
|
value = value.replace(/\\([\\|])/g, replace);
|
|
7389
7395
|
}
|
|
7390
|
-
const
|
|
7391
|
-
ok(
|
|
7392
|
-
|
|
7396
|
+
const node = this.stack[this.stack.length - 1];
|
|
7397
|
+
ok(node.type === "inlineCode");
|
|
7398
|
+
node.value = value;
|
|
7393
7399
|
this.exit(token);
|
|
7394
7400
|
}
|
|
7395
7401
|
function replace($0, $1) {
|
|
@@ -7406,35 +7412,35 @@ function gfmTaskListItemFromMarkdown() {
|
|
|
7406
7412
|
};
|
|
7407
7413
|
}
|
|
7408
7414
|
function exitCheck(token) {
|
|
7409
|
-
const
|
|
7410
|
-
ok(
|
|
7411
|
-
|
|
7415
|
+
const node = this.stack[this.stack.length - 2];
|
|
7416
|
+
ok(node.type === "listItem");
|
|
7417
|
+
node.checked = token.type === "taskListCheckValueChecked";
|
|
7412
7418
|
}
|
|
7413
7419
|
function exitParagraphWithTaskListItem(token) {
|
|
7414
7420
|
const parent = this.stack[this.stack.length - 2];
|
|
7415
7421
|
if (parent && parent.type === "listItem" && typeof parent.checked === "boolean") {
|
|
7416
|
-
const
|
|
7417
|
-
ok(
|
|
7418
|
-
const head =
|
|
7422
|
+
const node = this.stack[this.stack.length - 1];
|
|
7423
|
+
ok(node.type === "paragraph");
|
|
7424
|
+
const head = node.children[0];
|
|
7419
7425
|
if (head && head.type === "text") {
|
|
7420
7426
|
const siblings = parent.children;
|
|
7421
|
-
let
|
|
7427
|
+
let index = -1;
|
|
7422
7428
|
let firstParaghraph;
|
|
7423
|
-
while (++
|
|
7424
|
-
const sibling = siblings[
|
|
7429
|
+
while (++index < siblings.length) {
|
|
7430
|
+
const sibling = siblings[index];
|
|
7425
7431
|
if (sibling.type === "paragraph") {
|
|
7426
7432
|
firstParaghraph = sibling;
|
|
7427
7433
|
break;
|
|
7428
7434
|
}
|
|
7429
7435
|
}
|
|
7430
|
-
if (firstParaghraph ===
|
|
7436
|
+
if (firstParaghraph === node) {
|
|
7431
7437
|
head.value = head.value.slice(1);
|
|
7432
7438
|
if (head.value.length === 0) {
|
|
7433
|
-
|
|
7434
|
-
} else if (
|
|
7439
|
+
node.children.shift();
|
|
7440
|
+
} else if (node.position && head.position && typeof head.position.start.offset === "number") {
|
|
7435
7441
|
head.position.start.column++;
|
|
7436
7442
|
head.position.start.offset++;
|
|
7437
|
-
|
|
7443
|
+
node.position.start = Object.assign({}, head.position.start);
|
|
7438
7444
|
}
|
|
7439
7445
|
}
|
|
7440
7446
|
}
|
|
@@ -7510,272 +7516,272 @@ text3[72] = [emailAutolink, protocolAutolink];
|
|
|
7510
7516
|
text3[104] = [emailAutolink, protocolAutolink];
|
|
7511
7517
|
text3[87] = [emailAutolink, wwwAutolink];
|
|
7512
7518
|
text3[119] = [emailAutolink, wwwAutolink];
|
|
7513
|
-
function tokenizeEmailAutolink(effects,
|
|
7519
|
+
function tokenizeEmailAutolink(effects, ok, nok) {
|
|
7514
7520
|
const self = this;
|
|
7515
7521
|
let dot;
|
|
7516
7522
|
let data;
|
|
7517
7523
|
return start;
|
|
7518
|
-
function start(
|
|
7519
|
-
if (!gfmAtext(
|
|
7520
|
-
return nok(
|
|
7524
|
+
function start(code) {
|
|
7525
|
+
if (!gfmAtext(code) || !previousEmail.call(self, self.previous) || previousUnbalanced(self.events)) {
|
|
7526
|
+
return nok(code);
|
|
7521
7527
|
}
|
|
7522
7528
|
effects.enter("literalAutolink");
|
|
7523
7529
|
effects.enter("literalAutolinkEmail");
|
|
7524
|
-
return atext(
|
|
7530
|
+
return atext(code);
|
|
7525
7531
|
}
|
|
7526
|
-
function atext(
|
|
7527
|
-
if (gfmAtext(
|
|
7528
|
-
effects.consume(
|
|
7532
|
+
function atext(code) {
|
|
7533
|
+
if (gfmAtext(code)) {
|
|
7534
|
+
effects.consume(code);
|
|
7529
7535
|
return atext;
|
|
7530
7536
|
}
|
|
7531
|
-
if (
|
|
7532
|
-
effects.consume(
|
|
7537
|
+
if (code === 64) {
|
|
7538
|
+
effects.consume(code);
|
|
7533
7539
|
return emailDomain;
|
|
7534
7540
|
}
|
|
7535
|
-
return nok(
|
|
7541
|
+
return nok(code);
|
|
7536
7542
|
}
|
|
7537
|
-
function emailDomain(
|
|
7538
|
-
if (
|
|
7539
|
-
return effects.check(emailDomainDotTrail, emailDomainAfter, emailDomainDot)(
|
|
7543
|
+
function emailDomain(code) {
|
|
7544
|
+
if (code === 46) {
|
|
7545
|
+
return effects.check(emailDomainDotTrail, emailDomainAfter, emailDomainDot)(code);
|
|
7540
7546
|
}
|
|
7541
|
-
if (
|
|
7547
|
+
if (code === 45 || code === 95 || asciiAlphanumeric(code)) {
|
|
7542
7548
|
data = true;
|
|
7543
|
-
effects.consume(
|
|
7549
|
+
effects.consume(code);
|
|
7544
7550
|
return emailDomain;
|
|
7545
7551
|
}
|
|
7546
|
-
return emailDomainAfter(
|
|
7552
|
+
return emailDomainAfter(code);
|
|
7547
7553
|
}
|
|
7548
|
-
function emailDomainDot(
|
|
7549
|
-
effects.consume(
|
|
7554
|
+
function emailDomainDot(code) {
|
|
7555
|
+
effects.consume(code);
|
|
7550
7556
|
dot = true;
|
|
7551
7557
|
return emailDomain;
|
|
7552
7558
|
}
|
|
7553
|
-
function emailDomainAfter(
|
|
7559
|
+
function emailDomainAfter(code) {
|
|
7554
7560
|
if (data && dot && asciiAlpha(self.previous)) {
|
|
7555
7561
|
effects.exit("literalAutolinkEmail");
|
|
7556
7562
|
effects.exit("literalAutolink");
|
|
7557
|
-
return
|
|
7563
|
+
return ok(code);
|
|
7558
7564
|
}
|
|
7559
|
-
return nok(
|
|
7565
|
+
return nok(code);
|
|
7560
7566
|
}
|
|
7561
7567
|
}
|
|
7562
|
-
function tokenizeWwwAutolink(effects,
|
|
7568
|
+
function tokenizeWwwAutolink(effects, ok, nok) {
|
|
7563
7569
|
const self = this;
|
|
7564
7570
|
return wwwStart;
|
|
7565
|
-
function wwwStart(
|
|
7566
|
-
if (
|
|
7567
|
-
return nok(
|
|
7571
|
+
function wwwStart(code) {
|
|
7572
|
+
if (code !== 87 && code !== 119 || !previousWww.call(self, self.previous) || previousUnbalanced(self.events)) {
|
|
7573
|
+
return nok(code);
|
|
7568
7574
|
}
|
|
7569
7575
|
effects.enter("literalAutolink");
|
|
7570
7576
|
effects.enter("literalAutolinkWww");
|
|
7571
|
-
return effects.check(wwwPrefix, effects.attempt(domain, effects.attempt(path, wwwAfter), nok), nok)(
|
|
7577
|
+
return effects.check(wwwPrefix, effects.attempt(domain, effects.attempt(path, wwwAfter), nok), nok)(code);
|
|
7572
7578
|
}
|
|
7573
|
-
function wwwAfter(
|
|
7579
|
+
function wwwAfter(code) {
|
|
7574
7580
|
effects.exit("literalAutolinkWww");
|
|
7575
7581
|
effects.exit("literalAutolink");
|
|
7576
|
-
return
|
|
7582
|
+
return ok(code);
|
|
7577
7583
|
}
|
|
7578
7584
|
}
|
|
7579
|
-
function tokenizeProtocolAutolink(effects,
|
|
7585
|
+
function tokenizeProtocolAutolink(effects, ok, nok) {
|
|
7580
7586
|
const self = this;
|
|
7581
7587
|
let buffer = "";
|
|
7582
7588
|
let seen = false;
|
|
7583
7589
|
return protocolStart;
|
|
7584
|
-
function protocolStart(
|
|
7585
|
-
if ((
|
|
7590
|
+
function protocolStart(code) {
|
|
7591
|
+
if ((code === 72 || code === 104) && previousProtocol.call(self, self.previous) && !previousUnbalanced(self.events)) {
|
|
7586
7592
|
effects.enter("literalAutolink");
|
|
7587
7593
|
effects.enter("literalAutolinkHttp");
|
|
7588
|
-
buffer += String.fromCodePoint(
|
|
7589
|
-
effects.consume(
|
|
7594
|
+
buffer += String.fromCodePoint(code);
|
|
7595
|
+
effects.consume(code);
|
|
7590
7596
|
return protocolPrefixInside;
|
|
7591
7597
|
}
|
|
7592
|
-
return nok(
|
|
7598
|
+
return nok(code);
|
|
7593
7599
|
}
|
|
7594
|
-
function protocolPrefixInside(
|
|
7595
|
-
if (asciiAlpha(
|
|
7596
|
-
buffer += String.fromCodePoint(
|
|
7597
|
-
effects.consume(
|
|
7600
|
+
function protocolPrefixInside(code) {
|
|
7601
|
+
if (asciiAlpha(code) && buffer.length < 5) {
|
|
7602
|
+
buffer += String.fromCodePoint(code);
|
|
7603
|
+
effects.consume(code);
|
|
7598
7604
|
return protocolPrefixInside;
|
|
7599
7605
|
}
|
|
7600
|
-
if (
|
|
7606
|
+
if (code === 58) {
|
|
7601
7607
|
const protocol = buffer.toLowerCase();
|
|
7602
7608
|
if (protocol === "http" || protocol === "https") {
|
|
7603
|
-
effects.consume(
|
|
7609
|
+
effects.consume(code);
|
|
7604
7610
|
return protocolSlashesInside;
|
|
7605
7611
|
}
|
|
7606
7612
|
}
|
|
7607
|
-
return nok(
|
|
7613
|
+
return nok(code);
|
|
7608
7614
|
}
|
|
7609
|
-
function protocolSlashesInside(
|
|
7610
|
-
if (
|
|
7611
|
-
effects.consume(
|
|
7615
|
+
function protocolSlashesInside(code) {
|
|
7616
|
+
if (code === 47) {
|
|
7617
|
+
effects.consume(code);
|
|
7612
7618
|
if (seen) {
|
|
7613
7619
|
return afterProtocol;
|
|
7614
7620
|
}
|
|
7615
7621
|
seen = true;
|
|
7616
7622
|
return protocolSlashesInside;
|
|
7617
7623
|
}
|
|
7618
|
-
return nok(
|
|
7624
|
+
return nok(code);
|
|
7619
7625
|
}
|
|
7620
|
-
function afterProtocol(
|
|
7621
|
-
return
|
|
7626
|
+
function afterProtocol(code) {
|
|
7627
|
+
return code === null || asciiControl(code) || markdownLineEndingOrSpace(code) || unicodeWhitespace(code) || unicodePunctuation(code) ? nok(code) : effects.attempt(domain, effects.attempt(path, protocolAfter), nok)(code);
|
|
7622
7628
|
}
|
|
7623
|
-
function protocolAfter(
|
|
7629
|
+
function protocolAfter(code) {
|
|
7624
7630
|
effects.exit("literalAutolinkHttp");
|
|
7625
7631
|
effects.exit("literalAutolink");
|
|
7626
|
-
return
|
|
7632
|
+
return ok(code);
|
|
7627
7633
|
}
|
|
7628
7634
|
}
|
|
7629
|
-
function tokenizeWwwPrefix(effects,
|
|
7635
|
+
function tokenizeWwwPrefix(effects, ok, nok) {
|
|
7630
7636
|
let size = 0;
|
|
7631
7637
|
return wwwPrefixInside;
|
|
7632
|
-
function wwwPrefixInside(
|
|
7633
|
-
if ((
|
|
7638
|
+
function wwwPrefixInside(code) {
|
|
7639
|
+
if ((code === 87 || code === 119) && size < 3) {
|
|
7634
7640
|
size++;
|
|
7635
|
-
effects.consume(
|
|
7641
|
+
effects.consume(code);
|
|
7636
7642
|
return wwwPrefixInside;
|
|
7637
7643
|
}
|
|
7638
|
-
if (
|
|
7639
|
-
effects.consume(
|
|
7644
|
+
if (code === 46 && size === 3) {
|
|
7645
|
+
effects.consume(code);
|
|
7640
7646
|
return wwwPrefixAfter;
|
|
7641
7647
|
}
|
|
7642
|
-
return nok(
|
|
7648
|
+
return nok(code);
|
|
7643
7649
|
}
|
|
7644
|
-
function wwwPrefixAfter(
|
|
7645
|
-
return
|
|
7650
|
+
function wwwPrefixAfter(code) {
|
|
7651
|
+
return code === null ? nok(code) : ok(code);
|
|
7646
7652
|
}
|
|
7647
7653
|
}
|
|
7648
|
-
function tokenizeDomain(effects,
|
|
7654
|
+
function tokenizeDomain(effects, ok, nok) {
|
|
7649
7655
|
let underscoreInLastSegment;
|
|
7650
7656
|
let underscoreInLastLastSegment;
|
|
7651
7657
|
let seen;
|
|
7652
7658
|
return domainInside;
|
|
7653
|
-
function domainInside(
|
|
7654
|
-
if (
|
|
7655
|
-
return effects.check(trail, domainAfter, domainAtPunctuation)(
|
|
7659
|
+
function domainInside(code) {
|
|
7660
|
+
if (code === 46 || code === 95) {
|
|
7661
|
+
return effects.check(trail, domainAfter, domainAtPunctuation)(code);
|
|
7656
7662
|
}
|
|
7657
|
-
if (
|
|
7658
|
-
return domainAfter(
|
|
7663
|
+
if (code === null || markdownLineEndingOrSpace(code) || unicodeWhitespace(code) || code !== 45 && unicodePunctuation(code)) {
|
|
7664
|
+
return domainAfter(code);
|
|
7659
7665
|
}
|
|
7660
7666
|
seen = true;
|
|
7661
|
-
effects.consume(
|
|
7667
|
+
effects.consume(code);
|
|
7662
7668
|
return domainInside;
|
|
7663
7669
|
}
|
|
7664
|
-
function domainAtPunctuation(
|
|
7665
|
-
if (
|
|
7670
|
+
function domainAtPunctuation(code) {
|
|
7671
|
+
if (code === 95) {
|
|
7666
7672
|
underscoreInLastSegment = true;
|
|
7667
7673
|
} else {
|
|
7668
7674
|
underscoreInLastLastSegment = underscoreInLastSegment;
|
|
7669
7675
|
underscoreInLastSegment = undefined;
|
|
7670
7676
|
}
|
|
7671
|
-
effects.consume(
|
|
7677
|
+
effects.consume(code);
|
|
7672
7678
|
return domainInside;
|
|
7673
7679
|
}
|
|
7674
|
-
function domainAfter(
|
|
7680
|
+
function domainAfter(code) {
|
|
7675
7681
|
if (underscoreInLastLastSegment || underscoreInLastSegment || !seen) {
|
|
7676
|
-
return nok(
|
|
7682
|
+
return nok(code);
|
|
7677
7683
|
}
|
|
7678
|
-
return
|
|
7684
|
+
return ok(code);
|
|
7679
7685
|
}
|
|
7680
7686
|
}
|
|
7681
|
-
function tokenizePath(effects,
|
|
7687
|
+
function tokenizePath(effects, ok) {
|
|
7682
7688
|
let sizeOpen = 0;
|
|
7683
7689
|
let sizeClose = 0;
|
|
7684
7690
|
return pathInside;
|
|
7685
|
-
function pathInside(
|
|
7686
|
-
if (
|
|
7691
|
+
function pathInside(code) {
|
|
7692
|
+
if (code === 40) {
|
|
7687
7693
|
sizeOpen++;
|
|
7688
|
-
effects.consume(
|
|
7694
|
+
effects.consume(code);
|
|
7689
7695
|
return pathInside;
|
|
7690
7696
|
}
|
|
7691
|
-
if (
|
|
7692
|
-
return pathAtPunctuation(
|
|
7697
|
+
if (code === 41 && sizeClose < sizeOpen) {
|
|
7698
|
+
return pathAtPunctuation(code);
|
|
7693
7699
|
}
|
|
7694
|
-
if (
|
|
7695
|
-
return effects.check(trail,
|
|
7700
|
+
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) {
|
|
7701
|
+
return effects.check(trail, ok, pathAtPunctuation)(code);
|
|
7696
7702
|
}
|
|
7697
|
-
if (
|
|
7698
|
-
return
|
|
7703
|
+
if (code === null || markdownLineEndingOrSpace(code) || unicodeWhitespace(code)) {
|
|
7704
|
+
return ok(code);
|
|
7699
7705
|
}
|
|
7700
|
-
effects.consume(
|
|
7706
|
+
effects.consume(code);
|
|
7701
7707
|
return pathInside;
|
|
7702
7708
|
}
|
|
7703
|
-
function pathAtPunctuation(
|
|
7704
|
-
if (
|
|
7709
|
+
function pathAtPunctuation(code) {
|
|
7710
|
+
if (code === 41) {
|
|
7705
7711
|
sizeClose++;
|
|
7706
7712
|
}
|
|
7707
|
-
effects.consume(
|
|
7713
|
+
effects.consume(code);
|
|
7708
7714
|
return pathInside;
|
|
7709
7715
|
}
|
|
7710
7716
|
}
|
|
7711
|
-
function tokenizeTrail(effects,
|
|
7712
|
-
return
|
|
7713
|
-
function
|
|
7714
|
-
if (
|
|
7715
|
-
effects.consume(
|
|
7716
|
-
return
|
|
7717
|
+
function tokenizeTrail(effects, ok, nok) {
|
|
7718
|
+
return trail;
|
|
7719
|
+
function trail(code) {
|
|
7720
|
+
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) {
|
|
7721
|
+
effects.consume(code);
|
|
7722
|
+
return trail;
|
|
7717
7723
|
}
|
|
7718
|
-
if (
|
|
7719
|
-
effects.consume(
|
|
7724
|
+
if (code === 38) {
|
|
7725
|
+
effects.consume(code);
|
|
7720
7726
|
return trailCharacterReferenceStart;
|
|
7721
7727
|
}
|
|
7722
|
-
if (
|
|
7723
|
-
effects.consume(
|
|
7728
|
+
if (code === 93) {
|
|
7729
|
+
effects.consume(code);
|
|
7724
7730
|
return trailBracketAfter;
|
|
7725
7731
|
}
|
|
7726
|
-
if (
|
|
7727
|
-
return
|
|
7732
|
+
if (code === 60 || code === null || markdownLineEndingOrSpace(code) || unicodeWhitespace(code)) {
|
|
7733
|
+
return ok(code);
|
|
7728
7734
|
}
|
|
7729
|
-
return nok(
|
|
7735
|
+
return nok(code);
|
|
7730
7736
|
}
|
|
7731
|
-
function trailBracketAfter(
|
|
7732
|
-
if (
|
|
7733
|
-
return
|
|
7737
|
+
function trailBracketAfter(code) {
|
|
7738
|
+
if (code === null || code === 40 || code === 91 || markdownLineEndingOrSpace(code) || unicodeWhitespace(code)) {
|
|
7739
|
+
return ok(code);
|
|
7734
7740
|
}
|
|
7735
|
-
return
|
|
7741
|
+
return trail(code);
|
|
7736
7742
|
}
|
|
7737
|
-
function trailCharacterReferenceStart(
|
|
7738
|
-
return asciiAlpha(
|
|
7743
|
+
function trailCharacterReferenceStart(code) {
|
|
7744
|
+
return asciiAlpha(code) ? trailCharacterReferenceInside(code) : nok(code);
|
|
7739
7745
|
}
|
|
7740
|
-
function trailCharacterReferenceInside(
|
|
7741
|
-
if (
|
|
7742
|
-
effects.consume(
|
|
7743
|
-
return
|
|
7746
|
+
function trailCharacterReferenceInside(code) {
|
|
7747
|
+
if (code === 59) {
|
|
7748
|
+
effects.consume(code);
|
|
7749
|
+
return trail;
|
|
7744
7750
|
}
|
|
7745
|
-
if (asciiAlpha(
|
|
7746
|
-
effects.consume(
|
|
7751
|
+
if (asciiAlpha(code)) {
|
|
7752
|
+
effects.consume(code);
|
|
7747
7753
|
return trailCharacterReferenceInside;
|
|
7748
7754
|
}
|
|
7749
|
-
return nok(
|
|
7755
|
+
return nok(code);
|
|
7750
7756
|
}
|
|
7751
7757
|
}
|
|
7752
|
-
function tokenizeEmailDomainDotTrail(effects,
|
|
7758
|
+
function tokenizeEmailDomainDotTrail(effects, ok, nok) {
|
|
7753
7759
|
return start;
|
|
7754
|
-
function start(
|
|
7755
|
-
effects.consume(
|
|
7760
|
+
function start(code) {
|
|
7761
|
+
effects.consume(code);
|
|
7756
7762
|
return after;
|
|
7757
7763
|
}
|
|
7758
|
-
function after(
|
|
7759
|
-
return asciiAlphanumeric(
|
|
7764
|
+
function after(code) {
|
|
7765
|
+
return asciiAlphanumeric(code) ? nok(code) : ok(code);
|
|
7760
7766
|
}
|
|
7761
7767
|
}
|
|
7762
|
-
function previousWww(
|
|
7763
|
-
return
|
|
7768
|
+
function previousWww(code) {
|
|
7769
|
+
return code === null || code === 40 || code === 42 || code === 95 || code === 91 || code === 93 || code === 126 || markdownLineEndingOrSpace(code);
|
|
7764
7770
|
}
|
|
7765
|
-
function previousProtocol(
|
|
7766
|
-
return !asciiAlpha(
|
|
7771
|
+
function previousProtocol(code) {
|
|
7772
|
+
return !asciiAlpha(code);
|
|
7767
7773
|
}
|
|
7768
|
-
function previousEmail(
|
|
7769
|
-
return !(
|
|
7774
|
+
function previousEmail(code) {
|
|
7775
|
+
return !(code === 47 || gfmAtext(code));
|
|
7770
7776
|
}
|
|
7771
|
-
function gfmAtext(
|
|
7772
|
-
return
|
|
7777
|
+
function gfmAtext(code) {
|
|
7778
|
+
return code === 43 || code === 45 || code === 46 || code === 95 || asciiAlphanumeric(code);
|
|
7773
7779
|
}
|
|
7774
7780
|
function previousUnbalanced(events) {
|
|
7775
|
-
let
|
|
7781
|
+
let index = events.length;
|
|
7776
7782
|
let result = false;
|
|
7777
|
-
while (
|
|
7778
|
-
const token = events[
|
|
7783
|
+
while (index--) {
|
|
7784
|
+
const token = events[index][1];
|
|
7779
7785
|
if ((token.type === "labelLink" || token.type === "labelImage") && !token._balanced) {
|
|
7780
7786
|
result = true;
|
|
7781
7787
|
break;
|
|
@@ -7821,13 +7827,13 @@ function gfmFootnote() {
|
|
|
7821
7827
|
}
|
|
7822
7828
|
};
|
|
7823
7829
|
}
|
|
7824
|
-
function tokenizePotentialGfmFootnoteCall(effects,
|
|
7830
|
+
function tokenizePotentialGfmFootnoteCall(effects, ok, nok) {
|
|
7825
7831
|
const self = this;
|
|
7826
|
-
let
|
|
7832
|
+
let index = self.events.length;
|
|
7827
7833
|
const defined = self.parser.gfmFootnotes || (self.parser.gfmFootnotes = []);
|
|
7828
7834
|
let labelStart;
|
|
7829
|
-
while (
|
|
7830
|
-
const token = self.events[
|
|
7835
|
+
while (index--) {
|
|
7836
|
+
const token = self.events[index][1];
|
|
7831
7837
|
if (token.type === "labelImage") {
|
|
7832
7838
|
labelStart = token;
|
|
7833
7839
|
break;
|
|
@@ -7837,48 +7843,48 @@ function tokenizePotentialGfmFootnoteCall(effects, ok3, nok) {
|
|
|
7837
7843
|
}
|
|
7838
7844
|
}
|
|
7839
7845
|
return start;
|
|
7840
|
-
function start(
|
|
7846
|
+
function start(code) {
|
|
7841
7847
|
if (!labelStart || !labelStart._balanced) {
|
|
7842
|
-
return nok(
|
|
7848
|
+
return nok(code);
|
|
7843
7849
|
}
|
|
7844
7850
|
const id = normalizeIdentifier(self.sliceSerialize({
|
|
7845
7851
|
start: labelStart.end,
|
|
7846
7852
|
end: self.now()
|
|
7847
7853
|
}));
|
|
7848
7854
|
if (id.codePointAt(0) !== 94 || !defined.includes(id.slice(1))) {
|
|
7849
|
-
return nok(
|
|
7855
|
+
return nok(code);
|
|
7850
7856
|
}
|
|
7851
7857
|
effects.enter("gfmFootnoteCallLabelMarker");
|
|
7852
|
-
effects.consume(
|
|
7858
|
+
effects.consume(code);
|
|
7853
7859
|
effects.exit("gfmFootnoteCallLabelMarker");
|
|
7854
|
-
return
|
|
7860
|
+
return ok(code);
|
|
7855
7861
|
}
|
|
7856
7862
|
}
|
|
7857
7863
|
function resolveToPotentialGfmFootnoteCall(events, context) {
|
|
7858
|
-
let
|
|
7864
|
+
let index = events.length;
|
|
7859
7865
|
let labelStart;
|
|
7860
|
-
while (
|
|
7861
|
-
if (events[
|
|
7862
|
-
labelStart = events[
|
|
7866
|
+
while (index--) {
|
|
7867
|
+
if (events[index][1].type === "labelImage" && events[index][0] === "enter") {
|
|
7868
|
+
labelStart = events[index][1];
|
|
7863
7869
|
break;
|
|
7864
7870
|
}
|
|
7865
7871
|
}
|
|
7866
|
-
events[
|
|
7867
|
-
events[
|
|
7872
|
+
events[index + 1][1].type = "data";
|
|
7873
|
+
events[index + 3][1].type = "gfmFootnoteCallLabelMarker";
|
|
7868
7874
|
const call = {
|
|
7869
7875
|
type: "gfmFootnoteCall",
|
|
7870
|
-
start: Object.assign({}, events[
|
|
7876
|
+
start: Object.assign({}, events[index + 3][1].start),
|
|
7871
7877
|
end: Object.assign({}, events[events.length - 1][1].end)
|
|
7872
7878
|
};
|
|
7873
7879
|
const marker = {
|
|
7874
7880
|
type: "gfmFootnoteCallMarker",
|
|
7875
|
-
start: Object.assign({}, events[
|
|
7876
|
-
end: Object.assign({}, events[
|
|
7881
|
+
start: Object.assign({}, events[index + 3][1].end),
|
|
7882
|
+
end: Object.assign({}, events[index + 3][1].end)
|
|
7877
7883
|
};
|
|
7878
7884
|
marker.end.column++;
|
|
7879
7885
|
marker.end.offset++;
|
|
7880
7886
|
marker.end._bufferIndex++;
|
|
7881
|
-
const
|
|
7887
|
+
const string = {
|
|
7882
7888
|
type: "gfmFootnoteCallString",
|
|
7883
7889
|
start: Object.assign({}, marker.end),
|
|
7884
7890
|
end: Object.assign({}, events[events.length - 1][1].start)
|
|
@@ -7886,166 +7892,166 @@ function resolveToPotentialGfmFootnoteCall(events, context) {
|
|
|
7886
7892
|
const chunk = {
|
|
7887
7893
|
type: "chunkString",
|
|
7888
7894
|
contentType: "string",
|
|
7889
|
-
start: Object.assign({},
|
|
7890
|
-
end: Object.assign({},
|
|
7895
|
+
start: Object.assign({}, string.start),
|
|
7896
|
+
end: Object.assign({}, string.end)
|
|
7891
7897
|
};
|
|
7892
7898
|
const replacement = [
|
|
7893
|
-
events[
|
|
7894
|
-
events[
|
|
7899
|
+
events[index + 1],
|
|
7900
|
+
events[index + 2],
|
|
7895
7901
|
["enter", call, context],
|
|
7896
|
-
events[
|
|
7897
|
-
events[
|
|
7902
|
+
events[index + 3],
|
|
7903
|
+
events[index + 4],
|
|
7898
7904
|
["enter", marker, context],
|
|
7899
7905
|
["exit", marker, context],
|
|
7900
|
-
["enter",
|
|
7906
|
+
["enter", string, context],
|
|
7901
7907
|
["enter", chunk, context],
|
|
7902
7908
|
["exit", chunk, context],
|
|
7903
|
-
["exit",
|
|
7909
|
+
["exit", string, context],
|
|
7904
7910
|
events[events.length - 2],
|
|
7905
7911
|
events[events.length - 1],
|
|
7906
7912
|
["exit", call, context]
|
|
7907
7913
|
];
|
|
7908
|
-
events.splice(
|
|
7914
|
+
events.splice(index, events.length - index + 1, ...replacement);
|
|
7909
7915
|
return events;
|
|
7910
7916
|
}
|
|
7911
|
-
function tokenizeGfmFootnoteCall(effects,
|
|
7917
|
+
function tokenizeGfmFootnoteCall(effects, ok, nok) {
|
|
7912
7918
|
const self = this;
|
|
7913
7919
|
const defined = self.parser.gfmFootnotes || (self.parser.gfmFootnotes = []);
|
|
7914
7920
|
let size = 0;
|
|
7915
7921
|
let data;
|
|
7916
7922
|
return start;
|
|
7917
|
-
function start(
|
|
7923
|
+
function start(code) {
|
|
7918
7924
|
effects.enter("gfmFootnoteCall");
|
|
7919
7925
|
effects.enter("gfmFootnoteCallLabelMarker");
|
|
7920
|
-
effects.consume(
|
|
7926
|
+
effects.consume(code);
|
|
7921
7927
|
effects.exit("gfmFootnoteCallLabelMarker");
|
|
7922
7928
|
return callStart;
|
|
7923
7929
|
}
|
|
7924
|
-
function callStart(
|
|
7925
|
-
if (
|
|
7926
|
-
return nok(
|
|
7930
|
+
function callStart(code) {
|
|
7931
|
+
if (code !== 94)
|
|
7932
|
+
return nok(code);
|
|
7927
7933
|
effects.enter("gfmFootnoteCallMarker");
|
|
7928
|
-
effects.consume(
|
|
7934
|
+
effects.consume(code);
|
|
7929
7935
|
effects.exit("gfmFootnoteCallMarker");
|
|
7930
7936
|
effects.enter("gfmFootnoteCallString");
|
|
7931
7937
|
effects.enter("chunkString").contentType = "string";
|
|
7932
7938
|
return callData;
|
|
7933
7939
|
}
|
|
7934
|
-
function callData(
|
|
7935
|
-
if (size > 999 ||
|
|
7936
|
-
return nok(
|
|
7940
|
+
function callData(code) {
|
|
7941
|
+
if (size > 999 || code === 93 && !data || code === null || code === 91 || markdownLineEndingOrSpace(code)) {
|
|
7942
|
+
return nok(code);
|
|
7937
7943
|
}
|
|
7938
|
-
if (
|
|
7944
|
+
if (code === 93) {
|
|
7939
7945
|
effects.exit("chunkString");
|
|
7940
7946
|
const token = effects.exit("gfmFootnoteCallString");
|
|
7941
7947
|
if (!defined.includes(normalizeIdentifier(self.sliceSerialize(token)))) {
|
|
7942
|
-
return nok(
|
|
7948
|
+
return nok(code);
|
|
7943
7949
|
}
|
|
7944
7950
|
effects.enter("gfmFootnoteCallLabelMarker");
|
|
7945
|
-
effects.consume(
|
|
7951
|
+
effects.consume(code);
|
|
7946
7952
|
effects.exit("gfmFootnoteCallLabelMarker");
|
|
7947
7953
|
effects.exit("gfmFootnoteCall");
|
|
7948
|
-
return
|
|
7954
|
+
return ok;
|
|
7949
7955
|
}
|
|
7950
|
-
if (!markdownLineEndingOrSpace(
|
|
7956
|
+
if (!markdownLineEndingOrSpace(code)) {
|
|
7951
7957
|
data = true;
|
|
7952
7958
|
}
|
|
7953
7959
|
size++;
|
|
7954
|
-
effects.consume(
|
|
7955
|
-
return
|
|
7960
|
+
effects.consume(code);
|
|
7961
|
+
return code === 92 ? callEscape : callData;
|
|
7956
7962
|
}
|
|
7957
|
-
function callEscape(
|
|
7958
|
-
if (
|
|
7959
|
-
effects.consume(
|
|
7963
|
+
function callEscape(code) {
|
|
7964
|
+
if (code === 91 || code === 92 || code === 93) {
|
|
7965
|
+
effects.consume(code);
|
|
7960
7966
|
size++;
|
|
7961
7967
|
return callData;
|
|
7962
7968
|
}
|
|
7963
|
-
return callData(
|
|
7969
|
+
return callData(code);
|
|
7964
7970
|
}
|
|
7965
7971
|
}
|
|
7966
|
-
function tokenizeDefinitionStart(effects,
|
|
7972
|
+
function tokenizeDefinitionStart(effects, ok, nok) {
|
|
7967
7973
|
const self = this;
|
|
7968
7974
|
const defined = self.parser.gfmFootnotes || (self.parser.gfmFootnotes = []);
|
|
7969
7975
|
let identifier;
|
|
7970
7976
|
let size = 0;
|
|
7971
7977
|
let data;
|
|
7972
7978
|
return start;
|
|
7973
|
-
function start(
|
|
7979
|
+
function start(code) {
|
|
7974
7980
|
effects.enter("gfmFootnoteDefinition")._container = true;
|
|
7975
7981
|
effects.enter("gfmFootnoteDefinitionLabel");
|
|
7976
7982
|
effects.enter("gfmFootnoteDefinitionLabelMarker");
|
|
7977
|
-
effects.consume(
|
|
7983
|
+
effects.consume(code);
|
|
7978
7984
|
effects.exit("gfmFootnoteDefinitionLabelMarker");
|
|
7979
7985
|
return labelAtMarker;
|
|
7980
7986
|
}
|
|
7981
|
-
function labelAtMarker(
|
|
7982
|
-
if (
|
|
7987
|
+
function labelAtMarker(code) {
|
|
7988
|
+
if (code === 94) {
|
|
7983
7989
|
effects.enter("gfmFootnoteDefinitionMarker");
|
|
7984
|
-
effects.consume(
|
|
7990
|
+
effects.consume(code);
|
|
7985
7991
|
effects.exit("gfmFootnoteDefinitionMarker");
|
|
7986
7992
|
effects.enter("gfmFootnoteDefinitionLabelString");
|
|
7987
7993
|
effects.enter("chunkString").contentType = "string";
|
|
7988
7994
|
return labelInside;
|
|
7989
7995
|
}
|
|
7990
|
-
return nok(
|
|
7996
|
+
return nok(code);
|
|
7991
7997
|
}
|
|
7992
|
-
function labelInside(
|
|
7993
|
-
if (size > 999 ||
|
|
7994
|
-
return nok(
|
|
7998
|
+
function labelInside(code) {
|
|
7999
|
+
if (size > 999 || code === 93 && !data || code === null || code === 91 || markdownLineEndingOrSpace(code)) {
|
|
8000
|
+
return nok(code);
|
|
7995
8001
|
}
|
|
7996
|
-
if (
|
|
8002
|
+
if (code === 93) {
|
|
7997
8003
|
effects.exit("chunkString");
|
|
7998
8004
|
const token = effects.exit("gfmFootnoteDefinitionLabelString");
|
|
7999
8005
|
identifier = normalizeIdentifier(self.sliceSerialize(token));
|
|
8000
8006
|
effects.enter("gfmFootnoteDefinitionLabelMarker");
|
|
8001
|
-
effects.consume(
|
|
8007
|
+
effects.consume(code);
|
|
8002
8008
|
effects.exit("gfmFootnoteDefinitionLabelMarker");
|
|
8003
8009
|
effects.exit("gfmFootnoteDefinitionLabel");
|
|
8004
8010
|
return labelAfter;
|
|
8005
8011
|
}
|
|
8006
|
-
if (!markdownLineEndingOrSpace(
|
|
8012
|
+
if (!markdownLineEndingOrSpace(code)) {
|
|
8007
8013
|
data = true;
|
|
8008
8014
|
}
|
|
8009
8015
|
size++;
|
|
8010
|
-
effects.consume(
|
|
8011
|
-
return
|
|
8016
|
+
effects.consume(code);
|
|
8017
|
+
return code === 92 ? labelEscape : labelInside;
|
|
8012
8018
|
}
|
|
8013
|
-
function labelEscape(
|
|
8014
|
-
if (
|
|
8015
|
-
effects.consume(
|
|
8019
|
+
function labelEscape(code) {
|
|
8020
|
+
if (code === 91 || code === 92 || code === 93) {
|
|
8021
|
+
effects.consume(code);
|
|
8016
8022
|
size++;
|
|
8017
8023
|
return labelInside;
|
|
8018
8024
|
}
|
|
8019
|
-
return labelInside(
|
|
8025
|
+
return labelInside(code);
|
|
8020
8026
|
}
|
|
8021
|
-
function labelAfter(
|
|
8022
|
-
if (
|
|
8027
|
+
function labelAfter(code) {
|
|
8028
|
+
if (code === 58) {
|
|
8023
8029
|
effects.enter("definitionMarker");
|
|
8024
|
-
effects.consume(
|
|
8030
|
+
effects.consume(code);
|
|
8025
8031
|
effects.exit("definitionMarker");
|
|
8026
8032
|
if (!defined.includes(identifier)) {
|
|
8027
8033
|
defined.push(identifier);
|
|
8028
8034
|
}
|
|
8029
8035
|
return factorySpace(effects, whitespaceAfter, "gfmFootnoteDefinitionWhitespace");
|
|
8030
8036
|
}
|
|
8031
|
-
return nok(
|
|
8037
|
+
return nok(code);
|
|
8032
8038
|
}
|
|
8033
|
-
function whitespaceAfter(
|
|
8034
|
-
return
|
|
8039
|
+
function whitespaceAfter(code) {
|
|
8040
|
+
return ok(code);
|
|
8035
8041
|
}
|
|
8036
8042
|
}
|
|
8037
|
-
function tokenizeDefinitionContinuation(effects,
|
|
8038
|
-
return effects.check(blankLine,
|
|
8043
|
+
function tokenizeDefinitionContinuation(effects, ok, nok) {
|
|
8044
|
+
return effects.check(blankLine, ok, effects.attempt(indent, ok, nok));
|
|
8039
8045
|
}
|
|
8040
8046
|
function gfmFootnoteDefinitionEnd(effects) {
|
|
8041
8047
|
effects.exit("gfmFootnoteDefinition");
|
|
8042
8048
|
}
|
|
8043
|
-
function tokenizeIndent2(effects,
|
|
8049
|
+
function tokenizeIndent2(effects, ok, nok) {
|
|
8044
8050
|
const self = this;
|
|
8045
8051
|
return factorySpace(effects, afterPrefix, "gfmFootnoteDefinitionIndent", 4 + 1);
|
|
8046
|
-
function afterPrefix(
|
|
8052
|
+
function afterPrefix(code) {
|
|
8047
8053
|
const tail = self.events[self.events.length - 1];
|
|
8048
|
-
return tail && tail[1].type === "gfmFootnoteDefinitionIndent" && tail[2].sliceSerialize(tail[1], true).length === 4 ?
|
|
8054
|
+
return tail && tail[1].type === "gfmFootnoteDefinitionIndent" && tail[2].sliceSerialize(tail[1], true).length === 4 ? ok(code) : nok(code);
|
|
8049
8055
|
}
|
|
8050
8056
|
}
|
|
8051
8057
|
// node_modules/micromark-extension-gfm-strikethrough/lib/syntax.js
|
|
@@ -8072,73 +8078,73 @@ function gfmStrikethrough(options) {
|
|
|
8072
8078
|
}
|
|
8073
8079
|
};
|
|
8074
8080
|
function resolveAllStrikethrough(events, context) {
|
|
8075
|
-
let
|
|
8076
|
-
while (++
|
|
8077
|
-
if (events[
|
|
8078
|
-
let open =
|
|
8081
|
+
let index = -1;
|
|
8082
|
+
while (++index < events.length) {
|
|
8083
|
+
if (events[index][0] === "enter" && events[index][1].type === "strikethroughSequenceTemporary" && events[index][1]._close) {
|
|
8084
|
+
let open = index;
|
|
8079
8085
|
while (open--) {
|
|
8080
|
-
if (events[open][0] === "exit" && events[open][1].type === "strikethroughSequenceTemporary" && events[open][1]._open && events[
|
|
8081
|
-
events[
|
|
8086
|
+
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) {
|
|
8087
|
+
events[index][1].type = "strikethroughSequence";
|
|
8082
8088
|
events[open][1].type = "strikethroughSequence";
|
|
8083
8089
|
const strikethrough = {
|
|
8084
8090
|
type: "strikethrough",
|
|
8085
8091
|
start: Object.assign({}, events[open][1].start),
|
|
8086
|
-
end: Object.assign({}, events[
|
|
8092
|
+
end: Object.assign({}, events[index][1].end)
|
|
8087
8093
|
};
|
|
8088
|
-
const
|
|
8094
|
+
const text = {
|
|
8089
8095
|
type: "strikethroughText",
|
|
8090
8096
|
start: Object.assign({}, events[open][1].end),
|
|
8091
|
-
end: Object.assign({}, events[
|
|
8097
|
+
end: Object.assign({}, events[index][1].start)
|
|
8092
8098
|
};
|
|
8093
|
-
const nextEvents = [["enter", strikethrough, context], ["enter", events[open][1], context], ["exit", events[open][1], context], ["enter",
|
|
8094
|
-
const
|
|
8095
|
-
if (
|
|
8096
|
-
splice(nextEvents, nextEvents.length, 0, resolveAll(
|
|
8099
|
+
const nextEvents = [["enter", strikethrough, context], ["enter", events[open][1], context], ["exit", events[open][1], context], ["enter", text, context]];
|
|
8100
|
+
const insideSpan = context.parser.constructs.insideSpan.null;
|
|
8101
|
+
if (insideSpan) {
|
|
8102
|
+
splice(nextEvents, nextEvents.length, 0, resolveAll(insideSpan, events.slice(open + 1, index), context));
|
|
8097
8103
|
}
|
|
8098
|
-
splice(nextEvents, nextEvents.length, 0, [["exit",
|
|
8099
|
-
splice(events, open - 1,
|
|
8100
|
-
|
|
8104
|
+
splice(nextEvents, nextEvents.length, 0, [["exit", text, context], ["enter", events[index][1], context], ["exit", events[index][1], context], ["exit", strikethrough, context]]);
|
|
8105
|
+
splice(events, open - 1, index - open + 3, nextEvents);
|
|
8106
|
+
index = open + nextEvents.length - 2;
|
|
8101
8107
|
break;
|
|
8102
8108
|
}
|
|
8103
8109
|
}
|
|
8104
8110
|
}
|
|
8105
8111
|
}
|
|
8106
|
-
|
|
8107
|
-
while (++
|
|
8108
|
-
if (events[
|
|
8109
|
-
events[
|
|
8112
|
+
index = -1;
|
|
8113
|
+
while (++index < events.length) {
|
|
8114
|
+
if (events[index][1].type === "strikethroughSequenceTemporary") {
|
|
8115
|
+
events[index][1].type = "data";
|
|
8110
8116
|
}
|
|
8111
8117
|
}
|
|
8112
8118
|
return events;
|
|
8113
8119
|
}
|
|
8114
|
-
function tokenizeStrikethrough(effects,
|
|
8115
|
-
const
|
|
8120
|
+
function tokenizeStrikethrough(effects, ok, nok) {
|
|
8121
|
+
const previous = this.previous;
|
|
8116
8122
|
const events = this.events;
|
|
8117
8123
|
let size = 0;
|
|
8118
8124
|
return start;
|
|
8119
|
-
function start(
|
|
8120
|
-
if (
|
|
8121
|
-
return nok(
|
|
8125
|
+
function start(code) {
|
|
8126
|
+
if (previous === 126 && events[events.length - 1][1].type !== "characterEscape") {
|
|
8127
|
+
return nok(code);
|
|
8122
8128
|
}
|
|
8123
8129
|
effects.enter("strikethroughSequenceTemporary");
|
|
8124
|
-
return more(
|
|
8130
|
+
return more(code);
|
|
8125
8131
|
}
|
|
8126
|
-
function more(
|
|
8127
|
-
const before = classifyCharacter(
|
|
8128
|
-
if (
|
|
8132
|
+
function more(code) {
|
|
8133
|
+
const before = classifyCharacter(previous);
|
|
8134
|
+
if (code === 126) {
|
|
8129
8135
|
if (size > 1)
|
|
8130
|
-
return nok(
|
|
8131
|
-
effects.consume(
|
|
8136
|
+
return nok(code);
|
|
8137
|
+
effects.consume(code);
|
|
8132
8138
|
size++;
|
|
8133
8139
|
return more;
|
|
8134
8140
|
}
|
|
8135
8141
|
if (size < 2 && !single)
|
|
8136
|
-
return nok(
|
|
8142
|
+
return nok(code);
|
|
8137
8143
|
const token = effects.exit("strikethroughSequenceTemporary");
|
|
8138
|
-
const after = classifyCharacter(
|
|
8144
|
+
const after = classifyCharacter(code);
|
|
8139
8145
|
token._open = !after || after === 2 && Boolean(before);
|
|
8140
8146
|
token._close = !before || before === 2 && Boolean(after);
|
|
8141
|
-
return
|
|
8147
|
+
return ok(code);
|
|
8142
8148
|
}
|
|
8143
8149
|
}
|
|
8144
8150
|
}
|
|
@@ -8148,8 +8154,8 @@ class EditMap2 {
|
|
|
8148
8154
|
this.map = [];
|
|
8149
8155
|
this.index = new Map;
|
|
8150
8156
|
}
|
|
8151
|
-
add(
|
|
8152
|
-
addImplementation2(this,
|
|
8157
|
+
add(index, remove, add) {
|
|
8158
|
+
addImplementation2(this, index, remove, add);
|
|
8153
8159
|
}
|
|
8154
8160
|
consume(events) {
|
|
8155
8161
|
this.map.sort(function(a, b) {
|
|
@@ -8158,12 +8164,12 @@ class EditMap2 {
|
|
|
8158
8164
|
if (this.map.length === 0) {
|
|
8159
8165
|
return;
|
|
8160
8166
|
}
|
|
8161
|
-
let
|
|
8167
|
+
let index = this.map.length;
|
|
8162
8168
|
const vecs = [];
|
|
8163
|
-
while (
|
|
8164
|
-
|
|
8165
|
-
vecs.push(events.slice(this.map[
|
|
8166
|
-
events.length = this.map[
|
|
8169
|
+
while (index > 0) {
|
|
8170
|
+
index -= 1;
|
|
8171
|
+
vecs.push(events.slice(this.map[index][0] + this.map[index][1]), this.map[index][2]);
|
|
8172
|
+
events.length = this.map[index][0];
|
|
8167
8173
|
}
|
|
8168
8174
|
vecs.push(events.slice());
|
|
8169
8175
|
events.length = 0;
|
|
@@ -8194,18 +8200,18 @@ function addImplementation2(editMap, at, remove, add) {
|
|
|
8194
8200
|
}
|
|
8195
8201
|
|
|
8196
8202
|
// node_modules/micromark-extension-gfm-table/lib/infer.js
|
|
8197
|
-
function gfmTableAlign(events,
|
|
8203
|
+
function gfmTableAlign(events, index) {
|
|
8198
8204
|
let inDelimiterRow = false;
|
|
8199
8205
|
const align = [];
|
|
8200
|
-
while (
|
|
8201
|
-
const event = events[
|
|
8206
|
+
while (index < events.length) {
|
|
8207
|
+
const event = events[index];
|
|
8202
8208
|
if (inDelimiterRow) {
|
|
8203
8209
|
if (event[0] === "enter") {
|
|
8204
8210
|
if (event[1].type === "tableContent") {
|
|
8205
|
-
align.push(events[
|
|
8211
|
+
align.push(events[index + 1][1].type === "tableDelimiterMarker" ? "left" : "none");
|
|
8206
8212
|
}
|
|
8207
8213
|
} else if (event[1].type === "tableContent") {
|
|
8208
|
-
if (events[
|
|
8214
|
+
if (events[index - 1][1].type === "tableDelimiterMarker") {
|
|
8209
8215
|
const alignIndex = align.length - 1;
|
|
8210
8216
|
align[alignIndex] = align[alignIndex] === "left" ? "center" : "right";
|
|
8211
8217
|
}
|
|
@@ -8215,7 +8221,7 @@ function gfmTableAlign(events, index2) {
|
|
|
8215
8221
|
} else if (event[0] === "enter" && event[1].type === "tableDelimiterRow") {
|
|
8216
8222
|
inDelimiterRow = true;
|
|
8217
8223
|
}
|
|
8218
|
-
|
|
8224
|
+
index += 1;
|
|
8219
8225
|
}
|
|
8220
8226
|
return align;
|
|
8221
8227
|
}
|
|
@@ -8232,227 +8238,227 @@ function gfmTable() {
|
|
|
8232
8238
|
}
|
|
8233
8239
|
};
|
|
8234
8240
|
}
|
|
8235
|
-
function tokenizeTable(effects,
|
|
8241
|
+
function tokenizeTable(effects, ok, nok) {
|
|
8236
8242
|
const self = this;
|
|
8237
8243
|
let size = 0;
|
|
8238
8244
|
let sizeB = 0;
|
|
8239
8245
|
let seen;
|
|
8240
8246
|
return start;
|
|
8241
|
-
function start(
|
|
8242
|
-
let
|
|
8243
|
-
while (
|
|
8247
|
+
function start(code) {
|
|
8248
|
+
let index = self.events.length - 1;
|
|
8249
|
+
while (index > -1) {
|
|
8244
8250
|
const {
|
|
8245
8251
|
type
|
|
8246
|
-
} = self.events[
|
|
8252
|
+
} = self.events[index][1];
|
|
8247
8253
|
if (type === "lineEnding" || type === "linePrefix") {
|
|
8248
|
-
|
|
8254
|
+
index--;
|
|
8249
8255
|
} else {
|
|
8250
8256
|
break;
|
|
8251
8257
|
}
|
|
8252
8258
|
}
|
|
8253
|
-
const tail =
|
|
8259
|
+
const tail = index > -1 ? self.events[index][1].type : null;
|
|
8254
8260
|
const next = tail === "tableHead" || tail === "tableRow" ? bodyRowStart : headRowBefore;
|
|
8255
8261
|
if (next === bodyRowStart && self.parser.lazy[self.now().line]) {
|
|
8256
|
-
return nok(
|
|
8262
|
+
return nok(code);
|
|
8257
8263
|
}
|
|
8258
|
-
return next(
|
|
8264
|
+
return next(code);
|
|
8259
8265
|
}
|
|
8260
|
-
function headRowBefore(
|
|
8266
|
+
function headRowBefore(code) {
|
|
8261
8267
|
effects.enter("tableHead");
|
|
8262
8268
|
effects.enter("tableRow");
|
|
8263
|
-
return headRowStart(
|
|
8269
|
+
return headRowStart(code);
|
|
8264
8270
|
}
|
|
8265
|
-
function headRowStart(
|
|
8266
|
-
if (
|
|
8267
|
-
return headRowBreak(
|
|
8271
|
+
function headRowStart(code) {
|
|
8272
|
+
if (code === 124) {
|
|
8273
|
+
return headRowBreak(code);
|
|
8268
8274
|
}
|
|
8269
8275
|
seen = true;
|
|
8270
8276
|
sizeB += 1;
|
|
8271
|
-
return headRowBreak(
|
|
8277
|
+
return headRowBreak(code);
|
|
8272
8278
|
}
|
|
8273
|
-
function headRowBreak(
|
|
8274
|
-
if (
|
|
8275
|
-
return nok(
|
|
8279
|
+
function headRowBreak(code) {
|
|
8280
|
+
if (code === null) {
|
|
8281
|
+
return nok(code);
|
|
8276
8282
|
}
|
|
8277
|
-
if (markdownLineEnding(
|
|
8283
|
+
if (markdownLineEnding(code)) {
|
|
8278
8284
|
if (sizeB > 1) {
|
|
8279
8285
|
sizeB = 0;
|
|
8280
8286
|
self.interrupt = true;
|
|
8281
8287
|
effects.exit("tableRow");
|
|
8282
8288
|
effects.enter("lineEnding");
|
|
8283
|
-
effects.consume(
|
|
8289
|
+
effects.consume(code);
|
|
8284
8290
|
effects.exit("lineEnding");
|
|
8285
8291
|
return headDelimiterStart;
|
|
8286
8292
|
}
|
|
8287
|
-
return nok(
|
|
8293
|
+
return nok(code);
|
|
8288
8294
|
}
|
|
8289
|
-
if (markdownSpace(
|
|
8290
|
-
return factorySpace(effects, headRowBreak, "whitespace")(
|
|
8295
|
+
if (markdownSpace(code)) {
|
|
8296
|
+
return factorySpace(effects, headRowBreak, "whitespace")(code);
|
|
8291
8297
|
}
|
|
8292
8298
|
sizeB += 1;
|
|
8293
8299
|
if (seen) {
|
|
8294
8300
|
seen = false;
|
|
8295
8301
|
size += 1;
|
|
8296
8302
|
}
|
|
8297
|
-
if (
|
|
8303
|
+
if (code === 124) {
|
|
8298
8304
|
effects.enter("tableCellDivider");
|
|
8299
|
-
effects.consume(
|
|
8305
|
+
effects.consume(code);
|
|
8300
8306
|
effects.exit("tableCellDivider");
|
|
8301
8307
|
seen = true;
|
|
8302
8308
|
return headRowBreak;
|
|
8303
8309
|
}
|
|
8304
8310
|
effects.enter("data");
|
|
8305
|
-
return headRowData(
|
|
8311
|
+
return headRowData(code);
|
|
8306
8312
|
}
|
|
8307
|
-
function headRowData(
|
|
8308
|
-
if (
|
|
8313
|
+
function headRowData(code) {
|
|
8314
|
+
if (code === null || code === 124 || markdownLineEndingOrSpace(code)) {
|
|
8309
8315
|
effects.exit("data");
|
|
8310
|
-
return headRowBreak(
|
|
8316
|
+
return headRowBreak(code);
|
|
8311
8317
|
}
|
|
8312
|
-
effects.consume(
|
|
8313
|
-
return
|
|
8318
|
+
effects.consume(code);
|
|
8319
|
+
return code === 92 ? headRowEscape : headRowData;
|
|
8314
8320
|
}
|
|
8315
|
-
function headRowEscape(
|
|
8316
|
-
if (
|
|
8317
|
-
effects.consume(
|
|
8321
|
+
function headRowEscape(code) {
|
|
8322
|
+
if (code === 92 || code === 124) {
|
|
8323
|
+
effects.consume(code);
|
|
8318
8324
|
return headRowData;
|
|
8319
8325
|
}
|
|
8320
|
-
return headRowData(
|
|
8326
|
+
return headRowData(code);
|
|
8321
8327
|
}
|
|
8322
|
-
function headDelimiterStart(
|
|
8328
|
+
function headDelimiterStart(code) {
|
|
8323
8329
|
self.interrupt = false;
|
|
8324
8330
|
if (self.parser.lazy[self.now().line]) {
|
|
8325
|
-
return nok(
|
|
8331
|
+
return nok(code);
|
|
8326
8332
|
}
|
|
8327
8333
|
effects.enter("tableDelimiterRow");
|
|
8328
8334
|
seen = false;
|
|
8329
|
-
if (markdownSpace(
|
|
8330
|
-
return factorySpace(effects, headDelimiterBefore, "linePrefix", self.parser.constructs.disable.null.includes("codeIndented") ? undefined : 4)(
|
|
8335
|
+
if (markdownSpace(code)) {
|
|
8336
|
+
return factorySpace(effects, headDelimiterBefore, "linePrefix", self.parser.constructs.disable.null.includes("codeIndented") ? undefined : 4)(code);
|
|
8331
8337
|
}
|
|
8332
|
-
return headDelimiterBefore(
|
|
8338
|
+
return headDelimiterBefore(code);
|
|
8333
8339
|
}
|
|
8334
|
-
function headDelimiterBefore(
|
|
8335
|
-
if (
|
|
8336
|
-
return headDelimiterValueBefore(
|
|
8340
|
+
function headDelimiterBefore(code) {
|
|
8341
|
+
if (code === 45 || code === 58) {
|
|
8342
|
+
return headDelimiterValueBefore(code);
|
|
8337
8343
|
}
|
|
8338
|
-
if (
|
|
8344
|
+
if (code === 124) {
|
|
8339
8345
|
seen = true;
|
|
8340
8346
|
effects.enter("tableCellDivider");
|
|
8341
|
-
effects.consume(
|
|
8347
|
+
effects.consume(code);
|
|
8342
8348
|
effects.exit("tableCellDivider");
|
|
8343
8349
|
return headDelimiterCellBefore;
|
|
8344
8350
|
}
|
|
8345
|
-
return headDelimiterNok(
|
|
8351
|
+
return headDelimiterNok(code);
|
|
8346
8352
|
}
|
|
8347
|
-
function headDelimiterCellBefore(
|
|
8348
|
-
if (markdownSpace(
|
|
8349
|
-
return factorySpace(effects, headDelimiterValueBefore, "whitespace")(
|
|
8353
|
+
function headDelimiterCellBefore(code) {
|
|
8354
|
+
if (markdownSpace(code)) {
|
|
8355
|
+
return factorySpace(effects, headDelimiterValueBefore, "whitespace")(code);
|
|
8350
8356
|
}
|
|
8351
|
-
return headDelimiterValueBefore(
|
|
8357
|
+
return headDelimiterValueBefore(code);
|
|
8352
8358
|
}
|
|
8353
|
-
function headDelimiterValueBefore(
|
|
8354
|
-
if (
|
|
8359
|
+
function headDelimiterValueBefore(code) {
|
|
8360
|
+
if (code === 58) {
|
|
8355
8361
|
sizeB += 1;
|
|
8356
8362
|
seen = true;
|
|
8357
8363
|
effects.enter("tableDelimiterMarker");
|
|
8358
|
-
effects.consume(
|
|
8364
|
+
effects.consume(code);
|
|
8359
8365
|
effects.exit("tableDelimiterMarker");
|
|
8360
8366
|
return headDelimiterLeftAlignmentAfter;
|
|
8361
8367
|
}
|
|
8362
|
-
if (
|
|
8368
|
+
if (code === 45) {
|
|
8363
8369
|
sizeB += 1;
|
|
8364
|
-
return headDelimiterLeftAlignmentAfter(
|
|
8370
|
+
return headDelimiterLeftAlignmentAfter(code);
|
|
8365
8371
|
}
|
|
8366
|
-
if (
|
|
8367
|
-
return headDelimiterCellAfter(
|
|
8372
|
+
if (code === null || markdownLineEnding(code)) {
|
|
8373
|
+
return headDelimiterCellAfter(code);
|
|
8368
8374
|
}
|
|
8369
|
-
return headDelimiterNok(
|
|
8375
|
+
return headDelimiterNok(code);
|
|
8370
8376
|
}
|
|
8371
|
-
function headDelimiterLeftAlignmentAfter(
|
|
8372
|
-
if (
|
|
8377
|
+
function headDelimiterLeftAlignmentAfter(code) {
|
|
8378
|
+
if (code === 45) {
|
|
8373
8379
|
effects.enter("tableDelimiterFiller");
|
|
8374
|
-
return headDelimiterFiller(
|
|
8380
|
+
return headDelimiterFiller(code);
|
|
8375
8381
|
}
|
|
8376
|
-
return headDelimiterNok(
|
|
8382
|
+
return headDelimiterNok(code);
|
|
8377
8383
|
}
|
|
8378
|
-
function headDelimiterFiller(
|
|
8379
|
-
if (
|
|
8380
|
-
effects.consume(
|
|
8384
|
+
function headDelimiterFiller(code) {
|
|
8385
|
+
if (code === 45) {
|
|
8386
|
+
effects.consume(code);
|
|
8381
8387
|
return headDelimiterFiller;
|
|
8382
8388
|
}
|
|
8383
|
-
if (
|
|
8389
|
+
if (code === 58) {
|
|
8384
8390
|
seen = true;
|
|
8385
8391
|
effects.exit("tableDelimiterFiller");
|
|
8386
8392
|
effects.enter("tableDelimiterMarker");
|
|
8387
|
-
effects.consume(
|
|
8393
|
+
effects.consume(code);
|
|
8388
8394
|
effects.exit("tableDelimiterMarker");
|
|
8389
8395
|
return headDelimiterRightAlignmentAfter;
|
|
8390
8396
|
}
|
|
8391
8397
|
effects.exit("tableDelimiterFiller");
|
|
8392
|
-
return headDelimiterRightAlignmentAfter(
|
|
8398
|
+
return headDelimiterRightAlignmentAfter(code);
|
|
8393
8399
|
}
|
|
8394
|
-
function headDelimiterRightAlignmentAfter(
|
|
8395
|
-
if (markdownSpace(
|
|
8396
|
-
return factorySpace(effects, headDelimiterCellAfter, "whitespace")(
|
|
8400
|
+
function headDelimiterRightAlignmentAfter(code) {
|
|
8401
|
+
if (markdownSpace(code)) {
|
|
8402
|
+
return factorySpace(effects, headDelimiterCellAfter, "whitespace")(code);
|
|
8397
8403
|
}
|
|
8398
|
-
return headDelimiterCellAfter(
|
|
8404
|
+
return headDelimiterCellAfter(code);
|
|
8399
8405
|
}
|
|
8400
|
-
function headDelimiterCellAfter(
|
|
8401
|
-
if (
|
|
8402
|
-
return headDelimiterBefore(
|
|
8406
|
+
function headDelimiterCellAfter(code) {
|
|
8407
|
+
if (code === 124) {
|
|
8408
|
+
return headDelimiterBefore(code);
|
|
8403
8409
|
}
|
|
8404
|
-
if (
|
|
8410
|
+
if (code === null || markdownLineEnding(code)) {
|
|
8405
8411
|
if (!seen || size !== sizeB) {
|
|
8406
|
-
return headDelimiterNok(
|
|
8412
|
+
return headDelimiterNok(code);
|
|
8407
8413
|
}
|
|
8408
8414
|
effects.exit("tableDelimiterRow");
|
|
8409
8415
|
effects.exit("tableHead");
|
|
8410
|
-
return
|
|
8416
|
+
return ok(code);
|
|
8411
8417
|
}
|
|
8412
|
-
return headDelimiterNok(
|
|
8418
|
+
return headDelimiterNok(code);
|
|
8413
8419
|
}
|
|
8414
|
-
function headDelimiterNok(
|
|
8415
|
-
return nok(
|
|
8420
|
+
function headDelimiterNok(code) {
|
|
8421
|
+
return nok(code);
|
|
8416
8422
|
}
|
|
8417
|
-
function bodyRowStart(
|
|
8423
|
+
function bodyRowStart(code) {
|
|
8418
8424
|
effects.enter("tableRow");
|
|
8419
|
-
return bodyRowBreak(
|
|
8425
|
+
return bodyRowBreak(code);
|
|
8420
8426
|
}
|
|
8421
|
-
function bodyRowBreak(
|
|
8422
|
-
if (
|
|
8427
|
+
function bodyRowBreak(code) {
|
|
8428
|
+
if (code === 124) {
|
|
8423
8429
|
effects.enter("tableCellDivider");
|
|
8424
|
-
effects.consume(
|
|
8430
|
+
effects.consume(code);
|
|
8425
8431
|
effects.exit("tableCellDivider");
|
|
8426
8432
|
return bodyRowBreak;
|
|
8427
8433
|
}
|
|
8428
|
-
if (
|
|
8434
|
+
if (code === null || markdownLineEnding(code)) {
|
|
8429
8435
|
effects.exit("tableRow");
|
|
8430
|
-
return
|
|
8436
|
+
return ok(code);
|
|
8431
8437
|
}
|
|
8432
|
-
if (markdownSpace(
|
|
8433
|
-
return factorySpace(effects, bodyRowBreak, "whitespace")(
|
|
8438
|
+
if (markdownSpace(code)) {
|
|
8439
|
+
return factorySpace(effects, bodyRowBreak, "whitespace")(code);
|
|
8434
8440
|
}
|
|
8435
8441
|
effects.enter("data");
|
|
8436
|
-
return bodyRowData(
|
|
8442
|
+
return bodyRowData(code);
|
|
8437
8443
|
}
|
|
8438
|
-
function bodyRowData(
|
|
8439
|
-
if (
|
|
8444
|
+
function bodyRowData(code) {
|
|
8445
|
+
if (code === null || code === 124 || markdownLineEndingOrSpace(code)) {
|
|
8440
8446
|
effects.exit("data");
|
|
8441
|
-
return bodyRowBreak(
|
|
8447
|
+
return bodyRowBreak(code);
|
|
8442
8448
|
}
|
|
8443
|
-
effects.consume(
|
|
8444
|
-
return
|
|
8449
|
+
effects.consume(code);
|
|
8450
|
+
return code === 92 ? bodyRowEscape : bodyRowData;
|
|
8445
8451
|
}
|
|
8446
|
-
function bodyRowEscape(
|
|
8447
|
-
if (
|
|
8448
|
-
effects.consume(
|
|
8452
|
+
function bodyRowEscape(code) {
|
|
8453
|
+
if (code === 92 || code === 124) {
|
|
8454
|
+
effects.consume(code);
|
|
8449
8455
|
return bodyRowData;
|
|
8450
8456
|
}
|
|
8451
|
-
return bodyRowData(
|
|
8457
|
+
return bodyRowData(code);
|
|
8452
8458
|
}
|
|
8453
8459
|
}
|
|
8454
8460
|
function resolveTable(events, context) {
|
|
8455
|
-
let
|
|
8461
|
+
let index = -1;
|
|
8456
8462
|
let inFirstCellAwaitingPipe = true;
|
|
8457
8463
|
let rowKind = 0;
|
|
8458
8464
|
let lastCell = [0, 0, 0, 0];
|
|
@@ -8463,8 +8469,8 @@ function resolveTable(events, context) {
|
|
|
8463
8469
|
let currentBody;
|
|
8464
8470
|
let currentCell;
|
|
8465
8471
|
const map = new EditMap2;
|
|
8466
|
-
while (++
|
|
8467
|
-
const event = events[
|
|
8472
|
+
while (++index < events.length) {
|
|
8473
|
+
const event = events[index];
|
|
8468
8474
|
const token = event[1];
|
|
8469
8475
|
if (event[0] === "enter") {
|
|
8470
8476
|
if (token.type === "tableHead") {
|
|
@@ -8479,12 +8485,12 @@ function resolveTable(events, context) {
|
|
|
8479
8485
|
start: Object.assign({}, token.start),
|
|
8480
8486
|
end: Object.assign({}, token.end)
|
|
8481
8487
|
};
|
|
8482
|
-
map.add(
|
|
8488
|
+
map.add(index, 0, [["enter", currentTable, context]]);
|
|
8483
8489
|
} else if (token.type === "tableRow" || token.type === "tableDelimiterRow") {
|
|
8484
8490
|
inFirstCellAwaitingPipe = true;
|
|
8485
8491
|
currentCell = undefined;
|
|
8486
8492
|
lastCell = [0, 0, 0, 0];
|
|
8487
|
-
cell = [0,
|
|
8493
|
+
cell = [0, index + 1, 0, 0];
|
|
8488
8494
|
if (afterHeadAwaitingFirstBodyRow) {
|
|
8489
8495
|
afterHeadAwaitingFirstBodyRow = false;
|
|
8490
8496
|
currentBody = {
|
|
@@ -8492,7 +8498,7 @@ function resolveTable(events, context) {
|
|
|
8492
8498
|
start: Object.assign({}, token.start),
|
|
8493
8499
|
end: Object.assign({}, token.end)
|
|
8494
8500
|
};
|
|
8495
|
-
map.add(
|
|
8501
|
+
map.add(index, 0, [["enter", currentBody, context]]);
|
|
8496
8502
|
}
|
|
8497
8503
|
rowKind = token.type === "tableDelimiterRow" ? 2 : currentBody ? 3 : 1;
|
|
8498
8504
|
} else if (rowKind && (token.type === "data" || token.type === "tableDelimiterMarker" || token.type === "tableDelimiterFiller")) {
|
|
@@ -8503,7 +8509,7 @@ function resolveTable(events, context) {
|
|
|
8503
8509
|
currentCell = flushCell(map, context, lastCell, rowKind, undefined, currentCell);
|
|
8504
8510
|
lastCell = [0, 0, 0, 0];
|
|
8505
8511
|
}
|
|
8506
|
-
cell[2] =
|
|
8512
|
+
cell[2] = index;
|
|
8507
8513
|
}
|
|
8508
8514
|
} else if (token.type === "tableCellDivider") {
|
|
8509
8515
|
if (inFirstCellAwaitingPipe) {
|
|
@@ -8514,34 +8520,34 @@ function resolveTable(events, context) {
|
|
|
8514
8520
|
currentCell = flushCell(map, context, lastCell, rowKind, undefined, currentCell);
|
|
8515
8521
|
}
|
|
8516
8522
|
lastCell = cell;
|
|
8517
|
-
cell = [lastCell[1],
|
|
8523
|
+
cell = [lastCell[1], index, 0, 0];
|
|
8518
8524
|
}
|
|
8519
8525
|
}
|
|
8520
8526
|
} else if (token.type === "tableHead") {
|
|
8521
8527
|
afterHeadAwaitingFirstBodyRow = true;
|
|
8522
|
-
lastTableEnd =
|
|
8528
|
+
lastTableEnd = index;
|
|
8523
8529
|
} else if (token.type === "tableRow" || token.type === "tableDelimiterRow") {
|
|
8524
|
-
lastTableEnd =
|
|
8530
|
+
lastTableEnd = index;
|
|
8525
8531
|
if (lastCell[1] !== 0) {
|
|
8526
8532
|
cell[0] = cell[1];
|
|
8527
|
-
currentCell = flushCell(map, context, lastCell, rowKind,
|
|
8533
|
+
currentCell = flushCell(map, context, lastCell, rowKind, index, currentCell);
|
|
8528
8534
|
} else if (cell[1] !== 0) {
|
|
8529
|
-
currentCell = flushCell(map, context, cell, rowKind,
|
|
8535
|
+
currentCell = flushCell(map, context, cell, rowKind, index, currentCell);
|
|
8530
8536
|
}
|
|
8531
8537
|
rowKind = 0;
|
|
8532
8538
|
} else if (rowKind && (token.type === "data" || token.type === "tableDelimiterMarker" || token.type === "tableDelimiterFiller")) {
|
|
8533
|
-
cell[3] =
|
|
8539
|
+
cell[3] = index;
|
|
8534
8540
|
}
|
|
8535
8541
|
}
|
|
8536
8542
|
if (lastTableEnd !== 0) {
|
|
8537
8543
|
flushTableEnd(map, context, lastTableEnd, currentTable, currentBody);
|
|
8538
8544
|
}
|
|
8539
8545
|
map.consume(context.events);
|
|
8540
|
-
|
|
8541
|
-
while (++
|
|
8542
|
-
const event = context.events[
|
|
8546
|
+
index = -1;
|
|
8547
|
+
while (++index < context.events.length) {
|
|
8548
|
+
const event = context.events[index];
|
|
8543
8549
|
if (event[0] === "enter" && event[1].type === "table") {
|
|
8544
|
-
event[1]._align = gfmTableAlign(context.events,
|
|
8550
|
+
event[1]._align = gfmTableAlign(context.events, index);
|
|
8545
8551
|
}
|
|
8546
8552
|
}
|
|
8547
8553
|
return events;
|
|
@@ -8590,19 +8596,19 @@ function flushCell(map, context, range, rowKind, rowEnd, previousCell) {
|
|
|
8590
8596
|
}
|
|
8591
8597
|
return previousCell;
|
|
8592
8598
|
}
|
|
8593
|
-
function flushTableEnd(map, context,
|
|
8599
|
+
function flushTableEnd(map, context, index, table, tableBody) {
|
|
8594
8600
|
const exits = [];
|
|
8595
|
-
const related = getPoint(context.events,
|
|
8601
|
+
const related = getPoint(context.events, index);
|
|
8596
8602
|
if (tableBody) {
|
|
8597
8603
|
tableBody.end = Object.assign({}, related);
|
|
8598
8604
|
exits.push(["exit", tableBody, context]);
|
|
8599
8605
|
}
|
|
8600
8606
|
table.end = Object.assign({}, related);
|
|
8601
8607
|
exits.push(["exit", table, context]);
|
|
8602
|
-
map.add(
|
|
8608
|
+
map.add(index + 1, 0, exits);
|
|
8603
8609
|
}
|
|
8604
|
-
function getPoint(events,
|
|
8605
|
-
const event = events[
|
|
8610
|
+
function getPoint(events, index) {
|
|
8611
|
+
const event = events[index];
|
|
8606
8612
|
const side = event[0] === "enter" ? "start" : "end";
|
|
8607
8613
|
return event[1][side];
|
|
8608
8614
|
}
|
|
@@ -8618,60 +8624,60 @@ function gfmTaskListItem() {
|
|
|
8618
8624
|
}
|
|
8619
8625
|
};
|
|
8620
8626
|
}
|
|
8621
|
-
function tokenizeTasklistCheck(effects,
|
|
8627
|
+
function tokenizeTasklistCheck(effects, ok, nok) {
|
|
8622
8628
|
const self = this;
|
|
8623
8629
|
return open;
|
|
8624
|
-
function open(
|
|
8630
|
+
function open(code) {
|
|
8625
8631
|
if (self.previous !== null || !self._gfmTasklistFirstContentOfListItem) {
|
|
8626
|
-
return nok(
|
|
8632
|
+
return nok(code);
|
|
8627
8633
|
}
|
|
8628
8634
|
effects.enter("taskListCheck");
|
|
8629
8635
|
effects.enter("taskListCheckMarker");
|
|
8630
|
-
effects.consume(
|
|
8636
|
+
effects.consume(code);
|
|
8631
8637
|
effects.exit("taskListCheckMarker");
|
|
8632
8638
|
return inside;
|
|
8633
8639
|
}
|
|
8634
|
-
function inside(
|
|
8635
|
-
if (markdownLineEndingOrSpace(
|
|
8640
|
+
function inside(code) {
|
|
8641
|
+
if (markdownLineEndingOrSpace(code)) {
|
|
8636
8642
|
effects.enter("taskListCheckValueUnchecked");
|
|
8637
|
-
effects.consume(
|
|
8643
|
+
effects.consume(code);
|
|
8638
8644
|
effects.exit("taskListCheckValueUnchecked");
|
|
8639
8645
|
return close;
|
|
8640
8646
|
}
|
|
8641
|
-
if (
|
|
8647
|
+
if (code === 88 || code === 120) {
|
|
8642
8648
|
effects.enter("taskListCheckValueChecked");
|
|
8643
|
-
effects.consume(
|
|
8649
|
+
effects.consume(code);
|
|
8644
8650
|
effects.exit("taskListCheckValueChecked");
|
|
8645
8651
|
return close;
|
|
8646
8652
|
}
|
|
8647
|
-
return nok(
|
|
8653
|
+
return nok(code);
|
|
8648
8654
|
}
|
|
8649
|
-
function close(
|
|
8650
|
-
if (
|
|
8655
|
+
function close(code) {
|
|
8656
|
+
if (code === 93) {
|
|
8651
8657
|
effects.enter("taskListCheckMarker");
|
|
8652
|
-
effects.consume(
|
|
8658
|
+
effects.consume(code);
|
|
8653
8659
|
effects.exit("taskListCheckMarker");
|
|
8654
8660
|
effects.exit("taskListCheck");
|
|
8655
8661
|
return after;
|
|
8656
8662
|
}
|
|
8657
|
-
return nok(
|
|
8663
|
+
return nok(code);
|
|
8658
8664
|
}
|
|
8659
|
-
function after(
|
|
8660
|
-
if (markdownLineEnding(
|
|
8661
|
-
return
|
|
8665
|
+
function after(code) {
|
|
8666
|
+
if (markdownLineEnding(code)) {
|
|
8667
|
+
return ok(code);
|
|
8662
8668
|
}
|
|
8663
|
-
if (markdownSpace(
|
|
8669
|
+
if (markdownSpace(code)) {
|
|
8664
8670
|
return effects.check({
|
|
8665
8671
|
tokenize: spaceThenNonSpace
|
|
8666
|
-
},
|
|
8672
|
+
}, ok, nok)(code);
|
|
8667
8673
|
}
|
|
8668
|
-
return nok(
|
|
8674
|
+
return nok(code);
|
|
8669
8675
|
}
|
|
8670
8676
|
}
|
|
8671
|
-
function spaceThenNonSpace(effects,
|
|
8677
|
+
function spaceThenNonSpace(effects, ok, nok) {
|
|
8672
8678
|
return factorySpace(effects, after, "whitespace");
|
|
8673
|
-
function after(
|
|
8674
|
-
return
|
|
8679
|
+
function after(code) {
|
|
8680
|
+
return code === null ? nok(code) : ok(code);
|
|
8675
8681
|
}
|
|
8676
8682
|
}
|
|
8677
8683
|
// node_modules/micromark-extension-gfm/index.js
|
|
@@ -8685,8 +8691,8 @@ function gfm(options) {
|
|
|
8685
8691
|
]);
|
|
8686
8692
|
}
|
|
8687
8693
|
export {
|
|
8688
|
-
|
|
8689
|
-
gfmFromMarkdown,
|
|
8694
|
+
fromMarkdown,
|
|
8690
8695
|
gfm,
|
|
8691
|
-
|
|
8696
|
+
gfmFromMarkdown,
|
|
8697
|
+
toString
|
|
8692
8698
|
};
|