@jxsuite/parser 2.0.0 → 3.0.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/dist/content-loader.js +1482 -671
- package/dist/content.js +183 -30
- package/dist/markdown.js +1271 -742
- package/dist/serialize.js +1974 -1457
- package/package.json +5 -5
- package/src/alerts.ts +22 -7
- package/src/content-data.ts +40 -0
- package/src/content-links.ts +15 -7
- package/src/content-loader.ts +681 -221
- package/src/content-routes.ts +23 -10
- package/src/content-rules.ts +40 -29
- package/src/content.ts +108 -70
- package/src/csv.ts +18 -14
- package/src/dates.ts +18 -13
- package/src/highlight.ts +6 -5
- package/src/inert.ts +7 -5
- package/src/markdown.ts +27 -23
- package/src/md.ts +133 -64
- package/src/serialize.ts +367 -266
- package/src/transpile.ts +182 -152
- package/src/types.ts +43 -11
package/dist/markdown.js
CHANGED
|
@@ -58,6 +58,77 @@ var __esm = (fn, res, err) => () => {
|
|
|
58
58
|
};
|
|
59
59
|
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
60
60
|
|
|
61
|
+
// ../../packages/schema/src/guards.ts
|
|
62
|
+
function isString(value) {
|
|
63
|
+
return typeof value === "string";
|
|
64
|
+
}
|
|
65
|
+
function isNumber(value) {
|
|
66
|
+
return typeof value === "number";
|
|
67
|
+
}
|
|
68
|
+
function isBoolean(value) {
|
|
69
|
+
return typeof value === "boolean";
|
|
70
|
+
}
|
|
71
|
+
function isNonNullObject(value) {
|
|
72
|
+
return typeof value === "object" && value !== null;
|
|
73
|
+
}
|
|
74
|
+
function isJsonObject(value) {
|
|
75
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
76
|
+
}
|
|
77
|
+
function isRef(value) {
|
|
78
|
+
return isJsonObject(value) && typeof value.$ref === "string";
|
|
79
|
+
}
|
|
80
|
+
function isNodeObject(value) {
|
|
81
|
+
return isJsonObject(value);
|
|
82
|
+
}
|
|
83
|
+
function isPlainTagName(tagName) {
|
|
84
|
+
return typeof tagName === "string";
|
|
85
|
+
}
|
|
86
|
+
function isTagExpression(tagName) {
|
|
87
|
+
if (typeof tagName !== "object" || tagName === null || Array.isArray(tagName) || !isJsonObject(tagName.$expression)) {
|
|
88
|
+
return false;
|
|
89
|
+
}
|
|
90
|
+
const expression = tagName.$expression;
|
|
91
|
+
if (expression.operator === "?:") {
|
|
92
|
+
return typeof expression.value === "string" && typeof expression.initial === "string";
|
|
93
|
+
}
|
|
94
|
+
if (expression.operator === "switch") {
|
|
95
|
+
return isJsonObject(expression.cases) && Object.values(expression.cases).every((tag) => isString(tag)) && typeof expression.default === "string";
|
|
96
|
+
}
|
|
97
|
+
return false;
|
|
98
|
+
}
|
|
99
|
+
function tagNameCandidates(tagName) {
|
|
100
|
+
if (isPlainTagName(tagName)) {
|
|
101
|
+
return [tagName];
|
|
102
|
+
}
|
|
103
|
+
if (!isTagExpression(tagName)) {
|
|
104
|
+
return [];
|
|
105
|
+
}
|
|
106
|
+
const expression = tagName.$expression;
|
|
107
|
+
if (expression.operator === "?:") {
|
|
108
|
+
return [...new Set([expression.value, expression.initial])];
|
|
109
|
+
}
|
|
110
|
+
return [...new Set([...Object.values(expression.cases), expression.default])];
|
|
111
|
+
}
|
|
112
|
+
var SCHEMA_KEYWORDS;
|
|
113
|
+
var init_guards = __esm(() => {
|
|
114
|
+
SCHEMA_KEYWORDS = new Set([
|
|
115
|
+
"type",
|
|
116
|
+
"enum",
|
|
117
|
+
"minimum",
|
|
118
|
+
"maximum",
|
|
119
|
+
"minLength",
|
|
120
|
+
"maxLength",
|
|
121
|
+
"pattern",
|
|
122
|
+
"format",
|
|
123
|
+
"items",
|
|
124
|
+
"properties",
|
|
125
|
+
"required",
|
|
126
|
+
"description",
|
|
127
|
+
"title",
|
|
128
|
+
"$comment"
|
|
129
|
+
]);
|
|
130
|
+
});
|
|
131
|
+
|
|
61
132
|
// src/content-rules.ts
|
|
62
133
|
function escapeRegExp(text) {
|
|
63
134
|
return text.replaceAll(REGEXP_SPECIAL, String.raw`\$&`);
|
|
@@ -192,7 +263,7 @@ function compileExclude(patterns) {
|
|
|
192
263
|
const dirs = [];
|
|
193
264
|
let everything = false;
|
|
194
265
|
for (const pattern of patterns) {
|
|
195
|
-
if (
|
|
266
|
+
if (!isString(pattern) || pattern.trim() === "") {
|
|
196
267
|
throw new TypeError(`"exclude" entries must be non-empty strings, got ${JSON.stringify(pattern)}`);
|
|
197
268
|
}
|
|
198
269
|
if (pattern.startsWith("!")) {
|
|
@@ -266,21 +337,21 @@ function readField(data, key) {
|
|
|
266
337
|
if (!key.includes(".")) {
|
|
267
338
|
return;
|
|
268
339
|
}
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
current = current[part];
|
|
340
|
+
return readPath(data, key.split("."));
|
|
341
|
+
}
|
|
342
|
+
function readPath(holder, [part, ...rest]) {
|
|
343
|
+
if (part === undefined || !isPlainObject(holder) || !Object.hasOwn(holder, part)) {
|
|
344
|
+
return;
|
|
275
345
|
}
|
|
276
|
-
|
|
346
|
+
const value = holder[part];
|
|
347
|
+
return rest.length === 0 ? value : readPath(value, rest);
|
|
277
348
|
}
|
|
278
349
|
function order(actual, operand) {
|
|
279
350
|
const a = comparable(actual);
|
|
280
|
-
if (
|
|
351
|
+
if (isNumber(a) && isNumber(operand)) {
|
|
281
352
|
return a - operand;
|
|
282
353
|
}
|
|
283
|
-
if (
|
|
354
|
+
if (isString(a) && isString(operand)) {
|
|
284
355
|
return a < operand ? -1 : a > operand ? 1 : 0;
|
|
285
356
|
}
|
|
286
357
|
return;
|
|
@@ -302,13 +373,13 @@ function operatorTest(where, op, operand) {
|
|
|
302
373
|
return op === "$in" ? hit : (actual) => !hit(actual);
|
|
303
374
|
}
|
|
304
375
|
case "$exists": {
|
|
305
|
-
if (
|
|
376
|
+
if (!isBoolean(operand)) {
|
|
306
377
|
throw new TypeError(`${where}.$exists: expected true or false, got ${JSON.stringify(operand)}`);
|
|
307
378
|
}
|
|
308
379
|
return (actual) => (actual !== undefined && actual !== null) === operand;
|
|
309
380
|
}
|
|
310
381
|
default: {
|
|
311
|
-
if (
|
|
382
|
+
if (!isString(operand) && !isNumber(operand)) {
|
|
312
383
|
throw new TypeError(`${where}.${op}: expected a string or number, got ${JSON.stringify(operand)}`);
|
|
313
384
|
}
|
|
314
385
|
const test = (diff) => op === "$gt" ? diff > 0 : op === "$gte" ? diff >= 0 : op === "$lt" ? diff < 0 : diff <= 0;
|
|
@@ -366,6 +437,7 @@ function compileWhere(where) {
|
|
|
366
437
|
}
|
|
367
438
|
var nothing = () => {}, REGEXP_SPECIAL, MAX_STAR_RUNS = 4, OPERATORS;
|
|
368
439
|
var init_content_rules = __esm(() => {
|
|
440
|
+
init_guards();
|
|
369
441
|
REGEXP_SPECIAL = /[$()*+.?[\\\]^{|}]/g;
|
|
370
442
|
OPERATORS = new Set(["$eq", "$ne", "$in", "$nin", "$exists", "$gt", "$gte", "$lt", "$lte"]);
|
|
371
443
|
});
|
|
@@ -3911,7 +3983,7 @@ var init_dev4 = __esm(() => {
|
|
|
3911
3983
|
|
|
3912
3984
|
// ../../node_modules/micromark-factory-space/dev/index.js
|
|
3913
3985
|
function factorySpace(effects, ok, type, max) {
|
|
3914
|
-
const limit = max ? max - 1 :
|
|
3986
|
+
const limit = max ? max - 1 : Infinity;
|
|
3915
3987
|
let size = 0;
|
|
3916
3988
|
return start;
|
|
3917
3989
|
function start(code) {
|
|
@@ -3930,6 +4002,29 @@ function factorySpace(effects, ok, type, max) {
|
|
|
3930
4002
|
return ok(code);
|
|
3931
4003
|
}
|
|
3932
4004
|
}
|
|
4005
|
+
function factorySpaceMinMax(effects, ok, nok, type, min, max) {
|
|
4006
|
+
let size = 0;
|
|
4007
|
+
return start;
|
|
4008
|
+
function start(code) {
|
|
4009
|
+
if (max > 0 && markdownSpace(code)) {
|
|
4010
|
+
effects.enter(type);
|
|
4011
|
+
return prefix(code);
|
|
4012
|
+
}
|
|
4013
|
+
return after(code);
|
|
4014
|
+
}
|
|
4015
|
+
function prefix(code) {
|
|
4016
|
+
if (markdownSpace(code) && size < max) {
|
|
4017
|
+
effects.consume(code);
|
|
4018
|
+
size++;
|
|
4019
|
+
return prefix;
|
|
4020
|
+
}
|
|
4021
|
+
effects.exit(type);
|
|
4022
|
+
return after(code);
|
|
4023
|
+
}
|
|
4024
|
+
function after(code) {
|
|
4025
|
+
return size >= min ? ok(code) : nok(code);
|
|
4026
|
+
}
|
|
4027
|
+
}
|
|
3933
4028
|
var init_dev5 = __esm(() => {
|
|
3934
4029
|
init_dev4();
|
|
3935
4030
|
});
|
|
@@ -3991,6 +4086,65 @@ var init_content = __esm(() => {
|
|
|
3991
4086
|
content = { tokenize: initializeContent };
|
|
3992
4087
|
});
|
|
3993
4088
|
|
|
4089
|
+
// ../../node_modules/micromark-util-edit-map/dev/index.js
|
|
4090
|
+
class EditMap {
|
|
4091
|
+
constructor() {
|
|
4092
|
+
this.index = new Map;
|
|
4093
|
+
this.map = [];
|
|
4094
|
+
}
|
|
4095
|
+
add(index, remove, add) {
|
|
4096
|
+
addImplementation(this, index, remove, add, false);
|
|
4097
|
+
}
|
|
4098
|
+
addBefore(index, remove, add) {
|
|
4099
|
+
addImplementation(this, index, remove, add, true);
|
|
4100
|
+
}
|
|
4101
|
+
consume(events) {
|
|
4102
|
+
this.map.sort(function(a, b) {
|
|
4103
|
+
return a[0] - b[0];
|
|
4104
|
+
});
|
|
4105
|
+
if (this.map.length === 0) {
|
|
4106
|
+
return;
|
|
4107
|
+
}
|
|
4108
|
+
let index = this.map.length;
|
|
4109
|
+
const vecs = [];
|
|
4110
|
+
while (index > 0) {
|
|
4111
|
+
index -= 1;
|
|
4112
|
+
vecs.push(events.slice(this.map[index][0] + this.map[index][1]), this.map[index][2]);
|
|
4113
|
+
events.length = this.map[index][0];
|
|
4114
|
+
}
|
|
4115
|
+
vecs.push(events.slice());
|
|
4116
|
+
events.length = 0;
|
|
4117
|
+
let slice = vecs.pop();
|
|
4118
|
+
while (slice) {
|
|
4119
|
+
for (const element of slice) {
|
|
4120
|
+
events.push(element);
|
|
4121
|
+
}
|
|
4122
|
+
slice = vecs.pop();
|
|
4123
|
+
}
|
|
4124
|
+
this.map.length = 0;
|
|
4125
|
+
this.index.clear();
|
|
4126
|
+
}
|
|
4127
|
+
}
|
|
4128
|
+
function addImplementation(editMap, at, remove, add, before) {
|
|
4129
|
+
if (remove === 0 && add.length === 0) {
|
|
4130
|
+
return;
|
|
4131
|
+
}
|
|
4132
|
+
const existing = editMap.index.get(at);
|
|
4133
|
+
if (existing) {
|
|
4134
|
+
existing[1] += remove;
|
|
4135
|
+
if (before) {
|
|
4136
|
+
add.push(...existing[2]);
|
|
4137
|
+
existing[2] = add;
|
|
4138
|
+
} else {
|
|
4139
|
+
existing[2].push(...add);
|
|
4140
|
+
}
|
|
4141
|
+
return;
|
|
4142
|
+
}
|
|
4143
|
+
const change = [at, remove, add];
|
|
4144
|
+
editMap.map.push(change);
|
|
4145
|
+
editMap.index.set(at, change);
|
|
4146
|
+
}
|
|
4147
|
+
|
|
3994
4148
|
// ../../node_modules/micromark/dev/lib/initialize/document.js
|
|
3995
4149
|
function initializeDocument(effects) {
|
|
3996
4150
|
const self2 = this;
|
|
@@ -4033,8 +4187,10 @@ function initializeDocument(effects) {
|
|
|
4033
4187
|
self2.events[index][1].end = { ...point };
|
|
4034
4188
|
index++;
|
|
4035
4189
|
}
|
|
4036
|
-
|
|
4037
|
-
self2.events.
|
|
4190
|
+
const editMap = new EditMap;
|
|
4191
|
+
editMap.add(indexBeforeFlow + 1, 0, self2.events.slice(indexBeforeExits));
|
|
4192
|
+
editMap.add(indexBeforeExits, index - indexBeforeExits, []);
|
|
4193
|
+
editMap.consume(self2.events);
|
|
4038
4194
|
return checkNewContainers(code);
|
|
4039
4195
|
}
|
|
4040
4196
|
return start(code);
|
|
@@ -4053,8 +4209,9 @@ function initializeDocument(effects) {
|
|
|
4053
4209
|
return effects.check(containerConstruct, thereIsANewContainer, thereIsNoNewContainer)(code);
|
|
4054
4210
|
}
|
|
4055
4211
|
function thereIsANewContainer(code) {
|
|
4056
|
-
if (childFlow)
|
|
4212
|
+
if (childFlow) {
|
|
4057
4213
|
closeFlow();
|
|
4214
|
+
}
|
|
4058
4215
|
exitContainers(continued);
|
|
4059
4216
|
return documentContinued(code);
|
|
4060
4217
|
}
|
|
@@ -4076,8 +4233,9 @@ function initializeDocument(effects) {
|
|
|
4076
4233
|
}
|
|
4077
4234
|
function flowStart(code) {
|
|
4078
4235
|
if (code === codes.eof) {
|
|
4079
|
-
if (childFlow)
|
|
4236
|
+
if (childFlow) {
|
|
4080
4237
|
closeFlow();
|
|
4238
|
+
}
|
|
4081
4239
|
exitContainers(0);
|
|
4082
4240
|
effects.consume(code);
|
|
4083
4241
|
return;
|
|
@@ -4110,11 +4268,13 @@ function initializeDocument(effects) {
|
|
|
4110
4268
|
function writeToChild(token, endOfFile) {
|
|
4111
4269
|
ok(childFlow, "expected `childFlow` to be defined when continuing");
|
|
4112
4270
|
const stream = self2.sliceStream(token);
|
|
4113
|
-
if (endOfFile)
|
|
4271
|
+
if (endOfFile) {
|
|
4114
4272
|
stream.push(null);
|
|
4273
|
+
}
|
|
4115
4274
|
token.previous = childToken;
|
|
4116
|
-
if (childToken)
|
|
4275
|
+
if (childToken) {
|
|
4117
4276
|
childToken.next = token;
|
|
4277
|
+
}
|
|
4118
4278
|
childToken = token;
|
|
4119
4279
|
childFlow.defineSkip(token.start);
|
|
4120
4280
|
childFlow.write(stream);
|
|
@@ -4145,8 +4305,10 @@ function initializeDocument(effects) {
|
|
|
4145
4305
|
self2.events[index][1].end = { ...point };
|
|
4146
4306
|
index++;
|
|
4147
4307
|
}
|
|
4148
|
-
|
|
4149
|
-
self2.events.
|
|
4308
|
+
const editMap = new EditMap;
|
|
4309
|
+
editMap.add(indexBeforeFlow + 1, 0, self2.events.slice(indexBeforeExits));
|
|
4310
|
+
editMap.add(indexBeforeExits, index - indexBeforeExits, []);
|
|
4311
|
+
editMap.consume(self2.events);
|
|
4150
4312
|
}
|
|
4151
4313
|
}
|
|
4152
4314
|
function exitContainers(size) {
|
|
@@ -4177,7 +4339,6 @@ var init_document = __esm(() => {
|
|
|
4177
4339
|
init_development();
|
|
4178
4340
|
init_dev5();
|
|
4179
4341
|
init_dev4();
|
|
4180
|
-
init_dev();
|
|
4181
4342
|
init_default();
|
|
4182
4343
|
document2 = { tokenize: initializeDocument };
|
|
4183
4344
|
containerConstruct = { tokenize: tokenizeContainer };
|
|
@@ -4214,43 +4375,36 @@ function resolveAll(constructs, events, context) {
|
|
|
4214
4375
|
// ../../node_modules/micromark-core-commonmark/dev/lib/attention.js
|
|
4215
4376
|
function resolveAllAttention(events, context) {
|
|
4216
4377
|
let index = -1;
|
|
4217
|
-
let open;
|
|
4218
|
-
let group;
|
|
4219
|
-
let text;
|
|
4220
|
-
let openingSequence;
|
|
4221
|
-
let closingSequence;
|
|
4222
|
-
let use;
|
|
4223
4378
|
let nextEvents;
|
|
4224
|
-
let offset;
|
|
4225
4379
|
while (++index < events.length) {
|
|
4226
4380
|
if (events[index][0] === "enter" && events[index][1].type === "attentionSequence" && events[index][1]._close) {
|
|
4227
|
-
open = index;
|
|
4381
|
+
let open = index;
|
|
4228
4382
|
while (open--) {
|
|
4229
4383
|
if (events[open][0] === "exit" && events[open][1].type === "attentionSequence" && events[open][1]._open && context.sliceSerialize(events[open][1]).charCodeAt(0) === context.sliceSerialize(events[index][1]).charCodeAt(0)) {
|
|
4230
4384
|
if ((events[open][1]._close || events[index][1]._open) && (events[index][1].end.offset - events[index][1].start.offset) % 3 && !((events[open][1].end.offset - events[open][1].start.offset + events[index][1].end.offset - events[index][1].start.offset) % 3)) {
|
|
4231
4385
|
continue;
|
|
4232
4386
|
}
|
|
4233
|
-
use = events[open][1].end.offset - events[open][1].start.offset > 1 && events[index][1].end.offset - events[index][1].start.offset > 1 ? 2 : 1;
|
|
4387
|
+
const use = events[open][1].end.offset - events[open][1].start.offset > 1 && events[index][1].end.offset - events[index][1].start.offset > 1 ? 2 : 1;
|
|
4234
4388
|
const start = { ...events[open][1].end };
|
|
4235
4389
|
const end = { ...events[index][1].start };
|
|
4236
4390
|
movePoint(start, -use);
|
|
4237
4391
|
movePoint(end, use);
|
|
4238
|
-
openingSequence = {
|
|
4392
|
+
const openingSequence = {
|
|
4239
4393
|
type: use > 1 ? types.strongSequence : types.emphasisSequence,
|
|
4240
4394
|
start,
|
|
4241
4395
|
end: { ...events[open][1].end }
|
|
4242
4396
|
};
|
|
4243
|
-
closingSequence = {
|
|
4397
|
+
const closingSequence = {
|
|
4244
4398
|
type: use > 1 ? types.strongSequence : types.emphasisSequence,
|
|
4245
4399
|
start: { ...events[index][1].start },
|
|
4246
4400
|
end
|
|
4247
4401
|
};
|
|
4248
|
-
text = {
|
|
4402
|
+
const text = {
|
|
4249
4403
|
type: use > 1 ? types.strongText : types.emphasisText,
|
|
4250
4404
|
start: { ...events[open][1].end },
|
|
4251
4405
|
end: { ...events[index][1].start }
|
|
4252
4406
|
};
|
|
4253
|
-
group = {
|
|
4407
|
+
const group = {
|
|
4254
4408
|
type: use > 1 ? types.strong : types.emphasis,
|
|
4255
4409
|
start: { ...openingSequence.start },
|
|
4256
4410
|
end: { ...closingSequence.end }
|
|
@@ -4278,14 +4432,13 @@ function resolveAllAttention(events, context) {
|
|
|
4278
4432
|
["exit", closingSequence, context],
|
|
4279
4433
|
["exit", group, context]
|
|
4280
4434
|
]);
|
|
4435
|
+
let offset = 0;
|
|
4281
4436
|
if (events[index][1].end.offset - events[index][1].start.offset) {
|
|
4282
4437
|
offset = 2;
|
|
4283
4438
|
nextEvents = push(nextEvents, [
|
|
4284
4439
|
["enter", events[index][1], context],
|
|
4285
4440
|
["exit", events[index][1], context]
|
|
4286
4441
|
]);
|
|
4287
|
-
} else {
|
|
4288
|
-
offset = 0;
|
|
4289
4442
|
}
|
|
4290
4443
|
splice(events, open - 1, index - open + 3, nextEvents);
|
|
4291
4444
|
index = open + nextEvents.length - offset - 2;
|
|
@@ -4322,8 +4475,8 @@ function tokenizeAttention(effects, ok2) {
|
|
|
4322
4475
|
const token = effects.exit("attentionSequence");
|
|
4323
4476
|
const after = classifyCharacter(code);
|
|
4324
4477
|
ok(attentionMarkers, "expected `attentionMarkers` to be populated");
|
|
4325
|
-
const open = !after || after === constants.characterGroupPunctuation && before || attentionMarkers.includes(code);
|
|
4326
|
-
const close = !before || before === constants.characterGroupPunctuation && after || attentionMarkers.includes(previous);
|
|
4478
|
+
const open = !after || after === constants.characterGroupPunctuation && before || attentionMarkers.includes(code) && code !== codes.asterisk && code !== codes.underscore;
|
|
4479
|
+
const close = !before || before === constants.characterGroupPunctuation && after || attentionMarkers.includes(previous) && previous !== codes.asterisk && previous !== codes.underscore;
|
|
4327
4480
|
token._open = Boolean(marker === codes.asterisk ? open : open && (before || !close));
|
|
4328
4481
|
token._close = Boolean(marker === codes.asterisk ? close : close && (after || !open));
|
|
4329
4482
|
return ok2(code);
|
|
@@ -4639,6 +4792,35 @@ var init_character_reference = __esm(() => {
|
|
|
4639
4792
|
};
|
|
4640
4793
|
});
|
|
4641
4794
|
|
|
4795
|
+
// ../../node_modules/micromark-core-commonmark/dev/lib/partial-non-lazy-continuation.js
|
|
4796
|
+
function tokenizeNonLazyContinuation(effects, ok2, nok) {
|
|
4797
|
+
const self2 = this;
|
|
4798
|
+
return start;
|
|
4799
|
+
function start(code) {
|
|
4800
|
+
if (code === codes.eof) {
|
|
4801
|
+
return nok(code);
|
|
4802
|
+
}
|
|
4803
|
+
ok(markdownLineEnding(code), "expected eol");
|
|
4804
|
+
effects.enter(types.lineEnding);
|
|
4805
|
+
effects.consume(code);
|
|
4806
|
+
effects.exit(types.lineEnding);
|
|
4807
|
+
return after;
|
|
4808
|
+
}
|
|
4809
|
+
function after(code) {
|
|
4810
|
+
return self2.parser.lazy[self2.now().line] ? nok(code) : ok2(code);
|
|
4811
|
+
}
|
|
4812
|
+
}
|
|
4813
|
+
var nonLazyContinuation;
|
|
4814
|
+
var init_partial_non_lazy_continuation = __esm(() => {
|
|
4815
|
+
init_development();
|
|
4816
|
+
init_dev4();
|
|
4817
|
+
init_default();
|
|
4818
|
+
nonLazyContinuation = {
|
|
4819
|
+
partial: true,
|
|
4820
|
+
tokenize: tokenizeNonLazyContinuation
|
|
4821
|
+
};
|
|
4822
|
+
});
|
|
4823
|
+
|
|
4642
4824
|
// ../../node_modules/micromark-core-commonmark/dev/lib/code-fenced.js
|
|
4643
4825
|
function tokenizeCodeFenced(effects, ok2, nok) {
|
|
4644
4826
|
const self2 = this;
|
|
@@ -4794,33 +4976,13 @@ function tokenizeCodeFenced(effects, ok2, nok) {
|
|
|
4794
4976
|
}
|
|
4795
4977
|
}
|
|
4796
4978
|
}
|
|
4797
|
-
|
|
4798
|
-
const self2 = this;
|
|
4799
|
-
return start;
|
|
4800
|
-
function start(code) {
|
|
4801
|
-
if (code === codes.eof) {
|
|
4802
|
-
return nok(code);
|
|
4803
|
-
}
|
|
4804
|
-
ok(markdownLineEnding(code), "expected eol");
|
|
4805
|
-
effects.enter(types.lineEnding);
|
|
4806
|
-
effects.consume(code);
|
|
4807
|
-
effects.exit(types.lineEnding);
|
|
4808
|
-
return lineStart;
|
|
4809
|
-
}
|
|
4810
|
-
function lineStart(code) {
|
|
4811
|
-
return self2.parser.lazy[self2.now().line] ? nok(code) : ok2(code);
|
|
4812
|
-
}
|
|
4813
|
-
}
|
|
4814
|
-
var nonLazyContinuation, codeFenced;
|
|
4979
|
+
var codeFenced;
|
|
4815
4980
|
var init_code_fenced = __esm(() => {
|
|
4816
4981
|
init_development();
|
|
4817
4982
|
init_dev5();
|
|
4818
4983
|
init_dev4();
|
|
4819
4984
|
init_default();
|
|
4820
|
-
|
|
4821
|
-
partial: true,
|
|
4822
|
-
tokenize: tokenizeNonLazyContinuation
|
|
4823
|
-
};
|
|
4985
|
+
init_partial_non_lazy_continuation();
|
|
4824
4986
|
codeFenced = {
|
|
4825
4987
|
concrete: true,
|
|
4826
4988
|
name: "codeFenced",
|
|
@@ -4830,16 +4992,11 @@ var init_code_fenced = __esm(() => {
|
|
|
4830
4992
|
|
|
4831
4993
|
// ../../node_modules/micromark-core-commonmark/dev/lib/code-indented.js
|
|
4832
4994
|
function tokenizeCodeIndented(effects, ok2, nok) {
|
|
4833
|
-
const self2 = this;
|
|
4834
4995
|
return start;
|
|
4835
4996
|
function start(code) {
|
|
4836
4997
|
ok(markdownSpace(code));
|
|
4837
4998
|
effects.enter(types.codeIndented);
|
|
4838
|
-
return
|
|
4839
|
-
}
|
|
4840
|
-
function afterPrefix(code) {
|
|
4841
|
-
const tail = self2.events[self2.events.length - 1];
|
|
4842
|
-
return tail && tail[1].type === types.linePrefix && tail[2].sliceSerialize(tail[1], true).length >= constants.tabSize ? atBreak(code) : nok(code);
|
|
4999
|
+
return factorySpaceMinMax(effects, atBreak, nok, types.linePrefix, constants.tabSize, constants.tabSize)(code);
|
|
4843
5000
|
}
|
|
4844
5001
|
function atBreak(code) {
|
|
4845
5002
|
if (code === codes.eof) {
|
|
@@ -4877,11 +5034,10 @@ function tokenizeFurtherStart(effects, ok, nok) {
|
|
|
4877
5034
|
effects.exit(types.lineEnding);
|
|
4878
5035
|
return furtherStart;
|
|
4879
5036
|
}
|
|
4880
|
-
return
|
|
5037
|
+
return factorySpaceMinMax(effects, ok, onNotEnoughPrefix, types.linePrefix, constants.tabSize, constants.tabSize)(code);
|
|
4881
5038
|
}
|
|
4882
|
-
function
|
|
4883
|
-
|
|
4884
|
-
return tail && tail[1].type === types.linePrefix && tail[2].sliceSerialize(tail[1], true).length >= constants.tabSize ? ok(code) : markdownLineEnding(code) ? furtherStart(code) : nok(code);
|
|
5039
|
+
function onNotEnoughPrefix(code) {
|
|
5040
|
+
return markdownLineEnding(code) ? furtherStart(code) : nok(code);
|
|
4885
5041
|
}
|
|
4886
5042
|
}
|
|
4887
5043
|
var codeIndented, furtherStart;
|
|
@@ -5691,8 +5847,6 @@ var init_hard_break_escape = __esm(() => {
|
|
|
5691
5847
|
function resolveHeadingAtx(events, context) {
|
|
5692
5848
|
let contentEnd = events.length - 2;
|
|
5693
5849
|
let contentStart = 3;
|
|
5694
|
-
let content;
|
|
5695
|
-
let text;
|
|
5696
5850
|
if (events[contentStart][1].type === types.whitespace) {
|
|
5697
5851
|
contentStart += 2;
|
|
5698
5852
|
}
|
|
@@ -5703,12 +5857,12 @@ function resolveHeadingAtx(events, context) {
|
|
|
5703
5857
|
contentEnd -= contentStart + 1 === contentEnd ? 2 : 4;
|
|
5704
5858
|
}
|
|
5705
5859
|
if (contentEnd > contentStart) {
|
|
5706
|
-
content = {
|
|
5860
|
+
const content = {
|
|
5707
5861
|
type: types.atxHeadingText,
|
|
5708
5862
|
start: events[contentStart][1].start,
|
|
5709
5863
|
end: events[contentEnd][1].end
|
|
5710
5864
|
};
|
|
5711
|
-
text = {
|
|
5865
|
+
const text = {
|
|
5712
5866
|
type: types.chunkText,
|
|
5713
5867
|
start: events[contentStart][1].start,
|
|
5714
5868
|
end: events[contentEnd][1].end,
|
|
@@ -6127,7 +6281,7 @@ function tokenizeHtmlFlow(effects, ok2, nok) {
|
|
|
6127
6281
|
return continuation;
|
|
6128
6282
|
}
|
|
6129
6283
|
function continuationStart(code) {
|
|
6130
|
-
return effects.check(
|
|
6284
|
+
return effects.check(nonLazyContinuation, continuationStartNonLazy, continuationAfter)(code);
|
|
6131
6285
|
}
|
|
6132
6286
|
function continuationStartNonLazy(code) {
|
|
6133
6287
|
ok(markdownLineEnding(code));
|
|
@@ -6206,22 +6360,6 @@ function tokenizeHtmlFlow(effects, ok2, nok) {
|
|
|
6206
6360
|
return ok2(code);
|
|
6207
6361
|
}
|
|
6208
6362
|
}
|
|
6209
|
-
function tokenizeNonLazyContinuationStart(effects, ok, nok) {
|
|
6210
|
-
const self2 = this;
|
|
6211
|
-
return start;
|
|
6212
|
-
function start(code) {
|
|
6213
|
-
if (markdownLineEnding(code)) {
|
|
6214
|
-
effects.enter(types.lineEnding);
|
|
6215
|
-
effects.consume(code);
|
|
6216
|
-
effects.exit(types.lineEnding);
|
|
6217
|
-
return after;
|
|
6218
|
-
}
|
|
6219
|
-
return nok(code);
|
|
6220
|
-
}
|
|
6221
|
-
function after(code) {
|
|
6222
|
-
return self2.parser.lazy[self2.now().line] ? nok(code) : ok(code);
|
|
6223
|
-
}
|
|
6224
|
-
}
|
|
6225
6363
|
function tokenizeBlankLineBefore(effects, ok2, nok) {
|
|
6226
6364
|
return start;
|
|
6227
6365
|
function start(code) {
|
|
@@ -6232,13 +6370,14 @@ function tokenizeBlankLineBefore(effects, ok2, nok) {
|
|
|
6232
6370
|
return effects.attempt(blankLine, ok2, nok);
|
|
6233
6371
|
}
|
|
6234
6372
|
}
|
|
6235
|
-
var htmlFlow, blankLineBefore
|
|
6373
|
+
var htmlFlow, blankLineBefore;
|
|
6236
6374
|
var init_html_flow = __esm(() => {
|
|
6237
6375
|
init_development();
|
|
6238
6376
|
init_dev4();
|
|
6239
6377
|
init_micromark_util_html_tag_name();
|
|
6240
6378
|
init_default();
|
|
6241
6379
|
init_blank_line();
|
|
6380
|
+
init_partial_non_lazy_continuation();
|
|
6242
6381
|
htmlFlow = {
|
|
6243
6382
|
concrete: true,
|
|
6244
6383
|
name: "htmlFlow",
|
|
@@ -6246,10 +6385,6 @@ var init_html_flow = __esm(() => {
|
|
|
6246
6385
|
tokenize: tokenizeHtmlFlow
|
|
6247
6386
|
};
|
|
6248
6387
|
blankLineBefore = { partial: true, tokenize: tokenizeBlankLineBefore };
|
|
6249
|
-
nonLazyContinuationStart = {
|
|
6250
|
-
partial: true,
|
|
6251
|
-
tokenize: tokenizeNonLazyContinuationStart
|
|
6252
|
-
};
|
|
6253
6388
|
});
|
|
6254
6389
|
|
|
6255
6390
|
// ../../node_modules/micromark-core-commonmark/dev/lib/html-text.js
|
|
@@ -6587,12 +6722,11 @@ function resolveAllLabelEnd(events) {
|
|
|
6587
6722
|
function resolveToLabelEnd(events, context) {
|
|
6588
6723
|
let index = events.length;
|
|
6589
6724
|
let offset = 0;
|
|
6590
|
-
let token;
|
|
6591
6725
|
let open;
|
|
6592
6726
|
let close;
|
|
6593
6727
|
let media;
|
|
6594
6728
|
while (index--) {
|
|
6595
|
-
token = events[index][1];
|
|
6729
|
+
const token = events[index][1];
|
|
6596
6730
|
if (open) {
|
|
6597
6731
|
if (token.type === types.link || token.type === types.labelLink && token._inactive) {
|
|
6598
6732
|
break;
|
|
@@ -6650,14 +6784,14 @@ function resolveToLabelEnd(events, context) {
|
|
|
6650
6784
|
}
|
|
6651
6785
|
function tokenizeLabelEnd(effects, ok2, nok) {
|
|
6652
6786
|
const self2 = this;
|
|
6653
|
-
|
|
6787
|
+
const labelStarts = self2._labelStarts;
|
|
6654
6788
|
let labelStart;
|
|
6655
6789
|
let defined;
|
|
6656
|
-
|
|
6657
|
-
|
|
6658
|
-
|
|
6659
|
-
break;
|
|
6790
|
+
if (labelStarts) {
|
|
6791
|
+
while (labelStarts.length > 0 && labelStarts[labelStarts.length - 1]._balanced) {
|
|
6792
|
+
labelStarts.pop();
|
|
6660
6793
|
}
|
|
6794
|
+
labelStart = labelStarts[labelStarts.length - 1];
|
|
6661
6795
|
}
|
|
6662
6796
|
return start;
|
|
6663
6797
|
function start(code) {
|
|
@@ -6689,6 +6823,8 @@ function tokenizeLabelEnd(effects, ok2, nok) {
|
|
|
6689
6823
|
return effects.attempt(referenceCollapsedConstruct, labelEndOk, labelEndNok)(code);
|
|
6690
6824
|
}
|
|
6691
6825
|
function labelEndOk(code) {
|
|
6826
|
+
ok(labelStarts, "expected `labelStarts` to be populated");
|
|
6827
|
+
labelStarts.pop();
|
|
6692
6828
|
return ok2(code);
|
|
6693
6829
|
}
|
|
6694
6830
|
function labelEndNok(code) {
|
|
@@ -6801,6 +6937,7 @@ var init_label_end = __esm(() => {
|
|
|
6801
6937
|
// ../../node_modules/micromark-core-commonmark/dev/lib/label-start-image.js
|
|
6802
6938
|
function tokenizeLabelStartImage(effects, ok2, nok) {
|
|
6803
6939
|
const self2 = this;
|
|
6940
|
+
let labelImage;
|
|
6804
6941
|
return start;
|
|
6805
6942
|
function start(code) {
|
|
6806
6943
|
ok(code === codes.exclamationMark, "expected `!`");
|
|
@@ -6815,13 +6952,18 @@ function tokenizeLabelStartImage(effects, ok2, nok) {
|
|
|
6815
6952
|
effects.enter(types.labelMarker);
|
|
6816
6953
|
effects.consume(code);
|
|
6817
6954
|
effects.exit(types.labelMarker);
|
|
6818
|
-
effects.exit(types.labelImage);
|
|
6955
|
+
labelImage = effects.exit(types.labelImage);
|
|
6819
6956
|
return after;
|
|
6820
6957
|
}
|
|
6821
6958
|
return nok(code);
|
|
6822
6959
|
}
|
|
6823
6960
|
function after(code) {
|
|
6824
|
-
|
|
6961
|
+
if (code === codes.caret && "_hiddenFootnoteSupport" in self2.parser.constructs) {
|
|
6962
|
+
return nok(code);
|
|
6963
|
+
}
|
|
6964
|
+
self2._labelStarts = self2._labelStarts || [];
|
|
6965
|
+
self2._labelStarts.push(labelImage);
|
|
6966
|
+
return ok2(code);
|
|
6825
6967
|
}
|
|
6826
6968
|
}
|
|
6827
6969
|
var labelStartImage;
|
|
@@ -6839,6 +6981,7 @@ var init_label_start_image = __esm(() => {
|
|
|
6839
6981
|
// ../../node_modules/micromark-core-commonmark/dev/lib/label-start-link.js
|
|
6840
6982
|
function tokenizeLabelStartLink(effects, ok2, nok) {
|
|
6841
6983
|
const self2 = this;
|
|
6984
|
+
let labelLink;
|
|
6842
6985
|
return start;
|
|
6843
6986
|
function start(code) {
|
|
6844
6987
|
ok(code === codes.leftSquareBracket, "expected `[`");
|
|
@@ -6846,11 +6989,16 @@ function tokenizeLabelStartLink(effects, ok2, nok) {
|
|
|
6846
6989
|
effects.enter(types.labelMarker);
|
|
6847
6990
|
effects.consume(code);
|
|
6848
6991
|
effects.exit(types.labelMarker);
|
|
6849
|
-
effects.exit(types.labelLink);
|
|
6992
|
+
labelLink = effects.exit(types.labelLink);
|
|
6850
6993
|
return after;
|
|
6851
6994
|
}
|
|
6852
6995
|
function after(code) {
|
|
6853
|
-
|
|
6996
|
+
if (code === codes.caret && "_hiddenFootnoteSupport" in self2.parser.constructs) {
|
|
6997
|
+
return nok(code);
|
|
6998
|
+
}
|
|
6999
|
+
self2._labelStarts = self2._labelStarts || [];
|
|
7000
|
+
self2._labelStarts.push(labelLink);
|
|
7001
|
+
return ok2(code);
|
|
6854
7002
|
}
|
|
6855
7003
|
}
|
|
6856
7004
|
var labelStartLink;
|
|
@@ -7079,6 +7227,7 @@ var init_list = __esm(() => {
|
|
|
7079
7227
|
|
|
7080
7228
|
// ../../node_modules/micromark-core-commonmark/dev/lib/setext-underline.js
|
|
7081
7229
|
function resolveToSetextUnderline(events, context) {
|
|
7230
|
+
const editMap = new EditMap;
|
|
7082
7231
|
let index = events.length;
|
|
7083
7232
|
let content;
|
|
7084
7233
|
let text;
|
|
@@ -7094,7 +7243,7 @@ function resolveToSetextUnderline(events, context) {
|
|
|
7094
7243
|
}
|
|
7095
7244
|
} else {
|
|
7096
7245
|
if (events[index][1].type === types.content) {
|
|
7097
|
-
|
|
7246
|
+
editMap.add(index, 1, []);
|
|
7098
7247
|
}
|
|
7099
7248
|
if (!definition && events[index][1].type === types.definition) {
|
|
7100
7249
|
definition = index;
|
|
@@ -7112,13 +7261,14 @@ function resolveToSetextUnderline(events, context) {
|
|
|
7112
7261
|
};
|
|
7113
7262
|
events[text][1].type = types.setextHeadingText;
|
|
7114
7263
|
if (definition) {
|
|
7115
|
-
|
|
7116
|
-
|
|
7264
|
+
editMap.add(text, 0, [["enter", heading, context]]);
|
|
7265
|
+
editMap.add(definition + 1, 0, [["exit", events[content][1], context]]);
|
|
7117
7266
|
events[content][1].end = { ...events[definition][1].end };
|
|
7118
7267
|
} else {
|
|
7119
7268
|
events[content][1] = heading;
|
|
7120
7269
|
}
|
|
7121
|
-
events.
|
|
7270
|
+
editMap.add(events.length, 0, [["exit", heading, context]]);
|
|
7271
|
+
editMap.consume(events);
|
|
7122
7272
|
return events;
|
|
7123
7273
|
}
|
|
7124
7274
|
function tokenizeSetextUnderline(effects, ok2, nok) {
|
|
@@ -7315,6 +7465,7 @@ function createResolver(extraResolver) {
|
|
|
7315
7465
|
}
|
|
7316
7466
|
}
|
|
7317
7467
|
function resolveAllLineSuffixes(events, context) {
|
|
7468
|
+
const editMap = new EditMap;
|
|
7318
7469
|
let eventIndex = 0;
|
|
7319
7470
|
while (++eventIndex <= events.length) {
|
|
7320
7471
|
if ((eventIndex === events.length || events[eventIndex][1].type === types.lineEnding) && events[eventIndex - 1][1].type === types.data) {
|
|
@@ -7332,8 +7483,9 @@ function resolveAllLineSuffixes(events, context) {
|
|
|
7332
7483
|
size++;
|
|
7333
7484
|
bufferIndex--;
|
|
7334
7485
|
}
|
|
7335
|
-
if (bufferIndex)
|
|
7486
|
+
if (bufferIndex) {
|
|
7336
7487
|
break;
|
|
7488
|
+
}
|
|
7337
7489
|
bufferIndex = -1;
|
|
7338
7490
|
} else if (chunk === codes.horizontalTab) {
|
|
7339
7491
|
tabs = true;
|
|
@@ -7362,13 +7514,16 @@ function resolveAllLineSuffixes(events, context) {
|
|
|
7362
7514
|
if (data.start.offset === data.end.offset) {
|
|
7363
7515
|
Object.assign(data, token);
|
|
7364
7516
|
} else {
|
|
7365
|
-
|
|
7366
|
-
|
|
7517
|
+
editMap.add(eventIndex, 0, [
|
|
7518
|
+
["enter", token, context],
|
|
7519
|
+
["exit", token, context]
|
|
7520
|
+
]);
|
|
7367
7521
|
}
|
|
7368
7522
|
}
|
|
7369
7523
|
eventIndex++;
|
|
7370
7524
|
}
|
|
7371
7525
|
}
|
|
7526
|
+
editMap.consume(events);
|
|
7372
7527
|
return events;
|
|
7373
7528
|
}
|
|
7374
7529
|
var resolver, string, text;
|
|
@@ -8255,11 +8410,10 @@ function createTokenizer(parser, initialize, from) {
|
|
|
8255
8410
|
debug("position: define skip: `%j`", point);
|
|
8256
8411
|
}
|
|
8257
8412
|
function main() {
|
|
8258
|
-
let chunkIndex;
|
|
8259
8413
|
while (point._index < chunks.length) {
|
|
8260
8414
|
const chunk = chunks[point._index];
|
|
8261
8415
|
if (typeof chunk === "string") {
|
|
8262
|
-
chunkIndex = point._index;
|
|
8416
|
+
const chunkIndex = point._index;
|
|
8263
8417
|
if (point._bufferIndex < 0) {
|
|
8264
8418
|
point._bufferIndex = 0;
|
|
8265
8419
|
}
|
|
@@ -8468,7 +8622,7 @@ function serializeChunks(chunks, expandTabs) {
|
|
|
8468
8622
|
let value;
|
|
8469
8623
|
if (typeof chunk === "string") {
|
|
8470
8624
|
value = chunk;
|
|
8471
|
-
} else
|
|
8625
|
+
} else {
|
|
8472
8626
|
switch (chunk) {
|
|
8473
8627
|
case codes.carriageReturn: {
|
|
8474
8628
|
value = values.cr;
|
|
@@ -8487,8 +8641,9 @@ function serializeChunks(chunks, expandTabs) {
|
|
|
8487
8641
|
break;
|
|
8488
8642
|
}
|
|
8489
8643
|
case codes.virtualSpace: {
|
|
8490
|
-
if (!expandTabs && atTab)
|
|
8644
|
+
if (!expandTabs && atTab) {
|
|
8491
8645
|
continue;
|
|
8646
|
+
}
|
|
8492
8647
|
value = values.space;
|
|
8493
8648
|
break;
|
|
8494
8649
|
}
|
|
@@ -8497,6 +8652,7 @@ function serializeChunks(chunks, expandTabs) {
|
|
|
8497
8652
|
value = String.fromCharCode(chunk);
|
|
8498
8653
|
}
|
|
8499
8654
|
}
|
|
8655
|
+
}
|
|
8500
8656
|
atTab = chunk === codes.horizontalTab;
|
|
8501
8657
|
result.push(value);
|
|
8502
8658
|
}
|
|
@@ -8561,14 +8717,9 @@ function preprocess() {
|
|
|
8561
8717
|
let atCarriageReturn;
|
|
8562
8718
|
return preprocessor;
|
|
8563
8719
|
function preprocessor(value, encoding, end) {
|
|
8564
|
-
const chunks = [];
|
|
8565
|
-
let match;
|
|
8566
|
-
let next;
|
|
8567
|
-
let startPosition;
|
|
8568
|
-
let endPosition;
|
|
8569
|
-
let code;
|
|
8570
8720
|
value = buffer + (typeof value === "string" ? value.toString() : new TextDecoder(encoding || undefined).decode(value));
|
|
8571
|
-
|
|
8721
|
+
const chunks = [];
|
|
8722
|
+
let startPosition = 0;
|
|
8572
8723
|
buffer = "";
|
|
8573
8724
|
if (start) {
|
|
8574
8725
|
if (value.charCodeAt(0) === codes.byteOrderMarker) {
|
|
@@ -8578,9 +8729,9 @@ function preprocess() {
|
|
|
8578
8729
|
}
|
|
8579
8730
|
while (startPosition < value.length) {
|
|
8580
8731
|
search.lastIndex = startPosition;
|
|
8581
|
-
match = search.exec(value);
|
|
8582
|
-
endPosition = match && match.index !== undefined ? match.index : value.length;
|
|
8583
|
-
code = value.charCodeAt(endPosition);
|
|
8732
|
+
const match = search.exec(value);
|
|
8733
|
+
const endPosition = match && match.index !== undefined ? match.index : value.length;
|
|
8734
|
+
const code = value.charCodeAt(endPosition);
|
|
8584
8735
|
if (!match) {
|
|
8585
8736
|
buffer = value.slice(startPosition);
|
|
8586
8737
|
break;
|
|
@@ -8604,10 +8755,11 @@ function preprocess() {
|
|
|
8604
8755
|
break;
|
|
8605
8756
|
}
|
|
8606
8757
|
case codes.ht: {
|
|
8607
|
-
next = Math.ceil(column / constants.tabSize) * constants.tabSize;
|
|
8758
|
+
const next = Math.ceil(column / constants.tabSize) * constants.tabSize;
|
|
8608
8759
|
chunks.push(codes.horizontalTab);
|
|
8609
|
-
while (column++ < next)
|
|
8760
|
+
while (column++ < next) {
|
|
8610
8761
|
chunks.push(codes.virtualSpace);
|
|
8762
|
+
}
|
|
8611
8763
|
break;
|
|
8612
8764
|
}
|
|
8613
8765
|
case codes.lf: {
|
|
@@ -8624,10 +8776,12 @@ function preprocess() {
|
|
|
8624
8776
|
startPosition = endPosition + 1;
|
|
8625
8777
|
}
|
|
8626
8778
|
if (end) {
|
|
8627
|
-
if (atCarriageReturn)
|
|
8779
|
+
if (atCarriageReturn) {
|
|
8628
8780
|
chunks.push(codes.carriageReturn);
|
|
8629
|
-
|
|
8781
|
+
}
|
|
8782
|
+
if (buffer) {
|
|
8630
8783
|
chunks.push(buffer);
|
|
8784
|
+
}
|
|
8631
8785
|
chunks.push(codes.eof);
|
|
8632
8786
|
}
|
|
8633
8787
|
return chunks;
|
|
@@ -8680,6 +8834,8 @@ function fromMarkdown(value, encoding, options) {
|
|
|
8680
8834
|
}
|
|
8681
8835
|
function compiler(options) {
|
|
8682
8836
|
const config = {
|
|
8837
|
+
afterExit: [],
|
|
8838
|
+
beforeEnter: [],
|
|
8683
8839
|
transforms: [],
|
|
8684
8840
|
canContainEols: ["emphasis", "fragment", "heading", "paragraph", "strong"],
|
|
8685
8841
|
enter: {
|
|
@@ -8781,7 +8937,7 @@ function compiler(options) {
|
|
|
8781
8937
|
const data = {};
|
|
8782
8938
|
return compile;
|
|
8783
8939
|
function compile(events) {
|
|
8784
|
-
let tree = { type: "root", children: [] };
|
|
8940
|
+
let tree = { type: "root", children: [], position: undefined };
|
|
8785
8941
|
const context = {
|
|
8786
8942
|
stack: [tree],
|
|
8787
8943
|
tokenStack: [],
|
|
@@ -8793,23 +8949,32 @@ function compiler(options) {
|
|
|
8793
8949
|
data
|
|
8794
8950
|
};
|
|
8795
8951
|
const listStack = [];
|
|
8952
|
+
const prepared = [];
|
|
8796
8953
|
let index = -1;
|
|
8797
8954
|
while (++index < events.length) {
|
|
8955
|
+
prepared.push(events[index]);
|
|
8798
8956
|
if (events[index][1].type === types.listOrdered || events[index][1].type === types.listUnordered) {
|
|
8799
8957
|
if (events[index][0] === "enter") {
|
|
8800
|
-
listStack.push(
|
|
8958
|
+
listStack.push(prepared.length - 1);
|
|
8801
8959
|
} else {
|
|
8802
8960
|
const tail = listStack.pop();
|
|
8803
8961
|
ok(typeof tail === "number", "expected list to be open");
|
|
8804
|
-
|
|
8962
|
+
prepareList(prepared, tail);
|
|
8805
8963
|
}
|
|
8806
8964
|
}
|
|
8807
8965
|
}
|
|
8966
|
+
events = prepared;
|
|
8808
8967
|
index = -1;
|
|
8809
8968
|
while (++index < events.length) {
|
|
8810
8969
|
const handler = config[events[index][0]];
|
|
8970
|
+
if (events[index][0] === "enter" && config.beforeEnter.length > 0) {
|
|
8971
|
+
callListeners(config.beforeEnter, { ...context, sliceSerialize: events[index][2].sliceSerialize }, events[index][1]);
|
|
8972
|
+
}
|
|
8811
8973
|
if (own3.call(handler, events[index][1].type)) {
|
|
8812
|
-
handler[events[index][1].type].call(
|
|
8974
|
+
handler[events[index][1].type].call({ ...context, sliceSerialize: events[index][2].sliceSerialize }, events[index][1]);
|
|
8975
|
+
}
|
|
8976
|
+
if (events[index][0] === "exit" && config.afterExit.length > 0) {
|
|
8977
|
+
callListeners(config.afterExit, { ...context, sliceSerialize: events[index][2].sliceSerialize }, events[index][1]);
|
|
8813
8978
|
}
|
|
8814
8979
|
}
|
|
8815
8980
|
if (context.tokenStack.length > 0) {
|
|
@@ -8827,7 +8992,14 @@ function compiler(options) {
|
|
|
8827
8992
|
}
|
|
8828
8993
|
return tree;
|
|
8829
8994
|
}
|
|
8830
|
-
function
|
|
8995
|
+
function callListeners(listeners, context, token) {
|
|
8996
|
+
let index = -1;
|
|
8997
|
+
while (++index < listeners.length) {
|
|
8998
|
+
listeners[index].call(context, token);
|
|
8999
|
+
}
|
|
9000
|
+
}
|
|
9001
|
+
function prepareList(events, start) {
|
|
9002
|
+
const end = events.length - 1;
|
|
8831
9003
|
let index = start - 1;
|
|
8832
9004
|
let containerBalance = -1;
|
|
8833
9005
|
let listSpread = false;
|
|
@@ -8835,7 +9007,8 @@ function compiler(options) {
|
|
|
8835
9007
|
let lineIndex;
|
|
8836
9008
|
let firstBlankLineIndex;
|
|
8837
9009
|
let atMarker;
|
|
8838
|
-
|
|
9010
|
+
const insertions = [];
|
|
9011
|
+
while (++index <= end) {
|
|
8839
9012
|
const event = events[index];
|
|
8840
9013
|
switch (event[1].type) {
|
|
8841
9014
|
case types.listUnordered:
|
|
@@ -8892,9 +9065,10 @@ function compiler(options) {
|
|
|
8892
9065
|
listItem._spread = true;
|
|
8893
9066
|
}
|
|
8894
9067
|
listItem.end = Object.assign({}, lineIndex ? events[lineIndex][1].start : event[1].end);
|
|
8895
|
-
|
|
8896
|
-
|
|
8897
|
-
|
|
9068
|
+
insertions.push({
|
|
9069
|
+
at: lineIndex || index,
|
|
9070
|
+
event: ["exit", listItem, event[2]]
|
|
9071
|
+
});
|
|
8898
9072
|
}
|
|
8899
9073
|
if (event[1].type === types.listItemPrefix) {
|
|
8900
9074
|
const item = {
|
|
@@ -8904,16 +9078,23 @@ function compiler(options) {
|
|
|
8904
9078
|
end: undefined
|
|
8905
9079
|
};
|
|
8906
9080
|
listItem = item;
|
|
8907
|
-
|
|
8908
|
-
index++;
|
|
8909
|
-
length++;
|
|
9081
|
+
insertions.push({ at: index, event: ["enter", item, event[2]] });
|
|
8910
9082
|
firstBlankLineIndex = undefined;
|
|
8911
9083
|
atMarker = true;
|
|
8912
9084
|
}
|
|
8913
9085
|
}
|
|
8914
9086
|
}
|
|
9087
|
+
const listEvents = events.splice(start);
|
|
9088
|
+
let insertion = 0;
|
|
9089
|
+
index = -1;
|
|
9090
|
+
while (++index < listEvents.length) {
|
|
9091
|
+
while (insertion < insertions.length && insertions[insertion].at === start + index) {
|
|
9092
|
+
events.push(insertions[insertion++].event);
|
|
9093
|
+
}
|
|
9094
|
+
events.push(listEvents[index]);
|
|
9095
|
+
}
|
|
9096
|
+
ok(insertion === insertions.length, "expected insertions to be merged");
|
|
8915
9097
|
events[start][1]._spread = listSpread;
|
|
8916
|
-
return length;
|
|
8917
9098
|
}
|
|
8918
9099
|
function opener(create, and) {
|
|
8919
9100
|
return open;
|
|
@@ -8953,7 +9134,8 @@ function compiler(options) {
|
|
|
8953
9134
|
const open = this.tokenStack.pop();
|
|
8954
9135
|
if (!open) {
|
|
8955
9136
|
throw new Error("Cannot close `" + token.type + "` (" + stringifyPosition({ start: token.start, end: token.end }) + "): it’s not open");
|
|
8956
|
-
}
|
|
9137
|
+
}
|
|
9138
|
+
if (open[0].type !== token.type) {
|
|
8957
9139
|
if (onExitError) {
|
|
8958
9140
|
onExitError.call(this, token, open[0]);
|
|
8959
9141
|
} else {
|
|
@@ -9250,13 +9432,19 @@ function compiler(options) {
|
|
|
9250
9432
|
node.url = "mailto:" + this.sliceSerialize(token);
|
|
9251
9433
|
}
|
|
9252
9434
|
function blockQuote() {
|
|
9253
|
-
return { type: "blockquote", children: [] };
|
|
9435
|
+
return { type: "blockquote", children: [], position: undefined };
|
|
9254
9436
|
}
|
|
9255
9437
|
function codeFlow() {
|
|
9256
|
-
return {
|
|
9438
|
+
return {
|
|
9439
|
+
type: "code",
|
|
9440
|
+
lang: null,
|
|
9441
|
+
meta: null,
|
|
9442
|
+
value: "",
|
|
9443
|
+
position: undefined
|
|
9444
|
+
};
|
|
9257
9445
|
}
|
|
9258
9446
|
function codeText() {
|
|
9259
|
-
return { type: "inlineCode", value: "" };
|
|
9447
|
+
return { type: "inlineCode", value: "", position: undefined };
|
|
9260
9448
|
}
|
|
9261
9449
|
function definition() {
|
|
9262
9450
|
return {
|
|
@@ -9264,30 +9452,44 @@ function compiler(options) {
|
|
|
9264
9452
|
identifier: "",
|
|
9265
9453
|
label: null,
|
|
9266
9454
|
title: null,
|
|
9267
|
-
url: ""
|
|
9455
|
+
url: "",
|
|
9456
|
+
position: undefined
|
|
9268
9457
|
};
|
|
9269
9458
|
}
|
|
9270
9459
|
function emphasis() {
|
|
9271
|
-
return { type: "emphasis", children: [] };
|
|
9460
|
+
return { type: "emphasis", children: [], position: undefined };
|
|
9272
9461
|
}
|
|
9273
9462
|
function heading() {
|
|
9274
9463
|
return {
|
|
9275
9464
|
type: "heading",
|
|
9276
9465
|
depth: 0,
|
|
9277
|
-
children: []
|
|
9466
|
+
children: [],
|
|
9467
|
+
position: undefined
|
|
9278
9468
|
};
|
|
9279
9469
|
}
|
|
9280
9470
|
function hardBreak() {
|
|
9281
|
-
return { type: "break" };
|
|
9471
|
+
return { type: "break", position: undefined };
|
|
9282
9472
|
}
|
|
9283
9473
|
function html() {
|
|
9284
|
-
return { type: "html", value: "" };
|
|
9474
|
+
return { type: "html", value: "", position: undefined };
|
|
9285
9475
|
}
|
|
9286
9476
|
function image() {
|
|
9287
|
-
return {
|
|
9477
|
+
return {
|
|
9478
|
+
type: "image",
|
|
9479
|
+
title: null,
|
|
9480
|
+
url: "",
|
|
9481
|
+
alt: null,
|
|
9482
|
+
position: undefined
|
|
9483
|
+
};
|
|
9288
9484
|
}
|
|
9289
9485
|
function link() {
|
|
9290
|
-
return {
|
|
9486
|
+
return {
|
|
9487
|
+
type: "link",
|
|
9488
|
+
title: null,
|
|
9489
|
+
url: "",
|
|
9490
|
+
children: [],
|
|
9491
|
+
position: undefined
|
|
9492
|
+
};
|
|
9291
9493
|
}
|
|
9292
9494
|
function list(token) {
|
|
9293
9495
|
return {
|
|
@@ -9295,7 +9497,8 @@ function compiler(options) {
|
|
|
9295
9497
|
ordered: token.type === "listOrdered",
|
|
9296
9498
|
start: null,
|
|
9297
9499
|
spread: token._spread,
|
|
9298
|
-
children: []
|
|
9500
|
+
children: [],
|
|
9501
|
+
position: undefined
|
|
9299
9502
|
};
|
|
9300
9503
|
}
|
|
9301
9504
|
function listItem(token) {
|
|
@@ -9303,20 +9506,21 @@ function compiler(options) {
|
|
|
9303
9506
|
type: "listItem",
|
|
9304
9507
|
spread: token._spread,
|
|
9305
9508
|
checked: null,
|
|
9306
|
-
children: []
|
|
9509
|
+
children: [],
|
|
9510
|
+
position: undefined
|
|
9307
9511
|
};
|
|
9308
9512
|
}
|
|
9309
9513
|
function paragraph() {
|
|
9310
|
-
return { type: "paragraph", children: [] };
|
|
9514
|
+
return { type: "paragraph", children: [], position: undefined };
|
|
9311
9515
|
}
|
|
9312
9516
|
function strong() {
|
|
9313
|
-
return { type: "strong", children: [] };
|
|
9517
|
+
return { type: "strong", children: [], position: undefined };
|
|
9314
9518
|
}
|
|
9315
9519
|
function text() {
|
|
9316
|
-
return { type: "text", value: "" };
|
|
9520
|
+
return { type: "text", value: "", position: undefined };
|
|
9317
9521
|
}
|
|
9318
9522
|
function thematicBreak() {
|
|
9319
|
-
return { type: "thematicBreak" };
|
|
9523
|
+
return { type: "thematicBreak", position: undefined };
|
|
9320
9524
|
}
|
|
9321
9525
|
}
|
|
9322
9526
|
function point2(d) {
|
|
@@ -9352,6 +9556,14 @@ function extension(combined, extension) {
|
|
|
9352
9556
|
}
|
|
9353
9557
|
break;
|
|
9354
9558
|
}
|
|
9559
|
+
case "afterExit":
|
|
9560
|
+
case "beforeEnter": {
|
|
9561
|
+
const right = extension[key];
|
|
9562
|
+
if (right) {
|
|
9563
|
+
combined[key].push(right);
|
|
9564
|
+
}
|
|
9565
|
+
break;
|
|
9566
|
+
}
|
|
9355
9567
|
case "enter":
|
|
9356
9568
|
case "exit": {
|
|
9357
9569
|
const right = extension[key];
|
|
@@ -9367,9 +9579,8 @@ function extension(combined, extension) {
|
|
|
9367
9579
|
function defaultOnError(left, right) {
|
|
9368
9580
|
if (left) {
|
|
9369
9581
|
throw new Error("Cannot close `" + left.type + "` (" + stringifyPosition({ start: left.start, end: left.end }) + "): a different token (`" + right.type + "`, " + stringifyPosition({ start: right.start, end: right.end }) + ") is open");
|
|
9370
|
-
} else {
|
|
9371
|
-
throw new Error("Cannot close document, a token (`" + right.type + "`, " + stringifyPosition({ start: right.start, end: right.end }) + ") is still open");
|
|
9372
9582
|
}
|
|
9583
|
+
throw new Error("Cannot close document, a token (`" + right.type + "`, " + stringifyPosition({ start: right.start, end: right.end }) + ") is still open");
|
|
9373
9584
|
}
|
|
9374
9585
|
var own3;
|
|
9375
9586
|
var init_lib5 = __esm(() => {
|
|
@@ -17426,15 +17637,13 @@ function findAndReplace(tree, list, options) {
|
|
|
17426
17637
|
find.lastIndex = position + 1;
|
|
17427
17638
|
} else {
|
|
17428
17639
|
if (start !== position) {
|
|
17429
|
-
|
|
17430
|
-
type: "text",
|
|
17431
|
-
value: node.value.slice(start, position)
|
|
17432
|
-
});
|
|
17640
|
+
add({ type: "text", value: node.value.slice(start, position) });
|
|
17433
17641
|
}
|
|
17434
17642
|
if (Array.isArray(value)) {
|
|
17435
|
-
|
|
17643
|
+
for (const child of value)
|
|
17644
|
+
add(child);
|
|
17436
17645
|
} else if (value) {
|
|
17437
|
-
|
|
17646
|
+
add(value);
|
|
17438
17647
|
}
|
|
17439
17648
|
start = position + match[0].length;
|
|
17440
17649
|
change = true;
|
|
@@ -17446,20 +17655,28 @@ function findAndReplace(tree, list, options) {
|
|
|
17446
17655
|
}
|
|
17447
17656
|
if (change) {
|
|
17448
17657
|
if (start < node.value.length) {
|
|
17449
|
-
|
|
17658
|
+
add({ type: "text", value: node.value.slice(start) });
|
|
17450
17659
|
}
|
|
17451
17660
|
parent.children.splice(index, 1, ...nodes);
|
|
17452
17661
|
} else {
|
|
17453
17662
|
nodes = [node];
|
|
17454
17663
|
}
|
|
17455
17664
|
return index + nodes.length;
|
|
17665
|
+
function add(child) {
|
|
17666
|
+
const previous = nodes[nodes.length - 1];
|
|
17667
|
+
if (previous && previous.type === "text" && child.type === "text") {
|
|
17668
|
+
previous.value += child.value;
|
|
17669
|
+
} else {
|
|
17670
|
+
nodes.push(child);
|
|
17671
|
+
}
|
|
17672
|
+
}
|
|
17456
17673
|
}
|
|
17457
17674
|
}
|
|
17458
17675
|
function toPairs(tupleOrList) {
|
|
17459
|
-
const result = [];
|
|
17460
17676
|
if (!Array.isArray(tupleOrList)) {
|
|
17461
17677
|
throw new TypeError("Expected find and replace tuple or list of tuples");
|
|
17462
17678
|
}
|
|
17679
|
+
const result = [];
|
|
17463
17680
|
const list = !tupleOrList[0] || Array.isArray(tupleOrList[0]) ? tupleOrList : [tupleOrList];
|
|
17464
17681
|
let index = -1;
|
|
17465
17682
|
while (++index < list.length) {
|
|
@@ -17754,35 +17971,39 @@ function gfmStrikethroughFromMarkdown() {
|
|
|
17754
17971
|
}
|
|
17755
17972
|
function gfmStrikethroughToMarkdown() {
|
|
17756
17973
|
return {
|
|
17974
|
+
handlers: { delete: handleDelete },
|
|
17757
17975
|
unsafe: [
|
|
17758
17976
|
{
|
|
17759
17977
|
character: "~",
|
|
17760
17978
|
inConstruct: "phrasing",
|
|
17761
17979
|
notInConstruct: constructsWithoutStrikethrough
|
|
17762
17980
|
}
|
|
17763
|
-
]
|
|
17764
|
-
handlers: { delete: handleDelete }
|
|
17981
|
+
]
|
|
17765
17982
|
};
|
|
17766
17983
|
}
|
|
17767
17984
|
function enterStrikethrough(token) {
|
|
17768
|
-
this.enter({ type: "delete", children: [] }, token);
|
|
17985
|
+
this.enter({ type: "delete", children: [], position: undefined }, token);
|
|
17769
17986
|
}
|
|
17770
17987
|
function exitStrikethrough(token) {
|
|
17771
17988
|
this.exit(token);
|
|
17772
17989
|
}
|
|
17773
17990
|
function handleDelete(node, _, state, info) {
|
|
17774
17991
|
const tracker = state.createTracker(info);
|
|
17992
|
+
const sequence = state.stack.includes("strikethrough") ? "~" : "~~";
|
|
17775
17993
|
const exit = state.enter("strikethrough");
|
|
17776
|
-
let value = tracker.move(
|
|
17994
|
+
let value = tracker.move(sequence);
|
|
17777
17995
|
value += state.containerPhrasing(node, {
|
|
17778
17996
|
...tracker.current(),
|
|
17779
17997
|
before: value,
|
|
17780
17998
|
after: "~"
|
|
17781
17999
|
});
|
|
17782
|
-
value += tracker.move(
|
|
18000
|
+
value += tracker.move(sequence);
|
|
17783
18001
|
exit();
|
|
17784
18002
|
return value;
|
|
17785
18003
|
}
|
|
18004
|
+
function attentionDelete() {
|
|
18005
|
+
return { construct: "strikethrough", markers: ["~"], sizes: [2, 1] };
|
|
18006
|
+
}
|
|
17786
18007
|
function peekDelete() {
|
|
17787
18008
|
return "~";
|
|
17788
18009
|
}
|
|
@@ -17796,6 +18017,7 @@ var init_lib13 = __esm(() => {
|
|
|
17796
18017
|
"titleQuote",
|
|
17797
18018
|
"titleApostrophe"
|
|
17798
18019
|
];
|
|
18020
|
+
handleDelete.attention = attentionDelete;
|
|
17799
18021
|
handleDelete.peek = peekDelete;
|
|
17800
18022
|
});
|
|
17801
18023
|
|
|
@@ -17939,6 +18161,35 @@ function toAlignment(value) {
|
|
|
17939
18161
|
return code === 67 || code === 99 ? 99 : code === 76 || code === 108 ? 108 : code === 82 || code === 114 ? 114 : 0;
|
|
17940
18162
|
}
|
|
17941
18163
|
|
|
18164
|
+
// ../../node_modules/mdast-util-phrasing/lib/index.js
|
|
18165
|
+
var phrasing;
|
|
18166
|
+
var init_lib14 = __esm(() => {
|
|
18167
|
+
init_unist_util_is();
|
|
18168
|
+
phrasing = convert([
|
|
18169
|
+
"break",
|
|
18170
|
+
"delete",
|
|
18171
|
+
"emphasis",
|
|
18172
|
+
"footnote",
|
|
18173
|
+
"footnoteReference",
|
|
18174
|
+
"image",
|
|
18175
|
+
"imageReference",
|
|
18176
|
+
"inlineCode",
|
|
18177
|
+
"inlineMath",
|
|
18178
|
+
"link",
|
|
18179
|
+
"linkReference",
|
|
18180
|
+
"mdxJsxTextElement",
|
|
18181
|
+
"mdxTextExpression",
|
|
18182
|
+
"strong",
|
|
18183
|
+
"text",
|
|
18184
|
+
"textDirective"
|
|
18185
|
+
]);
|
|
18186
|
+
});
|
|
18187
|
+
|
|
18188
|
+
// ../../node_modules/mdast-util-phrasing/index.js
|
|
18189
|
+
var init_mdast_util_phrasing = __esm(() => {
|
|
18190
|
+
init_lib14();
|
|
18191
|
+
});
|
|
18192
|
+
|
|
17942
18193
|
// ../../node_modules/zwitch/index.js
|
|
17943
18194
|
function zwitch(key, options) {
|
|
17944
18195
|
const settings = options || {};
|
|
@@ -18051,9 +18302,10 @@ function listInScope(stack, list, none) {
|
|
|
18051
18302
|
function hardBreak(_, _1, state, info) {
|
|
18052
18303
|
let index = -1;
|
|
18053
18304
|
while (++index < state.unsafe.length) {
|
|
18054
|
-
|
|
18055
|
-
|
|
18056
|
-
|
|
18305
|
+
const pattern = state.unsafe[index];
|
|
18306
|
+
if (pattern.character === `
|
|
18307
|
+
` && !pattern.before && !pattern.after && patternInScope(state.stack, pattern)) {
|
|
18308
|
+
return /[\t ]/.test(info.before) ? "" : " ";
|
|
18057
18309
|
}
|
|
18058
18310
|
}
|
|
18059
18311
|
return "\\\n";
|
|
@@ -18086,7 +18338,7 @@ function longestStreak(value, substring) {
|
|
|
18086
18338
|
|
|
18087
18339
|
// ../../node_modules/mdast-util-to-markdown/lib/util/format-code-as-indented.js
|
|
18088
18340
|
function formatCodeAsIndented(node, state) {
|
|
18089
|
-
return Boolean(state.options.fences === false && node.value && !node.lang && /[
|
|
18341
|
+
return Boolean(state.options.fences === false && node.value && !node.lang && /[^\n\r ]/.test(node.value) && !/^[\t ]*(?:[\n\r]|$)|(?:^|[\n\r])[\t ]*$/.test(node.value));
|
|
18090
18342
|
}
|
|
18091
18343
|
|
|
18092
18344
|
// ../../node_modules/mdast-util-to-markdown/lib/util/check-fence.js
|
|
@@ -18102,7 +18354,6 @@ function checkFence(state) {
|
|
|
18102
18354
|
function code(node, _, state, info) {
|
|
18103
18355
|
const marker = checkFence(state);
|
|
18104
18356
|
const raw = node.value || "";
|
|
18105
|
-
const suffix = marker === "`" ? "GraveAccent" : "Tilde";
|
|
18106
18357
|
if (formatCodeAsIndented(node, state)) {
|
|
18107
18358
|
const exit = state.enter("codeIndented");
|
|
18108
18359
|
const value = state.indentLines(raw, map3);
|
|
@@ -18112,6 +18363,7 @@ function code(node, _, state, info) {
|
|
|
18112
18363
|
const tracker = state.createTracker(info);
|
|
18113
18364
|
const sequence = marker.repeat(Math.max(longestStreak(raw, marker) + 1, 3));
|
|
18114
18365
|
const exit = state.enter("codeFenced");
|
|
18366
|
+
const suffix = marker === "`" ? "GraveAccent" : "Tilde";
|
|
18115
18367
|
let value = tracker.move(sequence);
|
|
18116
18368
|
if (node.lang) {
|
|
18117
18369
|
const subexit = state.enter(`codeFencedLang${suffix}`);
|
|
@@ -18214,64 +18466,34 @@ function checkEmphasis(state) {
|
|
|
18214
18466
|
return marker;
|
|
18215
18467
|
}
|
|
18216
18468
|
|
|
18217
|
-
// ../../node_modules/mdast-util-to-markdown/lib/util/encode-character-reference.js
|
|
18218
|
-
function encodeCharacterReference(code) {
|
|
18219
|
-
return "&#x" + code.toString(16).toUpperCase() + ";";
|
|
18220
|
-
}
|
|
18221
|
-
|
|
18222
|
-
// ../../node_modules/mdast-util-to-markdown/lib/util/encode-info.js
|
|
18223
|
-
function encodeInfo(outside, inside, marker) {
|
|
18224
|
-
const outsideKind = classifyCharacter(outside);
|
|
18225
|
-
const insideKind = classifyCharacter(inside);
|
|
18226
|
-
if (outsideKind === undefined) {
|
|
18227
|
-
return insideKind === undefined ? marker === "_" ? { inside: true, outside: true } : { inside: false, outside: false } : insideKind === 1 ? { inside: true, outside: true } : { inside: false, outside: true };
|
|
18228
|
-
}
|
|
18229
|
-
if (outsideKind === 1) {
|
|
18230
|
-
return insideKind === undefined ? { inside: false, outside: false } : insideKind === 1 ? { inside: true, outside: true } : { inside: false, outside: false };
|
|
18231
|
-
}
|
|
18232
|
-
return insideKind === undefined ? { inside: false, outside: false } : insideKind === 1 ? { inside: true, outside: false } : { inside: false, outside: false };
|
|
18233
|
-
}
|
|
18234
|
-
var init_encode_info = __esm(() => {
|
|
18235
|
-
init_dev6();
|
|
18236
|
-
});
|
|
18237
|
-
|
|
18238
18469
|
// ../../node_modules/mdast-util-to-markdown/lib/handle/emphasis.js
|
|
18239
18470
|
function emphasis(node, _, state, info) {
|
|
18240
|
-
const
|
|
18241
|
-
const
|
|
18242
|
-
const tracker = state.createTracker(info);
|
|
18243
|
-
const before = tracker.move(marker);
|
|
18244
|
-
let between = tracker.move(state.containerPhrasing(node, {
|
|
18245
|
-
after: marker,
|
|
18246
|
-
before,
|
|
18247
|
-
...tracker.current()
|
|
18248
|
-
}));
|
|
18249
|
-
const betweenHead = between.charCodeAt(0);
|
|
18250
|
-
const open = encodeInfo(info.before.charCodeAt(info.before.length - 1), betweenHead, marker);
|
|
18251
|
-
if (open.inside) {
|
|
18252
|
-
between = encodeCharacterReference(betweenHead) + between.slice(1);
|
|
18253
|
-
}
|
|
18254
|
-
const betweenTail = between.charCodeAt(between.length - 1);
|
|
18255
|
-
const close = encodeInfo(info.after.charCodeAt(0), betweenTail, marker);
|
|
18256
|
-
if (close.inside) {
|
|
18257
|
-
between = between.slice(0, -1) + encodeCharacterReference(betweenTail);
|
|
18258
|
-
}
|
|
18259
|
-
const after = tracker.move(marker);
|
|
18471
|
+
const exit = state.enter("phrasing");
|
|
18472
|
+
const value = state.containerPhrasing({ type: "root", children: [node] }, info);
|
|
18260
18473
|
exit();
|
|
18261
|
-
|
|
18262
|
-
|
|
18263
|
-
|
|
18474
|
+
return value;
|
|
18475
|
+
}
|
|
18476
|
+
function attention2(_, state) {
|
|
18477
|
+
const marker = checkEmphasis(state);
|
|
18478
|
+
return {
|
|
18479
|
+
construct: "emphasis",
|
|
18480
|
+
markers: marker === "*" ? ["*", "_"] : ["_", "*"],
|
|
18481
|
+
sizes: [1]
|
|
18264
18482
|
};
|
|
18265
|
-
return before + between + after;
|
|
18266
18483
|
}
|
|
18267
|
-
function
|
|
18484
|
+
function peek(_, _1, state) {
|
|
18268
18485
|
return state.options.emphasis || "*";
|
|
18269
18486
|
}
|
|
18270
18487
|
var init_emphasis = __esm(() => {
|
|
18271
|
-
|
|
18272
|
-
emphasis.peek =
|
|
18488
|
+
emphasis.attention = attention2;
|
|
18489
|
+
emphasis.peek = peek;
|
|
18273
18490
|
});
|
|
18274
18491
|
|
|
18492
|
+
// ../../node_modules/mdast-util-to-markdown/lib/util/encode-character-reference.js
|
|
18493
|
+
function encodeCharacterReference(code) {
|
|
18494
|
+
return "&#x" + code.toString(16).toUpperCase() + ";";
|
|
18495
|
+
}
|
|
18496
|
+
|
|
18275
18497
|
// ../../node_modules/unist-util-visit/node_modules/unist-util-visit-parents/lib/color.node.js
|
|
18276
18498
|
function color2(d) {
|
|
18277
18499
|
return "\x1B[33m" + d + "\x1B[39m";
|
|
@@ -18338,14 +18560,14 @@ function toResult2(value) {
|
|
|
18338
18560
|
return value === null || value === undefined ? empty2 : [value];
|
|
18339
18561
|
}
|
|
18340
18562
|
var empty2, CONTINUE2 = true, EXIT2 = false, SKIP2 = "skip";
|
|
18341
|
-
var
|
|
18563
|
+
var init_lib15 = __esm(() => {
|
|
18342
18564
|
init_unist_util_is();
|
|
18343
18565
|
empty2 = [];
|
|
18344
18566
|
});
|
|
18345
18567
|
|
|
18346
18568
|
// ../../node_modules/unist-util-visit/node_modules/unist-util-visit-parents/index.js
|
|
18347
18569
|
var init_unist_util_visit_parents2 = __esm(() => {
|
|
18348
|
-
|
|
18570
|
+
init_lib15();
|
|
18349
18571
|
});
|
|
18350
18572
|
|
|
18351
18573
|
// ../../node_modules/unist-util-visit/lib/index.js
|
|
@@ -18369,14 +18591,14 @@ function visit(tree, testOrVisitor, visitorOrReverse, maybeReverse) {
|
|
|
18369
18591
|
return visitor(node, index, parent);
|
|
18370
18592
|
}
|
|
18371
18593
|
}
|
|
18372
|
-
var
|
|
18594
|
+
var init_lib16 = __esm(() => {
|
|
18373
18595
|
init_unist_util_visit_parents2();
|
|
18374
18596
|
init_unist_util_visit_parents2();
|
|
18375
18597
|
});
|
|
18376
18598
|
|
|
18377
18599
|
// ../../node_modules/unist-util-visit/index.js
|
|
18378
18600
|
var init_unist_util_visit = __esm(() => {
|
|
18379
|
-
|
|
18601
|
+
init_lib16();
|
|
18380
18602
|
});
|
|
18381
18603
|
|
|
18382
18604
|
// ../../node_modules/mdast-util-to-markdown/lib/util/format-heading-as-setext.js
|
|
@@ -18425,8 +18647,9 @@ function heading(node, _, state, info) {
|
|
|
18425
18647
|
`,
|
|
18426
18648
|
...tracker.current()
|
|
18427
18649
|
});
|
|
18428
|
-
|
|
18429
|
-
|
|
18650
|
+
const head = value.charCodeAt(0);
|
|
18651
|
+
if (head === 9 || head === 32) {
|
|
18652
|
+
value = encodeCharacterReference(head) + value.slice(1);
|
|
18430
18653
|
}
|
|
18431
18654
|
value = value ? sequence + " " + value : sequence;
|
|
18432
18655
|
if (state.options.closeAtx) {
|
|
@@ -18513,7 +18736,9 @@ function imageReference(node, _, state, info) {
|
|
|
18513
18736
|
value += tracker.move(alt + "][");
|
|
18514
18737
|
subexit();
|
|
18515
18738
|
const stack = state.stack;
|
|
18516
|
-
state.stack =
|
|
18739
|
+
state.stack = stack.filter(function(d) {
|
|
18740
|
+
return d !== "phrasing";
|
|
18741
|
+
});
|
|
18517
18742
|
subexit = state.enter("reference");
|
|
18518
18743
|
const reference = state.safe(state.associationId(node), {
|
|
18519
18744
|
before: value,
|
|
@@ -18547,15 +18772,15 @@ function inlineCode(node, _, state) {
|
|
|
18547
18772
|
while (new RegExp("(^|[^`])" + sequence + "([^`]|$)").test(value)) {
|
|
18548
18773
|
sequence += "`";
|
|
18549
18774
|
}
|
|
18550
|
-
if (/[
|
|
18775
|
+
if (/[^\n\r ]/.test(value) && (/^[\n\r ]/.test(value) && /[\n\r ]$/.test(value) || /^`|`$/.test(value))) {
|
|
18551
18776
|
value = " " + value + " ";
|
|
18552
18777
|
}
|
|
18553
18778
|
while (++index < state.unsafe.length) {
|
|
18554
18779
|
const pattern = state.unsafe[index];
|
|
18555
18780
|
const expression = state.compilePattern(pattern);
|
|
18556
|
-
let match;
|
|
18557
18781
|
if (!pattern.atBreak)
|
|
18558
18782
|
continue;
|
|
18783
|
+
let match;
|
|
18559
18784
|
while (match = expression.exec(value)) {
|
|
18560
18785
|
let position = match.index;
|
|
18561
18786
|
if (value.charCodeAt(position) === 10 && value.charCodeAt(position - 1) === 13) {
|
|
@@ -18576,7 +18801,7 @@ var init_inline_code = __esm(() => {
|
|
|
18576
18801
|
// ../../node_modules/mdast-util-to-markdown/lib/util/format-link-as-autolink.js
|
|
18577
18802
|
function formatLinkAsAutolink(node, state) {
|
|
18578
18803
|
const raw = toString(node);
|
|
18579
|
-
return Boolean(!state.options.resourceLink && node.url && !node.title && node.children && node.children.length === 1 && node.children[0].type === "text" && (raw === node.url || "mailto:" + raw === node.url) && /^[a-z][a-z
|
|
18804
|
+
return Boolean(!state.options.resourceLink && node.url && !node.title && node.children && node.children.length === 1 && node.children[0].type === "text" && (raw === node.url || "mailto:" + raw === node.url) && /^[a-z][+\-.a-z]+:/i.test(node.url) && !/[\0- <>\u007F]/.test(node.url));
|
|
18580
18805
|
}
|
|
18581
18806
|
var init_format_link_as_autolink = __esm(() => {
|
|
18582
18807
|
init_mdast_util_to_string();
|
|
@@ -18587,12 +18812,12 @@ function link(node, _, state, info) {
|
|
|
18587
18812
|
const quote = checkQuote(state);
|
|
18588
18813
|
const suffix = quote === '"' ? "Quote" : "Apostrophe";
|
|
18589
18814
|
const tracker = state.createTracker(info);
|
|
18590
|
-
let exit;
|
|
18591
|
-
let subexit;
|
|
18592
18815
|
if (formatLinkAsAutolink(node, state)) {
|
|
18593
18816
|
const stack = state.stack;
|
|
18594
|
-
state.stack =
|
|
18595
|
-
|
|
18817
|
+
state.stack = stack.filter(function(d) {
|
|
18818
|
+
return d !== "phrasing";
|
|
18819
|
+
});
|
|
18820
|
+
const exit = state.enter("autolink");
|
|
18596
18821
|
let value = tracker.move("<");
|
|
18597
18822
|
value += tracker.move(state.containerPhrasing(node, {
|
|
18598
18823
|
before: value,
|
|
@@ -18604,8 +18829,8 @@ function link(node, _, state, info) {
|
|
|
18604
18829
|
state.stack = stack;
|
|
18605
18830
|
return value;
|
|
18606
18831
|
}
|
|
18607
|
-
exit = state.enter("link");
|
|
18608
|
-
subexit = state.enter("label");
|
|
18832
|
+
const exit = state.enter("link");
|
|
18833
|
+
let subexit = state.enter("label");
|
|
18609
18834
|
let value = tracker.move("[");
|
|
18610
18835
|
value += tracker.move(state.containerPhrasing(node, {
|
|
18611
18836
|
before: value,
|
|
@@ -18666,7 +18891,9 @@ function linkReference(node, _, state, info) {
|
|
|
18666
18891
|
value += tracker.move(text + "][");
|
|
18667
18892
|
subexit();
|
|
18668
18893
|
const stack = state.stack;
|
|
18669
|
-
state.stack =
|
|
18894
|
+
state.stack = stack.filter(function(d) {
|
|
18895
|
+
return d !== "phrasing";
|
|
18896
|
+
});
|
|
18670
18897
|
subexit = state.enter("reference");
|
|
18671
18898
|
const reference = state.safe(state.associationId(node), {
|
|
18672
18899
|
before: value,
|
|
@@ -18819,42 +19046,17 @@ function paragraph(node, _, state, info) {
|
|
|
18819
19046
|
return value;
|
|
18820
19047
|
}
|
|
18821
19048
|
|
|
18822
|
-
// ../../node_modules/mdast-util-phrasing/lib/index.js
|
|
18823
|
-
var phrasing;
|
|
18824
|
-
var init_lib16 = __esm(() => {
|
|
18825
|
-
init_unist_util_is();
|
|
18826
|
-
phrasing = convert([
|
|
18827
|
-
"break",
|
|
18828
|
-
"delete",
|
|
18829
|
-
"emphasis",
|
|
18830
|
-
"footnote",
|
|
18831
|
-
"footnoteReference",
|
|
18832
|
-
"image",
|
|
18833
|
-
"imageReference",
|
|
18834
|
-
"inlineCode",
|
|
18835
|
-
"inlineMath",
|
|
18836
|
-
"link",
|
|
18837
|
-
"linkReference",
|
|
18838
|
-
"mdxJsxTextElement",
|
|
18839
|
-
"mdxTextExpression",
|
|
18840
|
-
"strong",
|
|
18841
|
-
"text",
|
|
18842
|
-
"textDirective"
|
|
18843
|
-
]);
|
|
18844
|
-
});
|
|
18845
|
-
|
|
18846
|
-
// ../../node_modules/mdast-util-phrasing/index.js
|
|
18847
|
-
var init_mdast_util_phrasing = __esm(() => {
|
|
18848
|
-
init_lib16();
|
|
18849
|
-
});
|
|
18850
|
-
|
|
18851
19049
|
// ../../node_modules/mdast-util-to-markdown/lib/handle/root.js
|
|
18852
19050
|
function root(node, _, state, info) {
|
|
18853
19051
|
const hasPhrasing = node.children.some(function(d) {
|
|
18854
19052
|
return phrasing(d);
|
|
18855
19053
|
});
|
|
18856
|
-
|
|
18857
|
-
|
|
19054
|
+
if (!hasPhrasing)
|
|
19055
|
+
return state.containerFlow(node, info);
|
|
19056
|
+
const exit = state.enter("phrasing");
|
|
19057
|
+
const value = state.containerPhrasing(node, info);
|
|
19058
|
+
exit();
|
|
19059
|
+
return value;
|
|
18858
19060
|
}
|
|
18859
19061
|
var init_root = __esm(() => {
|
|
18860
19062
|
init_mdast_util_phrasing();
|
|
@@ -18871,44 +19073,36 @@ function checkStrong(state) {
|
|
|
18871
19073
|
|
|
18872
19074
|
// ../../node_modules/mdast-util-to-markdown/lib/handle/strong.js
|
|
18873
19075
|
function strong(node, _, state, info) {
|
|
18874
|
-
const
|
|
18875
|
-
const
|
|
18876
|
-
const tracker = state.createTracker(info);
|
|
18877
|
-
const before = tracker.move(marker + marker);
|
|
18878
|
-
let between = tracker.move(state.containerPhrasing(node, {
|
|
18879
|
-
after: marker,
|
|
18880
|
-
before,
|
|
18881
|
-
...tracker.current()
|
|
18882
|
-
}));
|
|
18883
|
-
const betweenHead = between.charCodeAt(0);
|
|
18884
|
-
const open = encodeInfo(info.before.charCodeAt(info.before.length - 1), betweenHead, marker);
|
|
18885
|
-
if (open.inside) {
|
|
18886
|
-
between = encodeCharacterReference(betweenHead) + between.slice(1);
|
|
18887
|
-
}
|
|
18888
|
-
const betweenTail = between.charCodeAt(between.length - 1);
|
|
18889
|
-
const close = encodeInfo(info.after.charCodeAt(0), betweenTail, marker);
|
|
18890
|
-
if (close.inside) {
|
|
18891
|
-
between = between.slice(0, -1) + encodeCharacterReference(betweenTail);
|
|
18892
|
-
}
|
|
18893
|
-
const after = tracker.move(marker + marker);
|
|
19076
|
+
const exit = state.enter("phrasing");
|
|
19077
|
+
const value = state.containerPhrasing({ type: "root", children: [node] }, info);
|
|
18894
19078
|
exit();
|
|
18895
|
-
|
|
18896
|
-
|
|
18897
|
-
|
|
19079
|
+
return value;
|
|
19080
|
+
}
|
|
19081
|
+
function attention3(_, state) {
|
|
19082
|
+
const marker = checkStrong(state);
|
|
19083
|
+
return {
|
|
19084
|
+
construct: "strong",
|
|
19085
|
+
markers: marker === "*" ? ["*", "_"] : ["_", "*"],
|
|
19086
|
+
sizes: [2]
|
|
18898
19087
|
};
|
|
18899
|
-
return before + between + after;
|
|
18900
19088
|
}
|
|
18901
|
-
function
|
|
19089
|
+
function peek2(_, _1, state) {
|
|
18902
19090
|
return state.options.strong || "*";
|
|
18903
19091
|
}
|
|
18904
19092
|
var init_strong = __esm(() => {
|
|
18905
|
-
|
|
18906
|
-
strong.peek =
|
|
19093
|
+
strong.attention = attention3;
|
|
19094
|
+
strong.peek = peek2;
|
|
18907
19095
|
});
|
|
18908
19096
|
|
|
18909
19097
|
// ../../node_modules/mdast-util-to-markdown/lib/handle/text.js
|
|
18910
|
-
function text3(node,
|
|
18911
|
-
|
|
19098
|
+
function text3(node, parent, state, info) {
|
|
19099
|
+
const siblings = parent ? parent.children : [];
|
|
19100
|
+
const index = siblings.indexOf(node);
|
|
19101
|
+
return state.safe(node.value, {
|
|
19102
|
+
...info,
|
|
19103
|
+
afterNode: siblings[index + 1],
|
|
19104
|
+
beforeNode: siblings[index - 1]
|
|
19105
|
+
});
|
|
18912
19106
|
}
|
|
18913
19107
|
|
|
18914
19108
|
// ../../node_modules/mdast-util-to-markdown/lib/util/check-rule-repetition.js
|
|
@@ -18970,6 +19164,43 @@ var init_handle = __esm(() => {
|
|
|
18970
19164
|
};
|
|
18971
19165
|
});
|
|
18972
19166
|
|
|
19167
|
+
// ../../node_modules/mdast-util-to-markdown/lib/util/html-kind.js
|
|
19168
|
+
function htmlKind(value) {
|
|
19169
|
+
if (value.charCodeAt(0) !== 60)
|
|
19170
|
+
return;
|
|
19171
|
+
const next = value.charCodeAt(1);
|
|
19172
|
+
if (next === 33) {
|
|
19173
|
+
const code = value.charCodeAt(2);
|
|
19174
|
+
if (code === 45)
|
|
19175
|
+
return 2;
|
|
19176
|
+
if (code === 91)
|
|
19177
|
+
return 5;
|
|
19178
|
+
if (asciiAlpha(code))
|
|
19179
|
+
return 4;
|
|
19180
|
+
return;
|
|
19181
|
+
}
|
|
19182
|
+
if (next === 63)
|
|
19183
|
+
return 3;
|
|
19184
|
+
const closing = next === 47;
|
|
19185
|
+
const start = closing ? 2 : 1;
|
|
19186
|
+
let end = start;
|
|
19187
|
+
let code = value.charCodeAt(end);
|
|
19188
|
+
if (!asciiAlpha(code))
|
|
19189
|
+
return;
|
|
19190
|
+
while (code === 45 || asciiAlphanumeric(code)) {
|
|
19191
|
+
code = value.charCodeAt(++end);
|
|
19192
|
+
}
|
|
19193
|
+
const name = value.slice(start, end).toLowerCase();
|
|
19194
|
+
if (!closing && code !== 47 && htmlRawNames.includes(name)) {
|
|
19195
|
+
return 1;
|
|
19196
|
+
}
|
|
19197
|
+
return htmlBlockNames.includes(name) ? 6 : 7;
|
|
19198
|
+
}
|
|
19199
|
+
var init_html_kind = __esm(() => {
|
|
19200
|
+
init_dev4();
|
|
19201
|
+
init_micromark_util_html_tag_name();
|
|
19202
|
+
});
|
|
19203
|
+
|
|
18973
19204
|
// ../../node_modules/mdast-util-to-markdown/lib/join.js
|
|
18974
19205
|
function joinDefaults(left, right, parent, state) {
|
|
18975
19206
|
if (right.type === "code" && formatCodeAsIndented(right, state) && (left.type === "list" || left.type === right.type && formatCodeAsIndented(left, state))) {
|
|
@@ -18979,17 +19210,28 @@ function joinDefaults(left, right, parent, state) {
|
|
|
18979
19210
|
if (left.type === "paragraph" && (left.type === right.type || right.type === "definition" || right.type === "heading" && formatHeadingAsSetext(right, state))) {
|
|
18980
19211
|
return;
|
|
18981
19212
|
}
|
|
19213
|
+
if (left.type === "html") {
|
|
19214
|
+
const kind = htmlKind(left.value);
|
|
19215
|
+
if (kind === undefined || kind === 6 || kind === 7)
|
|
19216
|
+
return 1;
|
|
19217
|
+
}
|
|
19218
|
+
if (left.type === "paragraph" && right.type === "html") {
|
|
19219
|
+
const kind = htmlKind(right.value);
|
|
19220
|
+
if (kind === undefined || kind === 7)
|
|
19221
|
+
return 1;
|
|
19222
|
+
}
|
|
18982
19223
|
return parent.spread ? 1 : 0;
|
|
18983
19224
|
}
|
|
18984
19225
|
}
|
|
18985
19226
|
var join;
|
|
18986
19227
|
var init_join = __esm(() => {
|
|
18987
19228
|
init_format_heading_as_setext();
|
|
19229
|
+
init_html_kind();
|
|
18988
19230
|
join = [joinDefaults];
|
|
18989
19231
|
});
|
|
18990
19232
|
|
|
18991
19233
|
// ../../node_modules/mdast-util-to-markdown/lib/unsafe.js
|
|
18992
|
-
var fullPhrasingSpans, unsafe;
|
|
19234
|
+
var fullPhrasingSpans, unsafe, code2 = -1;
|
|
18993
19235
|
var init_unsafe = __esm(() => {
|
|
18994
19236
|
fullPhrasingSpans = [
|
|
18995
19237
|
"autolink",
|
|
@@ -19029,6 +19271,12 @@ var init_unsafe = __esm(() => {
|
|
|
19029
19271
|
"headingAtx"
|
|
19030
19272
|
]
|
|
19031
19273
|
},
|
|
19274
|
+
{ character: "\r", before: "[\\r\\n]", inConstruct: "phrasing" },
|
|
19275
|
+
{ character: "\r", after: "\\r", inConstruct: "phrasing" },
|
|
19276
|
+
{ character: `
|
|
19277
|
+
`, before: "\\n", inConstruct: "phrasing" },
|
|
19278
|
+
{ character: `
|
|
19279
|
+
`, after: "[\\r\\n]", inConstruct: "phrasing" },
|
|
19032
19280
|
{ character: " ", after: "[\\r\\n]", inConstruct: "phrasing" },
|
|
19033
19281
|
{ character: " ", before: "[\\r\\n]", inConstruct: "phrasing" },
|
|
19034
19282
|
{
|
|
@@ -19089,8 +19337,14 @@ var init_unsafe = __esm(() => {
|
|
|
19089
19337
|
inConstruct: ["codeFencedLangGraveAccent", "codeFencedMetaGraveAccent"]
|
|
19090
19338
|
},
|
|
19091
19339
|
{ character: "`", inConstruct: "phrasing", notInConstruct: fullPhrasingSpans },
|
|
19092
|
-
{ atBreak: true, character: "~" }
|
|
19340
|
+
{ atBreak: true, character: "~" },
|
|
19341
|
+
{ character: "<", inConstruct: "autolink" },
|
|
19342
|
+
{ character: ">", inConstruct: "autolink" },
|
|
19343
|
+
{ character: "", inConstruct: "autolink" }
|
|
19093
19344
|
];
|
|
19345
|
+
while (++code2 < 33) {
|
|
19346
|
+
unsafe.push({ character: String.fromCharCode(code2), inConstruct: "autolink" });
|
|
19347
|
+
}
|
|
19094
19348
|
});
|
|
19095
19349
|
|
|
19096
19350
|
// ../../node_modules/mdast-util-to-markdown/lib/util/association.js
|
|
@@ -19108,19 +19362,201 @@ var init_association = __esm(() => {
|
|
|
19108
19362
|
function compilePattern(pattern) {
|
|
19109
19363
|
if (!pattern._compiled) {
|
|
19110
19364
|
const before = (pattern.atBreak ? "[\\r\\n][\\t ]*" : "") + (pattern.before ? "(?:" + pattern.before + ")" : "");
|
|
19111
|
-
pattern._compiled = new RegExp((before ? "(" + before + ")" : "") + (/[
|
|
19365
|
+
pattern._compiled = new RegExp((pattern.beforeNode ? "^" : before ? "(" + before + ")" : "") + (/[$()*+.?[\\\]^{|}]/.test(pattern.character) ? "\\" : "") + pattern.character + (pattern.afterNode ? "$" : pattern.after ? "(?:" + pattern.after + ")" : ""), pattern.unicode ? "gu" : "g");
|
|
19112
19366
|
}
|
|
19113
19367
|
return pattern._compiled;
|
|
19114
19368
|
}
|
|
19115
19369
|
|
|
19370
|
+
// ../../node_modules/mdast-util-to-markdown/lib/util/character.js
|
|
19371
|
+
function firstCharacter(value) {
|
|
19372
|
+
const code = value.codePointAt(0);
|
|
19373
|
+
return code === undefined ? "" : String.fromCodePoint(code);
|
|
19374
|
+
}
|
|
19375
|
+
function lastCharacter(value) {
|
|
19376
|
+
const code = value.codePointAt(value.length - 2);
|
|
19377
|
+
return code !== undefined && code > 65535 ? value.slice(-2) : value.slice(-1);
|
|
19378
|
+
}
|
|
19379
|
+
|
|
19380
|
+
// ../../node_modules/mdast-util-to-markdown/lib/util/encode-info.js
|
|
19381
|
+
function encodeInfo(outside, inside, marker) {
|
|
19382
|
+
const outsideKind = classifyCharacter(outside);
|
|
19383
|
+
const insideKind = classifyCharacter(inside);
|
|
19384
|
+
if (outsideKind === undefined) {
|
|
19385
|
+
return insideKind === undefined ? marker === "_" ? { inside: true, outside: true } : { inside: false, outside: false } : insideKind === 1 ? { inside: true, outside: true } : { inside: false, outside: true };
|
|
19386
|
+
}
|
|
19387
|
+
if (outsideKind === 1) {
|
|
19388
|
+
return insideKind === undefined ? { inside: false, outside: false } : insideKind === 1 ? { inside: true, outside: true } : { inside: false, outside: false };
|
|
19389
|
+
}
|
|
19390
|
+
return insideKind === undefined ? { inside: false, outside: false } : insideKind === 1 ? { inside: true, outside: false } : { inside: false, outside: false };
|
|
19391
|
+
}
|
|
19392
|
+
var init_encode_info = __esm(() => {
|
|
19393
|
+
init_dev6();
|
|
19394
|
+
});
|
|
19395
|
+
|
|
19116
19396
|
// ../../node_modules/mdast-util-to-markdown/lib/util/container-phrasing.js
|
|
19397
|
+
function candidates(tokens, involved, runOf) {
|
|
19398
|
+
const related = new Set;
|
|
19399
|
+
for (const token of tokens) {
|
|
19400
|
+
const siblings = runOf.get(token);
|
|
19401
|
+
if (siblings && token.attention && involved.some((d) => d.attention === token.attention)) {
|
|
19402
|
+
for (const sibling of siblings.tokens) {
|
|
19403
|
+
related.add(sibling.attention);
|
|
19404
|
+
}
|
|
19405
|
+
}
|
|
19406
|
+
}
|
|
19407
|
+
const ordered = [];
|
|
19408
|
+
for (const token of tokens) {
|
|
19409
|
+
if (token.attention && related.delete(token.attention)) {
|
|
19410
|
+
ordered.push(token.attention);
|
|
19411
|
+
}
|
|
19412
|
+
}
|
|
19413
|
+
ordered.reverse();
|
|
19414
|
+
return ordered;
|
|
19415
|
+
}
|
|
19416
|
+
function check(tokens, before, after) {
|
|
19417
|
+
const runs = [];
|
|
19418
|
+
const wrong = new Map;
|
|
19419
|
+
const runOf = new Map;
|
|
19420
|
+
let index = 0;
|
|
19421
|
+
while (index < tokens.length) {
|
|
19422
|
+
if (!tokens[index].attention) {
|
|
19423
|
+
index++;
|
|
19424
|
+
continue;
|
|
19425
|
+
}
|
|
19426
|
+
const marker = tokens[index].value.charAt(0);
|
|
19427
|
+
const strict = builtins.get(marker);
|
|
19428
|
+
let end = index + 1;
|
|
19429
|
+
while (end < tokens.length && tokens[end].attention && tokens[end].value.charAt(0) === marker) {
|
|
19430
|
+
end++;
|
|
19431
|
+
}
|
|
19432
|
+
const head = index ? tokens[index - 1].value : before;
|
|
19433
|
+
const previous = classifyCharacter(head.charCodeAt(head.length - 1));
|
|
19434
|
+
const next = classifyCharacter((end < tokens.length ? tokens[end].value : after).charCodeAt(0));
|
|
19435
|
+
const open = !next || next === 2 && Boolean(previous);
|
|
19436
|
+
const close = !previous || previous === 2 && Boolean(next);
|
|
19437
|
+
const run = {
|
|
19438
|
+
tokens: tokens.slice(index, end),
|
|
19439
|
+
markers: [],
|
|
19440
|
+
start: 0,
|
|
19441
|
+
end: 0,
|
|
19442
|
+
open: strict ? open && (Boolean(previous) || !close) : open,
|
|
19443
|
+
close: strict ? close && (Boolean(next) || !open) : close,
|
|
19444
|
+
split: strict !== undefined
|
|
19445
|
+
};
|
|
19446
|
+
for (const token of run.tokens) {
|
|
19447
|
+
wrong.set(token, [...run.tokens]);
|
|
19448
|
+
runOf.set(token, run);
|
|
19449
|
+
let size = token.value.length;
|
|
19450
|
+
while (size--)
|
|
19451
|
+
run.markers.push(token);
|
|
19452
|
+
}
|
|
19453
|
+
run.end = run.markers.length;
|
|
19454
|
+
runs.push(run);
|
|
19455
|
+
index = end;
|
|
19456
|
+
}
|
|
19457
|
+
pair(runs, wrong);
|
|
19458
|
+
index = -1;
|
|
19459
|
+
while (++index < tokens.length) {
|
|
19460
|
+
const involved = wrong.get(tokens[index]);
|
|
19461
|
+
if (involved)
|
|
19462
|
+
return { attention: candidates(tokens, involved, runOf), index };
|
|
19463
|
+
}
|
|
19464
|
+
}
|
|
19117
19465
|
function containerPhrasing(parent, state, info) {
|
|
19466
|
+
return serialize2(phrasing2(parent, state, info), info.before, info.after);
|
|
19467
|
+
}
|
|
19468
|
+
function encode(tokens, start) {
|
|
19469
|
+
const token = tokens[start ? 0 : tokens.length - 1];
|
|
19470
|
+
if (!token || token.attention)
|
|
19471
|
+
return;
|
|
19472
|
+
const character = start ? firstCharacter(token.value) : lastCharacter(token.value);
|
|
19473
|
+
const reference = encodeCharacterReference(character.codePointAt(0));
|
|
19474
|
+
token.value = start ? reference + token.value.slice(character.length) : token.value.slice(0, token.value.length - character.length) + reference;
|
|
19475
|
+
}
|
|
19476
|
+
function improve(items, chosen, mistake, before, after) {
|
|
19477
|
+
for (const attention of mistake.attention) {
|
|
19478
|
+
const current = chosen.get(attention) || attention.sequences[0];
|
|
19479
|
+
for (const sequence of attention.sequences) {
|
|
19480
|
+
if (sequence === current)
|
|
19481
|
+
continue;
|
|
19482
|
+
const trial = new Map(chosen);
|
|
19483
|
+
trial.set(attention, sequence);
|
|
19484
|
+
const tokens = render(items, trial, before, after);
|
|
19485
|
+
const next = check(tokens, before, after);
|
|
19486
|
+
if (!next || next.index > mistake.index) {
|
|
19487
|
+
return { chosen: trial, mistake: next, tokens };
|
|
19488
|
+
}
|
|
19489
|
+
}
|
|
19490
|
+
}
|
|
19491
|
+
}
|
|
19492
|
+
function pair(runs, wrong) {
|
|
19493
|
+
let index = 0;
|
|
19494
|
+
while (index < runs.length) {
|
|
19495
|
+
const closer = runs[index];
|
|
19496
|
+
const marker = closer.tokens[0].value.charAt(0);
|
|
19497
|
+
const closerSize = closer.end - closer.start;
|
|
19498
|
+
let open = closer.close && closerSize ? index : 0;
|
|
19499
|
+
while (open--) {
|
|
19500
|
+
const opener = runs[open];
|
|
19501
|
+
const openerSize = opener.end - opener.start;
|
|
19502
|
+
if (opener.tokens[0].value.charAt(0) === marker && opener.open && openerSize && (closer.split ? !((opener.close || closer.open) && closerSize % 3) || (openerSize + closerSize) % 3 : openerSize === opener.markers.length && openerSize === closerSize)) {
|
|
19503
|
+
const size = closer.split ? openerSize > 1 && closerSize > 1 ? 2 : 1 : closerSize;
|
|
19504
|
+
const opening = opener.markers.slice(opener.end - size, opener.end);
|
|
19505
|
+
const closing = closer.markers.slice(closer.start, closer.start + size);
|
|
19506
|
+
const openToken = opening[0];
|
|
19507
|
+
const closeToken = closing[0];
|
|
19508
|
+
if (openToken === opening[size - 1] && openToken.value.length === size && closeToken === closing[size - 1] && closeToken.value.length === size && openToken.attention === closeToken.attention) {
|
|
19509
|
+
wrong.delete(openToken);
|
|
19510
|
+
wrong.delete(closeToken);
|
|
19511
|
+
} else {
|
|
19512
|
+
const involved = [...new Set([...opening, ...closing])];
|
|
19513
|
+
for (const token of involved) {
|
|
19514
|
+
const list = wrong.get(token);
|
|
19515
|
+
if (list)
|
|
19516
|
+
list.push(...involved);
|
|
19517
|
+
}
|
|
19518
|
+
}
|
|
19519
|
+
opener.end -= size;
|
|
19520
|
+
closer.start += size;
|
|
19521
|
+
break;
|
|
19522
|
+
}
|
|
19523
|
+
}
|
|
19524
|
+
if (open === -1 || closer.start === closer.end)
|
|
19525
|
+
index++;
|
|
19526
|
+
}
|
|
19527
|
+
}
|
|
19528
|
+
function attentionSequences(type, markers, sizes) {
|
|
19529
|
+
if (markers.length === 0) {
|
|
19530
|
+
throw new Error("Cannot serialize `" + type + "` as attention without markers, expected one or more markers");
|
|
19531
|
+
}
|
|
19532
|
+
if (sizes.length === 0) {
|
|
19533
|
+
throw new Error("Cannot serialize `" + type + "` as attention without sizes, expected one or more sizes");
|
|
19534
|
+
}
|
|
19535
|
+
for (const size of sizes) {
|
|
19536
|
+
if (!Number.isSafeInteger(size) || size < 1) {
|
|
19537
|
+
throw new Error("Cannot serialize `" + type + "` as attention with `" + size + "` as size, expected positive integer");
|
|
19538
|
+
}
|
|
19539
|
+
}
|
|
19540
|
+
const sequences = [];
|
|
19541
|
+
for (const marker of markers) {
|
|
19542
|
+
if (marker.length !== 1) {
|
|
19543
|
+
throw new Error("Cannot serialize `" + type + "` as attention with `" + marker + "` as marker, expected a single ascii character");
|
|
19544
|
+
}
|
|
19545
|
+
if (!asciiPunctuation(marker.charCodeAt(0))) {
|
|
19546
|
+
throw new Error("Cannot serialize `" + type + "` as attention with `" + marker + "` as marker, expected ascii punctuation");
|
|
19547
|
+
}
|
|
19548
|
+
for (const size of sizes) {
|
|
19549
|
+
sequences.push(marker.repeat(size));
|
|
19550
|
+
}
|
|
19551
|
+
}
|
|
19552
|
+
return sequences;
|
|
19553
|
+
}
|
|
19554
|
+
function phrasing2(parent, state, info) {
|
|
19118
19555
|
const indexStack = state.indexStack;
|
|
19119
19556
|
const children = parent.children || [];
|
|
19120
19557
|
const results = [];
|
|
19121
19558
|
let index = -1;
|
|
19122
19559
|
let before = info.before;
|
|
19123
|
-
let encodeAfter;
|
|
19124
19560
|
indexStack.push(-1);
|
|
19125
19561
|
let tracker = state.createTracker(info);
|
|
19126
19562
|
while (++index < children.length) {
|
|
@@ -19131,47 +19567,132 @@ function containerPhrasing(parent, state, info) {
|
|
|
19131
19567
|
let handle = state.handle.handlers[children[index + 1].type];
|
|
19132
19568
|
if (handle && handle.peek)
|
|
19133
19569
|
handle = handle.peek;
|
|
19134
|
-
after = handle ? handle(children[index + 1], parent, state, {
|
|
19570
|
+
after = handle ? firstCharacter(handle(children[index + 1], parent, state, {
|
|
19135
19571
|
before: "",
|
|
19136
19572
|
after: "",
|
|
19137
19573
|
...tracker.current()
|
|
19138
|
-
})
|
|
19574
|
+
})) : "";
|
|
19139
19575
|
} else {
|
|
19140
19576
|
after = info.after;
|
|
19141
19577
|
}
|
|
19142
|
-
|
|
19143
|
-
|
|
19144
|
-
|
|
19578
|
+
const previous = results[results.length - 1];
|
|
19579
|
+
if (typeof previous === "string" && (before === "\r" || before === `
|
|
19580
|
+
`) && child.type === "html" && htmlKind(child.value) !== 7) {
|
|
19581
|
+
results[results.length - 1] = previous.replace(/(\r?\n|\r)$/, " ");
|
|
19145
19582
|
before = " ";
|
|
19146
19583
|
tracker = state.createTracker(info);
|
|
19147
|
-
tracker.move(results.
|
|
19584
|
+
tracker.move(serialize2(results, info.before, info.after));
|
|
19585
|
+
}
|
|
19586
|
+
const handle = state.handle.handlers[child.type];
|
|
19587
|
+
if (handle && handle.attention) {
|
|
19588
|
+
const { construct, markers, sizes } = handle.attention(child, state);
|
|
19589
|
+
const sequences = attentionSequences(child.type, markers, sizes);
|
|
19590
|
+
const sequence = sequences[0];
|
|
19591
|
+
const exit = state.enter(construct);
|
|
19592
|
+
tracker.move(sequence);
|
|
19593
|
+
const inside = phrasing2(child, state, {
|
|
19594
|
+
...tracker.current(),
|
|
19595
|
+
before: sequence,
|
|
19596
|
+
after: sequence
|
|
19597
|
+
});
|
|
19598
|
+
tracker.move(serialize2(inside, sequence, sequence));
|
|
19599
|
+
tracker.move(sequence);
|
|
19600
|
+
exit();
|
|
19601
|
+
results.push({ children: inside, sequences });
|
|
19602
|
+
before = sequence.charAt(sequence.length - 1);
|
|
19603
|
+
} else {
|
|
19604
|
+
const value = state.handle(child, parent, state, {
|
|
19605
|
+
...tracker.current(),
|
|
19606
|
+
after,
|
|
19607
|
+
before
|
|
19608
|
+
});
|
|
19609
|
+
if (!value)
|
|
19610
|
+
continue;
|
|
19611
|
+
tracker.move(value);
|
|
19612
|
+
results.push(value);
|
|
19613
|
+
before = lastCharacter(value);
|
|
19148
19614
|
}
|
|
19149
|
-
|
|
19150
|
-
|
|
19151
|
-
|
|
19152
|
-
|
|
19153
|
-
|
|
19154
|
-
|
|
19155
|
-
|
|
19615
|
+
}
|
|
19616
|
+
indexStack.pop();
|
|
19617
|
+
return results;
|
|
19618
|
+
}
|
|
19619
|
+
function render(items, chosen, before, after) {
|
|
19620
|
+
const tokens = [];
|
|
19621
|
+
let encodeAfter;
|
|
19622
|
+
let previous = lastCharacter(before);
|
|
19623
|
+
let index = -1;
|
|
19624
|
+
while (++index < items.length) {
|
|
19625
|
+
const item = items[index];
|
|
19626
|
+
if (typeof item === "string") {
|
|
19627
|
+
const token = { value: item, attention: undefined };
|
|
19628
|
+
if (encodeAfter && encodeAfter === firstCharacter(item)) {
|
|
19629
|
+
encode([token], true);
|
|
19630
|
+
}
|
|
19631
|
+
encodeAfter = undefined;
|
|
19632
|
+
tokens.push(token);
|
|
19633
|
+
if (token.value)
|
|
19634
|
+
previous = lastCharacter(token.value);
|
|
19635
|
+
continue;
|
|
19156
19636
|
}
|
|
19157
|
-
const
|
|
19158
|
-
|
|
19159
|
-
|
|
19160
|
-
|
|
19161
|
-
|
|
19162
|
-
|
|
19163
|
-
|
|
19164
|
-
|
|
19165
|
-
|
|
19637
|
+
const sequence = chosen.get(item) || item.sequences[0];
|
|
19638
|
+
const marker = sequence.charAt(0);
|
|
19639
|
+
const next = items[index + 1];
|
|
19640
|
+
const outsideBefore = previous;
|
|
19641
|
+
const outsideAfter = firstCharacter(next === undefined ? after : typeof next === "string" ? next : chosen.get(next) || next.sequences[0]);
|
|
19642
|
+
const inside = render(item.children, chosen, sequence, sequence);
|
|
19643
|
+
const head = inside.length > 0 ? inside[0].value : "";
|
|
19644
|
+
const open = encodeInfo(outsideBefore.charCodeAt(outsideBefore.length - 1), head.charCodeAt(0), marker);
|
|
19645
|
+
if (open.inside)
|
|
19646
|
+
encode(inside, true);
|
|
19647
|
+
const tail = inside.length > 0 ? lastCharacter(inside[inside.length - 1].value) : "";
|
|
19648
|
+
const close = encodeInfo(outsideAfter.charCodeAt(0), tail.charCodeAt(tail.length - 1), marker);
|
|
19649
|
+
if (close.inside)
|
|
19650
|
+
encode(inside, false);
|
|
19651
|
+
if (open.outside && outsideBefore !== `
|
|
19652
|
+
` && outsideBefore !== "\r") {
|
|
19653
|
+
encode(tokens, false);
|
|
19654
|
+
}
|
|
19655
|
+
if (close.outside)
|
|
19656
|
+
encodeAfter = outsideAfter;
|
|
19657
|
+
tokens.push({ value: sequence, attention: item }, ...inside, {
|
|
19658
|
+
value: sequence,
|
|
19659
|
+
attention: item
|
|
19660
|
+
});
|
|
19661
|
+
previous = sequence.charAt(sequence.length - 1);
|
|
19662
|
+
}
|
|
19663
|
+
return tokens;
|
|
19664
|
+
}
|
|
19665
|
+
function serialize2(items, before, after) {
|
|
19666
|
+
let chosen = new Map;
|
|
19667
|
+
const initial = render(items, chosen, before, after);
|
|
19668
|
+
let tokens = initial;
|
|
19669
|
+
let mistake = check(tokens, before, after);
|
|
19670
|
+
while (mistake) {
|
|
19671
|
+
const next = improve(items, chosen, mistake, before, after);
|
|
19672
|
+
if (!next) {
|
|
19673
|
+
tokens = initial;
|
|
19674
|
+
break;
|
|
19166
19675
|
}
|
|
19167
|
-
|
|
19168
|
-
|
|
19169
|
-
|
|
19676
|
+
chosen = next.chosen;
|
|
19677
|
+
tokens = next.tokens;
|
|
19678
|
+
mistake = next.mistake;
|
|
19170
19679
|
}
|
|
19171
|
-
|
|
19172
|
-
|
|
19680
|
+
let result = "";
|
|
19681
|
+
for (const token of tokens)
|
|
19682
|
+
result += token.value;
|
|
19683
|
+
return result;
|
|
19173
19684
|
}
|
|
19174
|
-
var
|
|
19685
|
+
var builtins;
|
|
19686
|
+
var init_container_phrasing = __esm(() => {
|
|
19687
|
+
init_dev4();
|
|
19688
|
+
init_dev6();
|
|
19689
|
+
init_encode_info();
|
|
19690
|
+
init_html_kind();
|
|
19691
|
+
builtins = new Map([
|
|
19692
|
+
["*", false],
|
|
19693
|
+
["_", true]
|
|
19694
|
+
]);
|
|
19695
|
+
});
|
|
19175
19696
|
|
|
19176
19697
|
// ../../node_modules/mdast-util-to-markdown/lib/util/container-flow.js
|
|
19177
19698
|
function containerFlow(parent, state, info) {
|
|
@@ -19254,19 +19775,24 @@ function safe(state, input, config) {
|
|
|
19254
19775
|
const positions = [];
|
|
19255
19776
|
const result = [];
|
|
19256
19777
|
const infos = {};
|
|
19778
|
+
const percentEncode = state.stack.includes("autolink");
|
|
19779
|
+
const offset = config.before ? config.before.length : 0;
|
|
19780
|
+
const end = value.length - (config.after ? config.after.length : 0);
|
|
19257
19781
|
let index = -1;
|
|
19258
19782
|
while (++index < state.unsafe.length) {
|
|
19259
19783
|
const pattern = state.unsafe[index];
|
|
19260
|
-
if (!patternInScope(state.stack, pattern)) {
|
|
19784
|
+
if (!patternInScope(state.stack, pattern) || !nodeInScope(pattern.beforeNode, config.beforeNode) || !nodeInScope(pattern.afterNode, config.afterNode)) {
|
|
19261
19785
|
continue;
|
|
19262
19786
|
}
|
|
19263
19787
|
const expression = state.compilePattern(pattern);
|
|
19788
|
+
const from = pattern.beforeNode ? offset : 0;
|
|
19789
|
+
const subject = value.slice(from, pattern.afterNode ? end : undefined);
|
|
19264
19790
|
let match;
|
|
19265
|
-
while (match = expression.exec(
|
|
19791
|
+
while (match = expression.exec(subject)) {
|
|
19266
19792
|
const before = "before" in pattern || Boolean(pattern.atBreak);
|
|
19267
19793
|
const after = "after" in pattern;
|
|
19268
|
-
const position = match.index + (before ? match[1].length : 0);
|
|
19269
|
-
if (
|
|
19794
|
+
const position = from + match.index + (before ? match[1].length : 0);
|
|
19795
|
+
if (own7.call(infos, position)) {
|
|
19270
19796
|
if (infos[position].before && !before) {
|
|
19271
19797
|
infos[position].before = false;
|
|
19272
19798
|
}
|
|
@@ -19280,31 +19806,53 @@ function safe(state, input, config) {
|
|
|
19280
19806
|
}
|
|
19281
19807
|
}
|
|
19282
19808
|
positions.sort(numerical);
|
|
19283
|
-
let start =
|
|
19284
|
-
const end = value.length - (config.after ? config.after.length : 0);
|
|
19809
|
+
let start = offset;
|
|
19285
19810
|
index = -1;
|
|
19286
19811
|
while (++index < positions.length) {
|
|
19287
19812
|
const position = positions[index];
|
|
19288
19813
|
if (position < start || position >= end) {
|
|
19289
19814
|
continue;
|
|
19290
19815
|
}
|
|
19816
|
+
if (value.charAt(position) === "_" && position > 0 && classifyCharacter(value.charCodeAt(position - 1)) === undefined && !own7.call(infos, position - 1) && !(position - 1 === offset && /[*_]/.test(value.charAt(offset - 1)))) {
|
|
19817
|
+
let sequenceEnd = position + 1;
|
|
19818
|
+
while (sequenceEnd < end && value.charAt(sequenceEnd) === "_") {
|
|
19819
|
+
sequenceEnd++;
|
|
19820
|
+
}
|
|
19821
|
+
const skip = sequenceEnd - position - 1;
|
|
19822
|
+
if (positions[index + skip] === sequenceEnd - 1 && sequenceEnd < value.length && classifyCharacter(value.charCodeAt(sequenceEnd)) === undefined && !own7.call(infos, sequenceEnd) && !(sequenceEnd === end - 1 && /[*_]/.test(value.charAt(end)))) {
|
|
19823
|
+
index += skip;
|
|
19824
|
+
continue;
|
|
19825
|
+
}
|
|
19826
|
+
}
|
|
19291
19827
|
if (position + 1 < end && positions[index + 1] === position + 1 && infos[position].after && !infos[position + 1].before && !infos[position + 1].after || positions[index - 1] === position - 1 && infos[position].before && !infos[position - 1].before && !infos[position - 1].after) {
|
|
19292
19828
|
continue;
|
|
19293
19829
|
}
|
|
19294
19830
|
if (start !== position) {
|
|
19295
|
-
|
|
19831
|
+
const slice = value.slice(start, position);
|
|
19832
|
+
result.push(percentEncode ? slice : escapeBackslashes(slice, "\\"));
|
|
19296
19833
|
}
|
|
19297
19834
|
start = position;
|
|
19298
|
-
if (
|
|
19835
|
+
if (percentEncode) {
|
|
19836
|
+
result.push("%" + value.charCodeAt(position).toString(16).toUpperCase().padStart(2, "0"));
|
|
19837
|
+
start++;
|
|
19838
|
+
} else if (/[!-/:-@[-`{-~]/.test(value.charAt(position)) && (!config.encode || !config.encode.includes(value.charAt(position)))) {
|
|
19299
19839
|
result.push("\\");
|
|
19300
19840
|
} else {
|
|
19301
19841
|
result.push(encodeCharacterReference(value.charCodeAt(position)));
|
|
19302
19842
|
start++;
|
|
19303
19843
|
}
|
|
19304
19844
|
}
|
|
19305
|
-
|
|
19845
|
+
const rest = value.slice(start, end);
|
|
19846
|
+
result.push(percentEncode ? rest : escapeBackslashes(rest, config.after));
|
|
19306
19847
|
return result.join("");
|
|
19307
19848
|
}
|
|
19849
|
+
function nodeInScope(types, node) {
|
|
19850
|
+
if (!types)
|
|
19851
|
+
return true;
|
|
19852
|
+
if (!node)
|
|
19853
|
+
return false;
|
|
19854
|
+
return typeof types === "string" ? types === node.type : types.includes(node.type);
|
|
19855
|
+
}
|
|
19308
19856
|
function numerical(a, b) {
|
|
19309
19857
|
return a - b;
|
|
19310
19858
|
}
|
|
@@ -19329,7 +19877,11 @@ function escapeBackslashes(value, after) {
|
|
|
19329
19877
|
results.push(value.slice(start));
|
|
19330
19878
|
return results.join("");
|
|
19331
19879
|
}
|
|
19332
|
-
var
|
|
19880
|
+
var own7;
|
|
19881
|
+
var init_safe = __esm(() => {
|
|
19882
|
+
init_dev6();
|
|
19883
|
+
own7 = {}.hasOwnProperty;
|
|
19884
|
+
});
|
|
19333
19885
|
|
|
19334
19886
|
// ../../node_modules/mdast-util-to-markdown/lib/util/track.js
|
|
19335
19887
|
function track(config) {
|
|
@@ -19360,6 +19912,8 @@ function toMarkdown(tree, options) {
|
|
|
19360
19912
|
const settings = options || {};
|
|
19361
19913
|
const state = {
|
|
19362
19914
|
associationId: association,
|
|
19915
|
+
bulletCurrent: undefined,
|
|
19916
|
+
bulletLastUsed: undefined,
|
|
19363
19917
|
containerPhrasing: containerPhrasingBound,
|
|
19364
19918
|
containerFlow: containerFlowBound,
|
|
19365
19919
|
createTracker: track,
|
|
@@ -19384,14 +19938,9 @@ function toMarkdown(tree, options) {
|
|
|
19384
19938
|
unknown,
|
|
19385
19939
|
handlers: state.handlers
|
|
19386
19940
|
});
|
|
19387
|
-
let result = state.handle(tree, undefined, state, {
|
|
19388
|
-
|
|
19389
|
-
`,
|
|
19390
|
-
after: `
|
|
19391
|
-
`,
|
|
19392
|
-
now: { line: 1, column: 1 },
|
|
19393
|
-
lineShift: 0
|
|
19394
|
-
});
|
|
19941
|
+
let result = state.handle(phrasing(tree) ? { type: "root", children: [tree] } : tree, undefined, state, { before: `
|
|
19942
|
+
`, after: `
|
|
19943
|
+
`, now: { line: 1, column: 1 }, lineShift: 0 });
|
|
19395
19944
|
if (result && result.charCodeAt(result.length - 1) !== 10 && result.charCodeAt(result.length - 1) !== 13) {
|
|
19396
19945
|
result += `
|
|
19397
19946
|
`;
|
|
@@ -19427,6 +19976,7 @@ function safeBound(value, config) {
|
|
|
19427
19976
|
return safe(this, value, config);
|
|
19428
19977
|
}
|
|
19429
19978
|
var init_lib17 = __esm(() => {
|
|
19979
|
+
init_mdast_util_phrasing();
|
|
19430
19980
|
init_zwitch();
|
|
19431
19981
|
init_configure();
|
|
19432
19982
|
init_handle();
|
|
@@ -19992,7 +20542,7 @@ function previousUnbalanced(events) {
|
|
|
19992
20542
|
}
|
|
19993
20543
|
return result;
|
|
19994
20544
|
}
|
|
19995
|
-
var wwwPrefix, domain, path, trail, emailDomainDotTrail, wwwAutolink, protocolAutolink, emailAutolink, text4,
|
|
20545
|
+
var wwwPrefix, domain, path, trail, emailDomainDotTrail, wwwAutolink, protocolAutolink, emailAutolink, text4, code3;
|
|
19996
20546
|
var init_syntax2 = __esm(() => {
|
|
19997
20547
|
init_dev4();
|
|
19998
20548
|
init_default();
|
|
@@ -20020,14 +20570,14 @@ var init_syntax2 = __esm(() => {
|
|
|
20020
20570
|
previous: previousEmail
|
|
20021
20571
|
};
|
|
20022
20572
|
text4 = {};
|
|
20023
|
-
|
|
20024
|
-
while (
|
|
20025
|
-
text4[
|
|
20026
|
-
|
|
20027
|
-
if (
|
|
20028
|
-
|
|
20029
|
-
else if (
|
|
20030
|
-
|
|
20573
|
+
code3 = codes.digit0;
|
|
20574
|
+
while (code3 < codes.leftCurlyBrace) {
|
|
20575
|
+
text4[code3] = emailAutolink;
|
|
20576
|
+
code3++;
|
|
20577
|
+
if (code3 === codes.colon)
|
|
20578
|
+
code3 = codes.uppercaseA;
|
|
20579
|
+
else if (code3 === codes.leftSquareBracket)
|
|
20580
|
+
code3 = codes.lowercaseA;
|
|
20031
20581
|
}
|
|
20032
20582
|
text4[codes.plusSign] = emailAutolink;
|
|
20033
20583
|
text4[codes.dash] = emailAutolink;
|
|
@@ -20425,12 +20975,13 @@ var init_dev19 = __esm(() => {
|
|
|
20425
20975
|
});
|
|
20426
20976
|
|
|
20427
20977
|
// ../../node_modules/micromark-extension-gfm-table/dev/lib/edit-map.js
|
|
20428
|
-
class
|
|
20978
|
+
class EditMap2 {
|
|
20429
20979
|
constructor() {
|
|
20430
20980
|
this.map = [];
|
|
20981
|
+
this.index = new Map;
|
|
20431
20982
|
}
|
|
20432
20983
|
add(index, remove, add) {
|
|
20433
|
-
|
|
20984
|
+
addImplementation2(this, index, remove, add);
|
|
20434
20985
|
}
|
|
20435
20986
|
consume(events) {
|
|
20436
20987
|
this.map.sort(function(a, b) {
|
|
@@ -20456,22 +21007,22 @@ class EditMap {
|
|
|
20456
21007
|
slice = vecs.pop();
|
|
20457
21008
|
}
|
|
20458
21009
|
this.map.length = 0;
|
|
21010
|
+
this.index.clear();
|
|
20459
21011
|
}
|
|
20460
21012
|
}
|
|
20461
|
-
function
|
|
20462
|
-
let index = 0;
|
|
21013
|
+
function addImplementation2(editMap, at, remove, add) {
|
|
20463
21014
|
if (remove === 0 && add.length === 0) {
|
|
20464
21015
|
return;
|
|
20465
21016
|
}
|
|
20466
|
-
|
|
20467
|
-
|
|
20468
|
-
|
|
20469
|
-
|
|
20470
|
-
|
|
20471
|
-
}
|
|
20472
|
-
index += 1;
|
|
21017
|
+
const existing = editMap.index.get(at);
|
|
21018
|
+
if (existing) {
|
|
21019
|
+
existing[1] += remove;
|
|
21020
|
+
existing[2].push(...add);
|
|
21021
|
+
return;
|
|
20473
21022
|
}
|
|
20474
|
-
|
|
21023
|
+
const change = [at, remove, add];
|
|
21024
|
+
editMap.map.push(change);
|
|
21025
|
+
editMap.index.set(at, change);
|
|
20475
21026
|
}
|
|
20476
21027
|
|
|
20477
21028
|
// ../../node_modules/micromark-extension-gfm-table/dev/lib/infer.js
|
|
@@ -20522,11 +21073,12 @@ function tokenizeTable(effects, ok2, nok) {
|
|
|
20522
21073
|
function start(code) {
|
|
20523
21074
|
let index = self2.events.length - 1;
|
|
20524
21075
|
while (index > -1) {
|
|
20525
|
-
const type = self2.events[index][1]
|
|
20526
|
-
if (type === types.lineEnding || type === types.linePrefix)
|
|
21076
|
+
const { type } = self2.events[index][1];
|
|
21077
|
+
if (type === types.lineEnding || type === types.linePrefix) {
|
|
20527
21078
|
index--;
|
|
20528
|
-
else
|
|
21079
|
+
} else {
|
|
20529
21080
|
break;
|
|
21081
|
+
}
|
|
20530
21082
|
}
|
|
20531
21083
|
const tail = index > -1 ? self2.events[index][1].type : null;
|
|
20532
21084
|
const next = tail === "tableHead" || tail === "tableRow" ? bodyRowStart : headRowBefore;
|
|
@@ -20741,7 +21293,7 @@ function resolveTable(events, context) {
|
|
|
20741
21293
|
let currentTable;
|
|
20742
21294
|
let currentBody;
|
|
20743
21295
|
let currentCell;
|
|
20744
|
-
const map = new
|
|
21296
|
+
const map = new EditMap2;
|
|
20745
21297
|
while (++index < events.length) {
|
|
20746
21298
|
const event = events[index];
|
|
20747
21299
|
const token = event[1];
|
|
@@ -21752,7 +22304,7 @@ var init_dangerous = __esm(() => {
|
|
|
21752
22304
|
// ../../node_modules/stringify-entities/lib/util/to-named.js
|
|
21753
22305
|
function toNamed(code, next, omit, attribute) {
|
|
21754
22306
|
const character = String.fromCharCode(code);
|
|
21755
|
-
if (
|
|
22307
|
+
if (own8.call(characters, character)) {
|
|
21756
22308
|
const name = characters[character];
|
|
21757
22309
|
const value = "&" + name;
|
|
21758
22310
|
if (omit && characterEntitiesLegacy.includes(name) && !dangerous.includes(name) && (!attribute || next && next !== 61 && notAlphanumericRegex.test(String.fromCharCode(next)))) {
|
|
@@ -21762,15 +22314,15 @@ function toNamed(code, next, omit, attribute) {
|
|
|
21762
22314
|
}
|
|
21763
22315
|
return "";
|
|
21764
22316
|
}
|
|
21765
|
-
var
|
|
22317
|
+
var own8, characters, key, notAlphanumericRegex;
|
|
21766
22318
|
var init_to_named = __esm(() => {
|
|
21767
22319
|
init_character_entities_legacy();
|
|
21768
22320
|
init_character_entities_html4();
|
|
21769
22321
|
init_dangerous();
|
|
21770
|
-
|
|
22322
|
+
own8 = {}.hasOwnProperty;
|
|
21771
22323
|
characters = {};
|
|
21772
22324
|
for (key in characterEntitiesHtml4) {
|
|
21773
|
-
if (
|
|
22325
|
+
if (own8.call(characterEntitiesHtml4, key)) {
|
|
21774
22326
|
characters[characterEntitiesHtml4[key]] = key;
|
|
21775
22327
|
}
|
|
21776
22328
|
}
|
|
@@ -21958,12 +22510,14 @@ function directiveToMarkdown(options) {
|
|
|
21958
22510
|
inConstruct: ["leafDirectiveLabel", "containerDirectiveLabel"]
|
|
21959
22511
|
},
|
|
21960
22512
|
{
|
|
22513
|
+
after: "[^\\s\\p{P}\\p{S}]",
|
|
21961
22514
|
before: "[^:]",
|
|
21962
22515
|
character: ":",
|
|
21963
|
-
|
|
21964
|
-
|
|
22516
|
+
inConstruct: ["phrasing"],
|
|
22517
|
+
unicode: true
|
|
21965
22518
|
},
|
|
21966
|
-
{
|
|
22519
|
+
{ afterNode: "textDirective", character: ":", inConstruct: ["phrasing"] },
|
|
22520
|
+
{ atBreak: true, before: ":+", character: ":" }
|
|
21967
22521
|
]
|
|
21968
22522
|
};
|
|
21969
22523
|
function handleDirective(node, _, state, info) {
|
|
@@ -21971,6 +22525,8 @@ function directiveToMarkdown(options) {
|
|
|
21971
22525
|
const sequence = fence3(node);
|
|
21972
22526
|
const exit = state.enter(node.type);
|
|
21973
22527
|
let value = tracker.move(sequence + (node.name || ""));
|
|
22528
|
+
const attributesValue = attributes(node, state);
|
|
22529
|
+
const after = info.after.charCodeAt(0);
|
|
21974
22530
|
let label;
|
|
21975
22531
|
if (node.type === "containerDirective") {
|
|
21976
22532
|
const head = (node.children || [])[0];
|
|
@@ -21991,8 +22547,10 @@ function directiveToMarkdown(options) {
|
|
|
21991
22547
|
value += tracker.move("]");
|
|
21992
22548
|
subexit();
|
|
21993
22549
|
exit();
|
|
22550
|
+
} else if (!attributesValue && (after === 45 || after === 95 || !(unicodePunctuation(after) || unicodeWhitespace(after)))) {
|
|
22551
|
+
value += tracker.move("[]");
|
|
21994
22552
|
}
|
|
21995
|
-
value += tracker.move(
|
|
22553
|
+
value += tracker.move(attributesValue || (after === 123 ? "{}" : ""));
|
|
21996
22554
|
if (node.type === "containerDirective") {
|
|
21997
22555
|
const head = (node.children || [])[0];
|
|
21998
22556
|
let shallow = node;
|
|
@@ -22018,12 +22576,12 @@ function directiveToMarkdown(options) {
|
|
|
22018
22576
|
let id;
|
|
22019
22577
|
let key;
|
|
22020
22578
|
for (key in attributes) {
|
|
22021
|
-
if (
|
|
22579
|
+
if (own9.call(attributes, key) && attributes[key] !== undefined && attributes[key] !== null) {
|
|
22022
22580
|
const value = String(attributes[key]);
|
|
22023
22581
|
if (key === "id") {
|
|
22024
22582
|
id = settings.preferShortcut !== false && shortcut.test(value) ? "#" + value : quoted("id", value, node, state);
|
|
22025
22583
|
} else if (key === "class") {
|
|
22026
|
-
const list = value.split(/[\t\n\r ]+/
|
|
22584
|
+
const list = value.split(/[\t\n\r ]+/);
|
|
22027
22585
|
const classesFullList = [];
|
|
22028
22586
|
const classesList = [];
|
|
22029
22587
|
let index = -1;
|
|
@@ -22169,13 +22727,14 @@ function fence3(node) {
|
|
|
22169
22727
|
}
|
|
22170
22728
|
return ":".repeat(size);
|
|
22171
22729
|
}
|
|
22172
|
-
var
|
|
22730
|
+
var own9, emptyOptions4, shortcut, unquoted;
|
|
22173
22731
|
var init_lib25 = __esm(() => {
|
|
22174
22732
|
init_development();
|
|
22733
|
+
init_dev4();
|
|
22175
22734
|
init_parse_entities();
|
|
22176
22735
|
init_stringify_entities();
|
|
22177
22736
|
init_unist_util_visit_parents3();
|
|
22178
|
-
|
|
22737
|
+
own9 = {}.hasOwnProperty;
|
|
22179
22738
|
emptyOptions4 = {};
|
|
22180
22739
|
shortcut = /^[^\t\n\r "#'.<=>`}]+$/;
|
|
22181
22740
|
unquoted = /^[^\t\n\r "'<=>`}]+$/;
|
|
@@ -24433,7 +24992,7 @@ function element(state, node) {
|
|
|
24433
24992
|
while (++index < node.attrs.length) {
|
|
24434
24993
|
const attribute = node.attrs[index];
|
|
24435
24994
|
const name = (attribute.prefix ? attribute.prefix + ":" : "") + attribute.name;
|
|
24436
|
-
if (!
|
|
24995
|
+
if (!own10.call(proto, name)) {
|
|
24437
24996
|
properties[name] = attribute.value;
|
|
24438
24997
|
}
|
|
24439
24998
|
}
|
|
@@ -24475,7 +25034,7 @@ function createLocation(state, node, location) {
|
|
|
24475
25034
|
let key;
|
|
24476
25035
|
if (location.attrs) {
|
|
24477
25036
|
for (key in location.attrs) {
|
|
24478
|
-
if (
|
|
25037
|
+
if (own10.call(location.attrs, key)) {
|
|
24479
25038
|
properties[find(state.schema, key).property] = position2(location.attrs[key]);
|
|
24480
25039
|
}
|
|
24481
25040
|
}
|
|
@@ -24508,14 +25067,14 @@ function position2(loc) {
|
|
|
24508
25067
|
function point3(point) {
|
|
24509
25068
|
return point.line && point.column ? point : undefined;
|
|
24510
25069
|
}
|
|
24511
|
-
var
|
|
25070
|
+
var own10, proto;
|
|
24512
25071
|
var init_lib29 = __esm(() => {
|
|
24513
25072
|
init_development();
|
|
24514
25073
|
init_hastscript();
|
|
24515
25074
|
init_property_information();
|
|
24516
25075
|
init_vfile_location();
|
|
24517
25076
|
init_web_namespaces();
|
|
24518
|
-
|
|
25077
|
+
own10 = {}.hasOwnProperty;
|
|
24519
25078
|
proto = Object.prototype;
|
|
24520
25079
|
});
|
|
24521
25080
|
|
|
@@ -24939,14 +25498,14 @@ var init_decode_codepoint = __esm(() => {
|
|
|
24939
25498
|
});
|
|
24940
25499
|
|
|
24941
25500
|
// ../../node_modules/parse5/node_modules/entities/dist/esm/decode.js
|
|
24942
|
-
function
|
|
25501
|
+
function isNumber2(code) {
|
|
24943
25502
|
return code >= CharCodes.ZERO && code <= CharCodes.NINE;
|
|
24944
25503
|
}
|
|
24945
25504
|
function isHexadecimalCharacter(code) {
|
|
24946
25505
|
return code >= CharCodes.UPPER_A && code <= CharCodes.UPPER_F || code >= CharCodes.LOWER_A && code <= CharCodes.LOWER_F;
|
|
24947
25506
|
}
|
|
24948
25507
|
function isAsciiAlphaNumeric(code) {
|
|
24949
|
-
return code >= CharCodes.UPPER_A && code <= CharCodes.UPPER_Z || code >= CharCodes.LOWER_A && code <= CharCodes.LOWER_Z ||
|
|
25508
|
+
return code >= CharCodes.UPPER_A && code <= CharCodes.UPPER_Z || code >= CharCodes.LOWER_A && code <= CharCodes.LOWER_Z || isNumber2(code);
|
|
24950
25509
|
}
|
|
24951
25510
|
function isEntityInAttributeInvalidEnd(code) {
|
|
24952
25511
|
return code === CharCodes.EQUALS || isAsciiAlphaNumeric(code);
|
|
@@ -25020,7 +25579,7 @@ class EntityDecoder {
|
|
|
25020
25579
|
const startIndex = offset;
|
|
25021
25580
|
while (offset < input.length) {
|
|
25022
25581
|
const char = input.charCodeAt(offset);
|
|
25023
|
-
if (
|
|
25582
|
+
if (isNumber2(char) || isHexadecimalCharacter(char)) {
|
|
25024
25583
|
offset += 1;
|
|
25025
25584
|
} else {
|
|
25026
25585
|
this.addToNumericResult(input, startIndex, offset, 16);
|
|
@@ -25034,7 +25593,7 @@ class EntityDecoder {
|
|
|
25034
25593
|
const startIndex = offset;
|
|
25035
25594
|
while (offset < input.length) {
|
|
25036
25595
|
const char = input.charCodeAt(offset);
|
|
25037
|
-
if (
|
|
25596
|
+
if (isNumber2(char)) {
|
|
25038
25597
|
offset += 1;
|
|
25039
25598
|
} else {
|
|
25040
25599
|
this.addToNumericResult(input, startIndex, offset, 10);
|
|
@@ -32470,11 +33029,11 @@ function convertHastNode(node) {
|
|
|
32470
33029
|
if (whitespace(node)) {
|
|
32471
33030
|
return null;
|
|
32472
33031
|
}
|
|
32473
|
-
return node.value
|
|
33032
|
+
return node.value;
|
|
32474
33033
|
}
|
|
32475
33034
|
if (node.type === "element") {
|
|
32476
33035
|
const el = { tagName: node.tagName };
|
|
32477
|
-
if (
|
|
33036
|
+
if (Object.keys(node.properties).length > 0) {
|
|
32478
33037
|
const { style, attrs } = hastPropsToJx(node.properties);
|
|
32479
33038
|
if (Object.keys(attrs).length > 0) {
|
|
32480
33039
|
el.attributes = attrs;
|
|
@@ -32483,8 +33042,8 @@ function convertHastNode(node) {
|
|
|
32483
33042
|
el.style = style;
|
|
32484
33043
|
}
|
|
32485
33044
|
}
|
|
32486
|
-
const kids =
|
|
32487
|
-
if (kids.length === 1 &&
|
|
33045
|
+
const kids = convertHastChildren(node.children);
|
|
33046
|
+
if (kids.length === 1 && isString(kids[0])) {
|
|
32488
33047
|
[el.textContent] = kids;
|
|
32489
33048
|
} else if (kids.length > 0) {
|
|
32490
33049
|
el.children = kids;
|
|
@@ -32502,7 +33061,7 @@ function hastPropsToJx(properties) {
|
|
|
32502
33061
|
}
|
|
32503
33062
|
const info = find(html3, key);
|
|
32504
33063
|
const name = info.attribute;
|
|
32505
|
-
if (name === "style" &&
|
|
33064
|
+
if (name === "style" && isString(value)) {
|
|
32506
33065
|
parseInlineStyle(value, style);
|
|
32507
33066
|
continue;
|
|
32508
33067
|
}
|
|
@@ -32533,6 +33092,7 @@ var init_html_to_jx = __esm(() => {
|
|
|
32533
33092
|
init_hast_util_from_html();
|
|
32534
33093
|
init_hast_util_whitespace();
|
|
32535
33094
|
init_property_information();
|
|
33095
|
+
init_guards();
|
|
32536
33096
|
});
|
|
32537
33097
|
|
|
32538
33098
|
// src/alerts.ts
|
|
@@ -32545,7 +33105,7 @@ function normalizeAlerts(config, where = "alerts") {
|
|
|
32545
33105
|
if (config === undefined || config === true) {
|
|
32546
33106
|
return { disabled, types };
|
|
32547
33107
|
}
|
|
32548
|
-
if (
|
|
33108
|
+
if (!isJsonObject(config)) {
|
|
32549
33109
|
throw new TypeError(`${where}: expected an object mapping alert types to element names, or false`);
|
|
32550
33110
|
}
|
|
32551
33111
|
for (const [type, element] of Object.entries(config)) {
|
|
@@ -32558,7 +33118,7 @@ function normalizeAlerts(config, where = "alerts") {
|
|
|
32558
33118
|
disabled.add(key);
|
|
32559
33119
|
} else if (element === true) {
|
|
32560
33120
|
types.set(key, null);
|
|
32561
|
-
} else if (
|
|
33121
|
+
} else if (isString(element) && TAG_NAME.test(element)) {
|
|
32562
33122
|
types.set(key, element);
|
|
32563
33123
|
} else {
|
|
32564
33124
|
throw new TypeError(`${where}.${type}: expected an element name such as "doc-note", true or false, got ${JSON.stringify(element)}`);
|
|
@@ -32569,7 +33129,7 @@ function normalizeAlerts(config, where = "alerts") {
|
|
|
32569
33129
|
function inlineText(nodes) {
|
|
32570
33130
|
let out = "";
|
|
32571
33131
|
for (const node of nodes) {
|
|
32572
|
-
if (
|
|
33132
|
+
if (node.value !== undefined) {
|
|
32573
33133
|
out += node.value;
|
|
32574
33134
|
} else if (node.children) {
|
|
32575
33135
|
out += inlineText(node.children);
|
|
@@ -32582,7 +33142,7 @@ function textNode(value) {
|
|
|
32582
33142
|
}
|
|
32583
33143
|
function markerOf(paragraph) {
|
|
32584
33144
|
const [first] = paragraph.children ?? [];
|
|
32585
|
-
if (first?.type !== "text" ||
|
|
33145
|
+
if (first?.type !== "text" || first.value === undefined) {
|
|
32586
33146
|
return null;
|
|
32587
33147
|
}
|
|
32588
33148
|
const match = MARKER2.exec(first.value);
|
|
@@ -32608,7 +33168,7 @@ function splitMarker(paragraph, settings) {
|
|
|
32608
33168
|
const take = (node) => {
|
|
32609
33169
|
if (inTitle && node.type === "break") {
|
|
32610
33170
|
inTitle = false;
|
|
32611
|
-
} else if (inTitle && node.type === "text" &&
|
|
33171
|
+
} else if (inTitle && node.type === "text" && node.value !== undefined) {
|
|
32612
33172
|
const lineEnd = LINE_END.exec(node.value);
|
|
32613
33173
|
if (lineEnd === null) {
|
|
32614
33174
|
title.push(node);
|
|
@@ -32665,6 +33225,7 @@ function transformAlerts(tree, settings, onUnknown) {
|
|
|
32665
33225
|
}
|
|
32666
33226
|
var DEFAULT_ALERT_TITLES, ALERT_NODE = "jxAlert", TAG_NAME, MARKER2, LINE_END;
|
|
32667
33227
|
var init_alerts = __esm(() => {
|
|
33228
|
+
init_guards();
|
|
32668
33229
|
DEFAULT_ALERT_TITLES = {
|
|
32669
33230
|
caution: "Caution",
|
|
32670
33231
|
important: "Important",
|
|
@@ -32690,21 +33251,24 @@ function jxKey(key) {
|
|
|
32690
33251
|
function expandDotPaths(attrs) {
|
|
32691
33252
|
const result = {};
|
|
32692
33253
|
for (const [key, value] of Object.entries(attrs)) {
|
|
32693
|
-
const
|
|
32694
|
-
if (
|
|
33254
|
+
const lastDot = key.lastIndexOf(".");
|
|
33255
|
+
if (lastDot === -1) {
|
|
32695
33256
|
result[jxKey(key)] = value;
|
|
32696
33257
|
continue;
|
|
32697
33258
|
}
|
|
32698
|
-
const segments = key.split(".");
|
|
32699
33259
|
let target = result;
|
|
32700
|
-
for (
|
|
32701
|
-
const seg = jxKey(
|
|
32702
|
-
|
|
32703
|
-
|
|
33260
|
+
for (const segment of key.slice(0, lastDot).split(".")) {
|
|
33261
|
+
const seg = jxKey(segment);
|
|
33262
|
+
const existing = seg in target ? target[seg] : undefined;
|
|
33263
|
+
if (isNonNullObject(existing)) {
|
|
33264
|
+
target = existing;
|
|
33265
|
+
} else {
|
|
33266
|
+
const nested = {};
|
|
33267
|
+
target[seg] = nested;
|
|
33268
|
+
target = nested;
|
|
32704
33269
|
}
|
|
32705
|
-
target = target[seg];
|
|
32706
33270
|
}
|
|
32707
|
-
target[jxKey(
|
|
33271
|
+
target[jxKey(key.slice(lastDot + 1))] = value;
|
|
32708
33272
|
}
|
|
32709
33273
|
return result;
|
|
32710
33274
|
}
|
|
@@ -32725,22 +33289,34 @@ function applyStyleKeyMapping(styleObj) {
|
|
|
32725
33289
|
}
|
|
32726
33290
|
function routeAttributes(attrs) {
|
|
32727
33291
|
const expanded = expandDotPaths(attrs);
|
|
32728
|
-
|
|
32729
|
-
|
|
33292
|
+
const { style } = expanded;
|
|
33293
|
+
if (isNonNullObject(style)) {
|
|
33294
|
+
expanded.style = applyStyleKeyMapping(style);
|
|
32730
33295
|
}
|
|
32731
33296
|
const props = {};
|
|
32732
33297
|
const attributes = {};
|
|
32733
33298
|
for (const [key, value] of Object.entries(expanded)) {
|
|
32734
33299
|
if (HTML_ATTR_PATTERN.test(key)) {
|
|
32735
|
-
attributes[key] = value;
|
|
33300
|
+
attributes[key] = attributeValue(value);
|
|
32736
33301
|
} else {
|
|
32737
33302
|
props[key] = value;
|
|
32738
33303
|
}
|
|
32739
33304
|
}
|
|
32740
33305
|
return { attributes, props };
|
|
32741
33306
|
}
|
|
33307
|
+
function attributeValue(value) {
|
|
33308
|
+
return value;
|
|
33309
|
+
}
|
|
33310
|
+
function setContent(el, children) {
|
|
33311
|
+
const [only] = children;
|
|
33312
|
+
if (children.length === 1 && isString(only)) {
|
|
33313
|
+
el.textContent = only;
|
|
33314
|
+
} else if (children.length > 0) {
|
|
33315
|
+
el.children = children;
|
|
33316
|
+
}
|
|
33317
|
+
}
|
|
32742
33318
|
function mdastNodeToJx(node) {
|
|
32743
|
-
if (!node
|
|
33319
|
+
if (!node) {
|
|
32744
33320
|
return null;
|
|
32745
33321
|
}
|
|
32746
33322
|
if (node.type === "yaml" || node.type === "toml") {
|
|
@@ -32761,7 +33337,7 @@ function mdastNodeToJx(node) {
|
|
|
32761
33337
|
}
|
|
32762
33338
|
return null;
|
|
32763
33339
|
}
|
|
32764
|
-
const tagFn = JX_TAG_MAP
|
|
33340
|
+
const tagFn = JX_TAG_MAP.get(node.type);
|
|
32765
33341
|
if (!tagFn) {
|
|
32766
33342
|
return null;
|
|
32767
33343
|
}
|
|
@@ -32777,12 +33353,7 @@ function mdastNodeToJx(node) {
|
|
|
32777
33353
|
case "listItem":
|
|
32778
33354
|
case "tableRow":
|
|
32779
33355
|
case "tableCell": {
|
|
32780
|
-
|
|
32781
|
-
if (children.length === 1 && typeof children[0] === "string") {
|
|
32782
|
-
[el.textContent] = children;
|
|
32783
|
-
} else if (children.length > 0) {
|
|
32784
|
-
el.children = children;
|
|
32785
|
-
}
|
|
33356
|
+
setContent(el, convertChildren(node.children ?? []));
|
|
32786
33357
|
break;
|
|
32787
33358
|
}
|
|
32788
33359
|
case "inlineCode": {
|
|
@@ -32790,34 +33361,18 @@ function mdastNodeToJx(node) {
|
|
|
32790
33361
|
break;
|
|
32791
33362
|
}
|
|
32792
33363
|
case "link": {
|
|
32793
|
-
{
|
|
32794
|
-
|
|
32795
|
-
|
|
32796
|
-
};
|
|
32797
|
-
if (node.title) {
|
|
32798
|
-
linkAttrs.title = node.title;
|
|
32799
|
-
}
|
|
32800
|
-
el.attributes = linkAttrs;
|
|
32801
|
-
}
|
|
32802
|
-
{
|
|
32803
|
-
const children = convertChildren(node.children ?? []);
|
|
32804
|
-
if (children.length === 1 && typeof children[0] === "string") {
|
|
32805
|
-
[el.textContent] = children;
|
|
32806
|
-
} else if (children.length > 0) {
|
|
32807
|
-
el.children = children;
|
|
32808
|
-
}
|
|
33364
|
+
el.attributes = { href: node.url ?? "" };
|
|
33365
|
+
if (node.title) {
|
|
33366
|
+
el.attributes.title = node.title;
|
|
32809
33367
|
}
|
|
33368
|
+
setContent(el, convertChildren(node.children ?? []));
|
|
32810
33369
|
break;
|
|
32811
33370
|
}
|
|
32812
33371
|
case "image": {
|
|
32813
|
-
|
|
32814
|
-
alt: node.alt ?? "",
|
|
32815
|
-
src: node.url ?? ""
|
|
32816
|
-
};
|
|
33372
|
+
el.attributes = { alt: node.alt ?? "", src: node.url ?? "" };
|
|
32817
33373
|
if (node.title) {
|
|
32818
|
-
|
|
33374
|
+
el.attributes.title = node.title;
|
|
32819
33375
|
}
|
|
32820
|
-
el.attributes = imageAttrs;
|
|
32821
33376
|
break;
|
|
32822
33377
|
}
|
|
32823
33378
|
case "list": {
|
|
@@ -32830,13 +33385,11 @@ function mdastNodeToJx(node) {
|
|
|
32830
33385
|
break;
|
|
32831
33386
|
}
|
|
32832
33387
|
case "code": {
|
|
32833
|
-
|
|
32834
|
-
|
|
32835
|
-
|
|
32836
|
-
|
|
32837
|
-
|
|
32838
|
-
}
|
|
32839
|
-
];
|
|
33388
|
+
const code = { tagName: "code", textContent: node.value ?? null };
|
|
33389
|
+
if (node.lang) {
|
|
33390
|
+
code.className = `language-${node.lang}`;
|
|
33391
|
+
}
|
|
33392
|
+
el.children = [code];
|
|
32840
33393
|
break;
|
|
32841
33394
|
}
|
|
32842
33395
|
case "thematicBreak":
|
|
@@ -32846,16 +33399,21 @@ function mdastNodeToJx(node) {
|
|
|
32846
33399
|
case "table": {
|
|
32847
33400
|
const rows = convertChildren(node.children ?? []);
|
|
32848
33401
|
const [headerRow] = rows;
|
|
32849
|
-
if (headerRow &&
|
|
33402
|
+
if (isNonNullObject(headerRow) && Array.isArray(headerRow.children)) {
|
|
32850
33403
|
for (const cell of headerRow.children) {
|
|
32851
|
-
if (cell &&
|
|
33404
|
+
if (isNonNullObject(cell) && cell.tagName === "td") {
|
|
32852
33405
|
cell.tagName = "th";
|
|
32853
33406
|
}
|
|
32854
33407
|
}
|
|
32855
33408
|
}
|
|
32856
|
-
const
|
|
32857
|
-
|
|
32858
|
-
|
|
33409
|
+
const sections = [];
|
|
33410
|
+
if (headerRow !== undefined) {
|
|
33411
|
+
sections.push({ children: [headerRow], tagName: "thead" });
|
|
33412
|
+
}
|
|
33413
|
+
if (rows.length > 1) {
|
|
33414
|
+
sections.push({ children: rows.slice(1), tagName: "tbody" });
|
|
33415
|
+
}
|
|
33416
|
+
el.children = sections;
|
|
32859
33417
|
break;
|
|
32860
33418
|
}
|
|
32861
33419
|
default: {
|
|
@@ -32867,10 +33425,7 @@ function mdastNodeToJx(node) {
|
|
|
32867
33425
|
function alertToJx(node) {
|
|
32868
33426
|
const body = convertChildren(node.children ?? []);
|
|
32869
33427
|
if (node.element) {
|
|
32870
|
-
const attributes = { "data-alert": node.alert };
|
|
32871
|
-
if (node.titleNodes) {
|
|
32872
|
-
attributes["data-title"] = inlineText(node.titleNodes).trim();
|
|
32873
|
-
}
|
|
33428
|
+
const attributes = node.titleNodes ? { "data-alert": node.alert, "data-title": inlineText(node.titleNodes).trim() } : { "data-alert": node.alert };
|
|
32874
33429
|
const el = { attributes, tagName: node.element };
|
|
32875
33430
|
if (body.length > 0) {
|
|
32876
33431
|
el.children = body;
|
|
@@ -32880,8 +33435,9 @@ function alertToJx(node) {
|
|
|
32880
33435
|
const title = { className: "jx-alert-title", tagName: "p" };
|
|
32881
33436
|
if (node.titleNodes) {
|
|
32882
33437
|
const inline = convertChildren(node.titleNodes);
|
|
32883
|
-
|
|
32884
|
-
|
|
33438
|
+
const [only] = inline;
|
|
33439
|
+
if (inline.length === 1 && isString(only)) {
|
|
33440
|
+
title.textContent = only;
|
|
32885
33441
|
} else {
|
|
32886
33442
|
title.children = inline;
|
|
32887
33443
|
}
|
|
@@ -32896,13 +33452,14 @@ function alertToJx(node) {
|
|
|
32896
33452
|
};
|
|
32897
33453
|
}
|
|
32898
33454
|
function directiveToJx(node) {
|
|
32899
|
-
|
|
32900
|
-
|
|
33455
|
+
const name = node.name;
|
|
33456
|
+
if (PROTOTYPE_DIRECTIVE_NAMES.has(name)) {
|
|
33457
|
+
return prototypeDirectiveToJx(node, name);
|
|
32901
33458
|
}
|
|
32902
|
-
const el = { tagName:
|
|
33459
|
+
const el = { tagName: name };
|
|
32903
33460
|
if (node.attributes && Object.keys(node.attributes).length > 0) {
|
|
32904
33461
|
const { props, attributes } = routeAttributes(node.attributes);
|
|
32905
|
-
const isCustomElement =
|
|
33462
|
+
const isCustomElement = name.includes("-");
|
|
32906
33463
|
if (isCustomElement) {
|
|
32907
33464
|
for (const [key, value] of Object.entries(props)) {
|
|
32908
33465
|
if (key === "style" || key === "children" || key === "textContent" || key === "innerHTML" || key.startsWith("$")) {
|
|
@@ -32911,7 +33468,7 @@ function directiveToJx(node) {
|
|
|
32911
33468
|
if (!el.attributes) {
|
|
32912
33469
|
el.attributes = {};
|
|
32913
33470
|
}
|
|
32914
|
-
el.attributes[key] = value;
|
|
33471
|
+
el.attributes[key] = attributeValue(value);
|
|
32915
33472
|
}
|
|
32916
33473
|
}
|
|
32917
33474
|
} else {
|
|
@@ -32922,7 +33479,7 @@ function directiveToJx(node) {
|
|
|
32922
33479
|
if (!el.attributes) {
|
|
32923
33480
|
el.attributes = {};
|
|
32924
33481
|
}
|
|
32925
|
-
el.attributes[key] = value;
|
|
33482
|
+
el.attributes[key] = attributeValue(value);
|
|
32926
33483
|
}
|
|
32927
33484
|
}
|
|
32928
33485
|
}
|
|
@@ -32932,12 +33489,7 @@ function directiveToJx(node) {
|
|
|
32932
33489
|
}
|
|
32933
33490
|
if (node.type === "textDirective") {
|
|
32934
33491
|
if (node.children && node.children.length > 0) {
|
|
32935
|
-
|
|
32936
|
-
if (children.length === 1 && typeof children[0] === "string") {
|
|
32937
|
-
[el.textContent] = children;
|
|
32938
|
-
} else if (children.length > 0) {
|
|
32939
|
-
el.children = children;
|
|
32940
|
-
}
|
|
33492
|
+
setContent(el, convertChildren(node.children));
|
|
32941
33493
|
}
|
|
32942
33494
|
return el;
|
|
32943
33495
|
}
|
|
@@ -32946,7 +33498,7 @@ function directiveToJx(node) {
|
|
|
32946
33498
|
}
|
|
32947
33499
|
if (node.children && node.children.length > 0) {
|
|
32948
33500
|
const jxChildren = [];
|
|
32949
|
-
const isPhrasingParent = PHRASING_ELEMENTS.has(
|
|
33501
|
+
const isPhrasingParent = PHRASING_ELEMENTS.has(name);
|
|
32950
33502
|
for (const child of node.children) {
|
|
32951
33503
|
if (isPhrasingParent && child.type === "paragraph") {
|
|
32952
33504
|
for (const inline of child.children ?? []) {
|
|
@@ -32972,16 +33524,14 @@ function directiveToJx(node) {
|
|
|
32972
33524
|
}
|
|
32973
33525
|
}
|
|
32974
33526
|
}
|
|
32975
|
-
if (el.children
|
|
32976
|
-
|
|
32977
|
-
} else if (jxChildren.length > 0) {
|
|
32978
|
-
el.children = jxChildren;
|
|
33527
|
+
if (!isNonNullObject(el.children) || Array.isArray(el.children)) {
|
|
33528
|
+
setContent(el, jxChildren);
|
|
32979
33529
|
}
|
|
32980
33530
|
}
|
|
32981
33531
|
return el;
|
|
32982
33532
|
}
|
|
32983
|
-
function prototypeDirectiveToJx(node) {
|
|
32984
|
-
const el = { $prototype:
|
|
33533
|
+
function prototypeDirectiveToJx(node, name) {
|
|
33534
|
+
const el = { $prototype: name };
|
|
32985
33535
|
if (node.attributes && Object.keys(node.attributes).length > 0) {
|
|
32986
33536
|
const expanded = expandDotPaths(node.attributes);
|
|
32987
33537
|
for (const [key, value] of Object.entries(expanded)) {
|
|
@@ -32992,7 +33542,7 @@ function prototypeDirectiveToJx(node) {
|
|
|
32992
33542
|
}
|
|
32993
33543
|
}
|
|
32994
33544
|
const children = convertChildren(node.children ?? []);
|
|
32995
|
-
const template = children.find((c) => c
|
|
33545
|
+
const template = children.find((c) => !isString(c));
|
|
32996
33546
|
if (template) {
|
|
32997
33547
|
el.map = template;
|
|
32998
33548
|
}
|
|
@@ -33002,17 +33552,19 @@ function convertChildren(children) {
|
|
|
33002
33552
|
if (!children) {
|
|
33003
33553
|
return [];
|
|
33004
33554
|
}
|
|
33005
|
-
return children.flatMap((n) => mdastNodeToJx(n)
|
|
33555
|
+
return children.flatMap((n) => mdastNodeToJx(n) ?? []);
|
|
33006
33556
|
}
|
|
33007
33557
|
function transpileJxMarkdown(source) {
|
|
33008
33558
|
const processor = unified().use(remarkParse).use(remarkFrontmatter, ["yaml"]).use(import_remark_parse_frontmatter.default).use(remarkGfm).use(remarkDirective);
|
|
33009
33559
|
const tree = processor.parse(source);
|
|
33010
33560
|
const vfile = { data: {} };
|
|
33011
33561
|
processor.runSync(tree, vfile);
|
|
33012
|
-
const frontmatter = vfile.data
|
|
33562
|
+
const frontmatter = vfile.data.frontmatter ?? {};
|
|
33013
33563
|
const doc = {};
|
|
33014
|
-
|
|
33015
|
-
|
|
33564
|
+
if (!isNumber(frontmatter) && !isBoolean(frontmatter)) {
|
|
33565
|
+
for (const [key, value] of Object.entries(frontmatter)) {
|
|
33566
|
+
doc[key] = value;
|
|
33567
|
+
}
|
|
33016
33568
|
}
|
|
33017
33569
|
const bodyNodes = tree.children.filter((n) => n.type !== "yaml" && n.type !== "toml");
|
|
33018
33570
|
const children = [];
|
|
@@ -33036,10 +33588,10 @@ function slugifyHeading(text) {
|
|
|
33036
33588
|
return text.normalize("NFC").toLowerCase().replaceAll(/[^\p{L}\p{N}_\s-]/gu, "").replaceAll(/\s+/gu, "-").replaceAll(/-+/g, "-").replaceAll(/^-|-$/g, "");
|
|
33037
33589
|
}
|
|
33038
33590
|
function jxNodeText(node) {
|
|
33039
|
-
if (
|
|
33591
|
+
if (isString(node)) {
|
|
33040
33592
|
return node;
|
|
33041
33593
|
}
|
|
33042
|
-
let out =
|
|
33594
|
+
let out = isString(node.textContent) ? node.textContent : "";
|
|
33043
33595
|
if (Array.isArray(node.children)) {
|
|
33044
33596
|
for (const child of node.children) {
|
|
33045
33597
|
out += jxNodeText(child);
|
|
@@ -33052,13 +33604,13 @@ function assignHeadingIds(children) {
|
|
|
33052
33604
|
const seen = new Map;
|
|
33053
33605
|
function walk(nodes) {
|
|
33054
33606
|
for (const node of nodes) {
|
|
33055
|
-
if (
|
|
33607
|
+
if (!isNonNullObject(node)) {
|
|
33056
33608
|
continue;
|
|
33057
33609
|
}
|
|
33058
|
-
const tag =
|
|
33610
|
+
const tag = isString(node.tagName) ? node.tagName : "";
|
|
33059
33611
|
if (tag && HEADING_TAGS.has(tag)) {
|
|
33060
33612
|
const text = jxNodeText(node).trim();
|
|
33061
|
-
let id =
|
|
33613
|
+
let id = isString(node.id) && node.id.length > 0 ? node.id : "";
|
|
33062
33614
|
if (id) {
|
|
33063
33615
|
seen.set(id, (seen.get(id) ?? 0) + 1);
|
|
33064
33616
|
} else {
|
|
@@ -33088,6 +33640,7 @@ var init_transpile = __esm(() => {
|
|
|
33088
33640
|
init_remark_gfm();
|
|
33089
33641
|
init_remark_directive();
|
|
33090
33642
|
init_html_to_jx();
|
|
33643
|
+
init_guards();
|
|
33091
33644
|
init_alerts();
|
|
33092
33645
|
init_html_to_jx();
|
|
33093
33646
|
import_remark_parse_frontmatter = __toESM(require_dist2(), 1);
|
|
@@ -33155,79 +33708,26 @@ var init_transpile = __esm(() => {
|
|
|
33155
33708
|
"summary",
|
|
33156
33709
|
"dt"
|
|
33157
33710
|
]);
|
|
33158
|
-
JX_TAG_MAP =
|
|
33159
|
-
blockquote
|
|
33160
|
-
break
|
|
33161
|
-
code
|
|
33162
|
-
delete
|
|
33163
|
-
emphasis
|
|
33164
|
-
heading
|
|
33165
|
-
image
|
|
33166
|
-
inlineCode
|
|
33167
|
-
link
|
|
33168
|
-
list
|
|
33169
|
-
listItem
|
|
33170
|
-
paragraph
|
|
33171
|
-
strong
|
|
33172
|
-
table
|
|
33173
|
-
tableCell
|
|
33174
|
-
tableRow
|
|
33175
|
-
thematicBreak
|
|
33176
|
-
};
|
|
33177
|
-
HEADING_TAGS = new Set(["h1", "h2", "h3", "h4", "h5", "h6"]);
|
|
33178
|
-
});
|
|
33179
|
-
|
|
33180
|
-
// ../../packages/schema/src/guards.ts
|
|
33181
|
-
function isJsonObject(value) {
|
|
33182
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
33183
|
-
}
|
|
33184
|
-
function isRef(value) {
|
|
33185
|
-
return isJsonObject(value) && typeof value.$ref === "string";
|
|
33186
|
-
}
|
|
33187
|
-
function isTagExpression(tagName) {
|
|
33188
|
-
if (!isJsonObject(tagName) || !isJsonObject(tagName.$expression)) {
|
|
33189
|
-
return false;
|
|
33190
|
-
}
|
|
33191
|
-
const expression = tagName.$expression;
|
|
33192
|
-
if (expression.operator === "?:") {
|
|
33193
|
-
return typeof expression.value === "string" && typeof expression.initial === "string";
|
|
33194
|
-
}
|
|
33195
|
-
if (expression.operator === "switch") {
|
|
33196
|
-
return isJsonObject(expression.cases) && Object.values(expression.cases).every((tag) => typeof tag === "string") && typeof expression.default === "string";
|
|
33197
|
-
}
|
|
33198
|
-
return false;
|
|
33199
|
-
}
|
|
33200
|
-
function tagNameCandidates(tagName) {
|
|
33201
|
-
if (typeof tagName === "string") {
|
|
33202
|
-
return [tagName];
|
|
33203
|
-
}
|
|
33204
|
-
if (!isTagExpression(tagName)) {
|
|
33205
|
-
return [];
|
|
33206
|
-
}
|
|
33207
|
-
const expression = tagName.$expression;
|
|
33208
|
-
if (expression.operator === "?:") {
|
|
33209
|
-
return [...new Set([expression.value, expression.initial])];
|
|
33210
|
-
}
|
|
33211
|
-
return [...new Set([...Object.values(expression.cases), expression.default])];
|
|
33212
|
-
}
|
|
33213
|
-
var SCHEMA_KEYWORDS;
|
|
33214
|
-
var init_guards = __esm(() => {
|
|
33215
|
-
SCHEMA_KEYWORDS = new Set([
|
|
33216
|
-
"type",
|
|
33217
|
-
"enum",
|
|
33218
|
-
"minimum",
|
|
33219
|
-
"maximum",
|
|
33220
|
-
"minLength",
|
|
33221
|
-
"maxLength",
|
|
33222
|
-
"pattern",
|
|
33223
|
-
"format",
|
|
33224
|
-
"items",
|
|
33225
|
-
"properties",
|
|
33226
|
-
"required",
|
|
33227
|
-
"description",
|
|
33228
|
-
"title",
|
|
33229
|
-
"$comment"
|
|
33711
|
+
JX_TAG_MAP = new Map([
|
|
33712
|
+
["blockquote", () => "blockquote"],
|
|
33713
|
+
["break", () => "br"],
|
|
33714
|
+
["code", () => "pre"],
|
|
33715
|
+
["delete", () => "del"],
|
|
33716
|
+
["emphasis", () => "em"],
|
|
33717
|
+
["heading", (n) => `h${n.depth}`],
|
|
33718
|
+
["image", () => "img"],
|
|
33719
|
+
["inlineCode", () => "code"],
|
|
33720
|
+
["link", () => "a"],
|
|
33721
|
+
["list", (n) => n.ordered ? "ol" : "ul"],
|
|
33722
|
+
["listItem", () => "li"],
|
|
33723
|
+
["paragraph", () => "p"],
|
|
33724
|
+
["strong", () => "strong"],
|
|
33725
|
+
["table", () => "table"],
|
|
33726
|
+
["tableCell", (n) => n.isHeader ? "th" : "td"],
|
|
33727
|
+
["tableRow", () => "tr"],
|
|
33728
|
+
["thematicBreak", () => "hr"]
|
|
33230
33729
|
]);
|
|
33730
|
+
HEADING_TAGS = new Set(["h1", "h2", "h3", "h4", "h5", "h6"]);
|
|
33231
33731
|
});
|
|
33232
33732
|
|
|
33233
33733
|
// ../../node_modules/remark-stringify/lib/index.js
|
|
@@ -40244,7 +40744,13 @@ var init_dist3 = __esm(() => {
|
|
|
40244
40744
|
|
|
40245
40745
|
// src/serialize.ts
|
|
40246
40746
|
function textOf(el) {
|
|
40247
|
-
return el &&
|
|
40747
|
+
return el && isString(el.textContent) ? el.textContent : undefined;
|
|
40748
|
+
}
|
|
40749
|
+
function childList(el) {
|
|
40750
|
+
return Array.isArray(el.children) ? el.children : [];
|
|
40751
|
+
}
|
|
40752
|
+
function hasMdastType(tag) {
|
|
40753
|
+
return tag in TAG_MDAST_MAP;
|
|
40248
40754
|
}
|
|
40249
40755
|
function isInlineType(type) {
|
|
40250
40756
|
return ["text", "emphasis", "strong", "delete", "inlineCode", "link", "image", "break"].includes(type);
|
|
@@ -40254,14 +40760,23 @@ function codeLang(codeChild) {
|
|
|
40254
40760
|
const lang = String(cls).replace("language-", "");
|
|
40255
40761
|
return lang || null;
|
|
40256
40762
|
}
|
|
40763
|
+
function hasJxTagName(type) {
|
|
40764
|
+
return type in MDAST_TAG_MAP;
|
|
40765
|
+
}
|
|
40257
40766
|
function mdastToJx(mdast) {
|
|
40258
40767
|
if (mdast.type === "root") {
|
|
40259
40768
|
return {
|
|
40260
|
-
children: (mdast.children ?? []).filter((n) => n.type !== "yaml" && n.type !== "toml")
|
|
40769
|
+
children: convertMdastChildren((mdast.children ?? []).filter((n) => n.type !== "yaml" && n.type !== "toml"))
|
|
40261
40770
|
};
|
|
40262
40771
|
}
|
|
40263
40772
|
return convertMdastNode(mdast);
|
|
40264
40773
|
}
|
|
40774
|
+
function convertMdastChildren(nodes) {
|
|
40775
|
+
return nodes.flatMap((n) => {
|
|
40776
|
+
const converted = convertMdastNode(n);
|
|
40777
|
+
return converted ? [converted] : [];
|
|
40778
|
+
});
|
|
40779
|
+
}
|
|
40265
40780
|
function convertMdastNode(node) {
|
|
40266
40781
|
if (!node) {
|
|
40267
40782
|
return null;
|
|
@@ -40274,15 +40789,16 @@ function convertMdastNode(node) {
|
|
|
40274
40789
|
return null;
|
|
40275
40790
|
}
|
|
40276
40791
|
const nodes = htmlToJx(node.value);
|
|
40277
|
-
|
|
40792
|
+
const [only] = nodes;
|
|
40793
|
+
return nodes.length === 1 && only !== undefined ? only : { children: nodes, tagName: "div" };
|
|
40278
40794
|
}
|
|
40279
|
-
const tagFn = MDAST_TAG_MAP[node.type];
|
|
40795
|
+
const tagFn = hasJxTagName(node.type) ? MDAST_TAG_MAP[node.type] : undefined;
|
|
40280
40796
|
if (!tagFn) {
|
|
40281
40797
|
return null;
|
|
40282
40798
|
}
|
|
40283
40799
|
const tag = tagFn(node);
|
|
40284
40800
|
const el = { tagName: tag };
|
|
40285
|
-
const childNodes = () => (node.children ?? [])
|
|
40801
|
+
const childNodes = () => convertMdastChildren(node.children ?? []);
|
|
40286
40802
|
const flattenOrChildren = () => {
|
|
40287
40803
|
if (node.children?.length === 1 && node.children[0].type === "text") {
|
|
40288
40804
|
el.textContent = node.children[0].value ?? null;
|
|
@@ -40338,13 +40854,11 @@ function convertMdastNode(node) {
|
|
|
40338
40854
|
break;
|
|
40339
40855
|
}
|
|
40340
40856
|
case "code": {
|
|
40341
|
-
|
|
40342
|
-
|
|
40343
|
-
|
|
40344
|
-
|
|
40345
|
-
|
|
40346
|
-
}
|
|
40347
|
-
];
|
|
40857
|
+
const code = { tagName: "code", textContent: node.value ?? null };
|
|
40858
|
+
if (node.lang) {
|
|
40859
|
+
code.className = `language-${node.lang}`;
|
|
40860
|
+
}
|
|
40861
|
+
el.children = [code];
|
|
40348
40862
|
break;
|
|
40349
40863
|
}
|
|
40350
40864
|
case "thematicBreak":
|
|
@@ -40352,13 +40866,15 @@ function convertMdastNode(node) {
|
|
|
40352
40866
|
break;
|
|
40353
40867
|
}
|
|
40354
40868
|
case "table": {
|
|
40355
|
-
const
|
|
40356
|
-
const
|
|
40357
|
-
|
|
40358
|
-
children:
|
|
40359
|
-
|
|
40360
|
-
|
|
40361
|
-
|
|
40869
|
+
const [headRow, ...bodyRows] = childNodes();
|
|
40870
|
+
const sections = [];
|
|
40871
|
+
if (headRow !== undefined) {
|
|
40872
|
+
sections.push({ children: [headRow], tagName: "thead" });
|
|
40873
|
+
}
|
|
40874
|
+
if (bodyRows.length > 0) {
|
|
40875
|
+
sections.push({ children: bodyRows, tagName: "tbody" });
|
|
40876
|
+
}
|
|
40877
|
+
el.children = sections;
|
|
40362
40878
|
break;
|
|
40363
40879
|
}
|
|
40364
40880
|
default: {
|
|
@@ -40369,7 +40885,7 @@ function convertMdastNode(node) {
|
|
|
40369
40885
|
}
|
|
40370
40886
|
function convertDirective(node) {
|
|
40371
40887
|
if (node.name && PROTOTYPE_DIRECTIVE_NAMES2.has(node.name)) {
|
|
40372
|
-
return prototypeDirectiveToJx2(node);
|
|
40888
|
+
return prototypeDirectiveToJx2(node, node.name);
|
|
40373
40889
|
}
|
|
40374
40890
|
const el = { tagName: node.name ?? "div" };
|
|
40375
40891
|
if (node.attributes && Object.keys(node.attributes).length > 0) {
|
|
@@ -40379,15 +40895,15 @@ function convertDirective(node) {
|
|
|
40379
40895
|
if (node.children?.length === 1 && node.children[0].type === "text") {
|
|
40380
40896
|
el.textContent = node.children[0].value ?? null;
|
|
40381
40897
|
} else if (node.children?.length) {
|
|
40382
|
-
el.children = node.children
|
|
40898
|
+
el.children = convertMdastChildren(node.children);
|
|
40383
40899
|
}
|
|
40384
40900
|
} else if (node.type === "containerDirective" && node.children?.length) {
|
|
40385
|
-
el.children = node.children
|
|
40901
|
+
el.children = convertMdastChildren(node.children);
|
|
40386
40902
|
}
|
|
40387
40903
|
return el;
|
|
40388
40904
|
}
|
|
40389
|
-
function prototypeDirectiveToJx2(node) {
|
|
40390
|
-
const el = { $prototype:
|
|
40905
|
+
function prototypeDirectiveToJx2(node, name) {
|
|
40906
|
+
const el = { $prototype: name };
|
|
40391
40907
|
if (node.attributes && Object.keys(node.attributes).length > 0) {
|
|
40392
40908
|
const expanded = expandDotPaths(node.attributes);
|
|
40393
40909
|
for (const [key, value] of Object.entries(expanded)) {
|
|
@@ -40398,8 +40914,7 @@ function prototypeDirectiveToJx2(node) {
|
|
|
40398
40914
|
}
|
|
40399
40915
|
}
|
|
40400
40916
|
if (node.children?.length) {
|
|
40401
|
-
const
|
|
40402
|
-
const template = children.find((c) => c != null && typeof c === "object");
|
|
40917
|
+
const template = convertMdastChildren(node.children).find((child) => isNodeObject(child));
|
|
40403
40918
|
if (template) {
|
|
40404
40919
|
el.map = template;
|
|
40405
40920
|
}
|
|
@@ -40408,9 +40923,19 @@ function prototypeDirectiveToJx2(node) {
|
|
|
40408
40923
|
}
|
|
40409
40924
|
function jxToMdast(jx, opts = {}) {
|
|
40410
40925
|
const allowlist = normalizeAllowlist(opts.allowlist);
|
|
40411
|
-
|
|
40412
|
-
|
|
40413
|
-
|
|
40926
|
+
return { children: convertJxChildren(childList(jx), true, allowlist), type: "root" };
|
|
40927
|
+
}
|
|
40928
|
+
function convertJxChildren(children, isBlock, allowlist) {
|
|
40929
|
+
return children.flatMap((child) => {
|
|
40930
|
+
const converted = convertJxNode(child, isBlock, allowlist);
|
|
40931
|
+
return converted ? [converted] : [];
|
|
40932
|
+
});
|
|
40933
|
+
}
|
|
40934
|
+
function attributeText(value) {
|
|
40935
|
+
return isString(value) ? value : value ? String(value) : "";
|
|
40936
|
+
}
|
|
40937
|
+
function attributeTitle(value) {
|
|
40938
|
+
return isString(value) ? value : value ? String(value) : null;
|
|
40414
40939
|
}
|
|
40415
40940
|
function normalizeAllowlist(allowlist) {
|
|
40416
40941
|
if (!allowlist) {
|
|
@@ -40427,18 +40952,19 @@ function hasJxProps(el) {
|
|
|
40427
40952
|
}
|
|
40428
40953
|
return false;
|
|
40429
40954
|
}
|
|
40430
|
-
function convertJxNode(
|
|
40431
|
-
if (
|
|
40432
|
-
return { type: "text", value: String(
|
|
40955
|
+
function convertJxNode(slot, isBlock, allowlist) {
|
|
40956
|
+
if (isString(slot) || isNumber(slot)) {
|
|
40957
|
+
return { type: "text", value: String(slot) };
|
|
40433
40958
|
}
|
|
40434
|
-
if (!
|
|
40959
|
+
if (!isNonNullObject(slot)) {
|
|
40435
40960
|
return null;
|
|
40436
40961
|
}
|
|
40962
|
+
const el = slot;
|
|
40437
40963
|
const tag = serializableTag(el.tagName) || "div";
|
|
40438
40964
|
if (!allowlist.has(tag) || hasJxProps(el)) {
|
|
40439
40965
|
return convertToDirective(el, isBlock, allowlist);
|
|
40440
40966
|
}
|
|
40441
|
-
const mdastType = TAG_MDAST_MAP[tag];
|
|
40967
|
+
const mdastType = hasMdastType(tag) ? TAG_MDAST_MAP[tag] : undefined;
|
|
40442
40968
|
if (!mdastType) {
|
|
40443
40969
|
return null;
|
|
40444
40970
|
}
|
|
@@ -40446,7 +40972,7 @@ function convertJxNode(el, isBlock, allowlist) {
|
|
|
40446
40972
|
if (e.textContent != null) {
|
|
40447
40973
|
return [{ type: "text", value: String(e.textContent) }];
|
|
40448
40974
|
}
|
|
40449
|
-
return (e
|
|
40975
|
+
return convertJxChildren(childList(e), false, allowlist);
|
|
40450
40976
|
};
|
|
40451
40977
|
const block = (e) => {
|
|
40452
40978
|
if (e.textContent != null) {
|
|
@@ -40457,7 +40983,7 @@ function convertJxNode(el, isBlock, allowlist) {
|
|
|
40457
40983
|
}
|
|
40458
40984
|
];
|
|
40459
40985
|
}
|
|
40460
|
-
return (e
|
|
40986
|
+
return convertJxChildren(childList(e), true, allowlist);
|
|
40461
40987
|
};
|
|
40462
40988
|
switch (mdastType) {
|
|
40463
40989
|
case "heading": {
|
|
@@ -40484,17 +41010,17 @@ function convertJxNode(el, isBlock, allowlist) {
|
|
|
40484
41010
|
case "link": {
|
|
40485
41011
|
return {
|
|
40486
41012
|
children: inline(el),
|
|
40487
|
-
title: el.attributes?.title
|
|
41013
|
+
title: attributeTitle(el.attributes?.title),
|
|
40488
41014
|
type: "link",
|
|
40489
|
-
url: el.attributes?.href
|
|
41015
|
+
url: attributeText(el.attributes?.href)
|
|
40490
41016
|
};
|
|
40491
41017
|
}
|
|
40492
41018
|
case "image": {
|
|
40493
41019
|
return {
|
|
40494
|
-
alt: el.attributes?.alt
|
|
40495
|
-
title: el.attributes?.title
|
|
41020
|
+
alt: attributeText(el.attributes?.alt),
|
|
41021
|
+
title: attributeTitle(el.attributes?.title),
|
|
40496
41022
|
type: "image",
|
|
40497
|
-
url: el.attributes?.src
|
|
41023
|
+
url: attributeText(el.attributes?.src)
|
|
40498
41024
|
};
|
|
40499
41025
|
}
|
|
40500
41026
|
case "blockquote": {
|
|
@@ -40502,7 +41028,7 @@ function convertJxNode(el, isBlock, allowlist) {
|
|
|
40502
41028
|
}
|
|
40503
41029
|
case "list": {
|
|
40504
41030
|
return {
|
|
40505
|
-
children: (el
|
|
41031
|
+
children: convertJxChildren(childList(el), true, allowlist),
|
|
40506
41032
|
ordered: tag === "ol",
|
|
40507
41033
|
spread: false,
|
|
40508
41034
|
start: tag === "ol" ? Math.trunc(Number(el.attributes?.start)) || 1 : null,
|
|
@@ -40513,7 +41039,8 @@ function convertJxNode(el, isBlock, allowlist) {
|
|
|
40513
41039
|
return { children: block(el), spread: false, type: "listItem" };
|
|
40514
41040
|
}
|
|
40515
41041
|
case "code": {
|
|
40516
|
-
const
|
|
41042
|
+
const [first] = childList(el);
|
|
41043
|
+
const codeChild = isString(first) ? undefined : first;
|
|
40517
41044
|
return {
|
|
40518
41045
|
lang: codeLang(codeChild),
|
|
40519
41046
|
type: "code",
|
|
@@ -40528,12 +41055,12 @@ function convertJxNode(el, isBlock, allowlist) {
|
|
|
40528
41055
|
}
|
|
40529
41056
|
case "table": {
|
|
40530
41057
|
const rows = [];
|
|
40531
|
-
for (const section of el
|
|
40532
|
-
if (
|
|
41058
|
+
for (const section of childList(el)) {
|
|
41059
|
+
if (isString(section)) {
|
|
40533
41060
|
continue;
|
|
40534
41061
|
}
|
|
40535
41062
|
if (section.tagName === "thead" || section.tagName === "tbody") {
|
|
40536
|
-
for (const row of section
|
|
41063
|
+
for (const row of childList(section)) {
|
|
40537
41064
|
const mdRow = convertJxNode(row, true, allowlist);
|
|
40538
41065
|
if (mdRow) {
|
|
40539
41066
|
if (section.tagName === "thead") {
|
|
@@ -40550,7 +41077,7 @@ function convertJxNode(el, isBlock, allowlist) {
|
|
|
40550
41077
|
}
|
|
40551
41078
|
case "tableRow": {
|
|
40552
41079
|
return {
|
|
40553
|
-
children: (el
|
|
41080
|
+
children: convertJxChildren(childList(el), false, allowlist),
|
|
40554
41081
|
type: "tableRow"
|
|
40555
41082
|
};
|
|
40556
41083
|
}
|
|
@@ -40564,7 +41091,7 @@ function convertJxNode(el, isBlock, allowlist) {
|
|
|
40564
41091
|
return null;
|
|
40565
41092
|
}
|
|
40566
41093
|
function serializableTag(tagName) {
|
|
40567
|
-
if (
|
|
41094
|
+
if (isString(tagName)) {
|
|
40568
41095
|
return tagName;
|
|
40569
41096
|
}
|
|
40570
41097
|
if (tagName == null) {
|
|
@@ -40579,7 +41106,7 @@ function collectDirectiveAttrs(el) {
|
|
|
40579
41106
|
continue;
|
|
40580
41107
|
}
|
|
40581
41108
|
if (key === "children") {
|
|
40582
|
-
if (
|
|
41109
|
+
if (isJsonObject(value)) {
|
|
40583
41110
|
propsObj.children = value;
|
|
40584
41111
|
}
|
|
40585
41112
|
continue;
|
|
@@ -40594,22 +41121,20 @@ function collectDirectiveAttrs(el) {
|
|
|
40594
41121
|
return collapsePropsToAttrMap(propsObj);
|
|
40595
41122
|
}
|
|
40596
41123
|
function convertToDirective(el, isBlock, allowlist) {
|
|
40597
|
-
if (!el.tagName &&
|
|
40598
|
-
return prototypeToDirective(el, isBlock, allowlist);
|
|
41124
|
+
if (!el.tagName && isString(el.$prototype) && PROTOTYPE_DIRECTIVE_NAMES2.has(el.$prototype)) {
|
|
41125
|
+
return prototypeToDirective(el, el.$prototype, isBlock, allowlist);
|
|
40599
41126
|
}
|
|
40600
|
-
const tag = el.tagName
|
|
41127
|
+
const tag = isString(el.tagName) ? el.tagName : "div";
|
|
40601
41128
|
const attrs = collectDirectiveAttrs(el);
|
|
40602
41129
|
if (!isBlock) {
|
|
40603
41130
|
return {
|
|
40604
41131
|
attributes: attrs,
|
|
40605
|
-
children: el.textContent != null ? [{ type: "text", value: String(el.textContent) }] : (el
|
|
41132
|
+
children: el.textContent != null ? [{ type: "text", value: String(el.textContent) }] : convertJxChildren(childList(el), false, allowlist),
|
|
40606
41133
|
name: tag,
|
|
40607
41134
|
type: "textDirective"
|
|
40608
41135
|
};
|
|
40609
41136
|
}
|
|
40610
|
-
const
|
|
40611
|
-
const childrenIsObject = rawChildren && typeof rawChildren === "object" && !Array.isArray(rawChildren);
|
|
40612
|
-
const childArray = childrenIsObject ? undefined : rawChildren;
|
|
41137
|
+
const childArray = Array.isArray(el.children) ? el.children : undefined;
|
|
40613
41138
|
if (!childArray?.length && el.textContent == null) {
|
|
40614
41139
|
return {
|
|
40615
41140
|
attributes: attrs,
|
|
@@ -40627,10 +41152,10 @@ function convertToDirective(el, isBlock, allowlist) {
|
|
|
40627
41152
|
}
|
|
40628
41153
|
];
|
|
40629
41154
|
} else if (INLINE_CONTENT_TAGS.has(tag)) {
|
|
40630
|
-
const inlineNodes = (el
|
|
41155
|
+
const inlineNodes = convertJxChildren(childList(el), false, allowlist);
|
|
40631
41156
|
directiveChildren = inlineNodes.length > 0 ? [{ children: inlineNodes, type: "paragraph" }] : [];
|
|
40632
41157
|
} else {
|
|
40633
|
-
directiveChildren = (el
|
|
41158
|
+
directiveChildren = convertJxChildren(childList(el), true, allowlist);
|
|
40634
41159
|
}
|
|
40635
41160
|
return {
|
|
40636
41161
|
attributes: attrs,
|
|
@@ -40639,7 +41164,7 @@ function convertToDirective(el, isBlock, allowlist) {
|
|
|
40639
41164
|
type: "containerDirective"
|
|
40640
41165
|
};
|
|
40641
41166
|
}
|
|
40642
|
-
function prototypeToDirective(el, isBlock, allowlist) {
|
|
41167
|
+
function prototypeToDirective(el, prototype, isBlock, allowlist) {
|
|
40643
41168
|
const propsObj = {};
|
|
40644
41169
|
for (const [key, value] of Object.entries(el)) {
|
|
40645
41170
|
if (key === "$prototype" || key === "map" || key === "tagName") {
|
|
@@ -40653,7 +41178,7 @@ function prototypeToDirective(el, isBlock, allowlist) {
|
|
|
40653
41178
|
return {
|
|
40654
41179
|
attributes: attrs,
|
|
40655
41180
|
children,
|
|
40656
|
-
name:
|
|
41181
|
+
name: prototype,
|
|
40657
41182
|
type: isBlock ? "containerDirective" : "textDirective"
|
|
40658
41183
|
};
|
|
40659
41184
|
}
|
|
@@ -40672,7 +41197,7 @@ function collapsePropsToAttrMap(propsObj) {
|
|
|
40672
41197
|
mdAttrKey = key.slice(1);
|
|
40673
41198
|
}
|
|
40674
41199
|
if (key === "@") {
|
|
40675
|
-
if (
|
|
41200
|
+
if (isJsonObject(value)) {
|
|
40676
41201
|
walk(value, prefix);
|
|
40677
41202
|
}
|
|
40678
41203
|
continue;
|
|
@@ -40681,7 +41206,7 @@ function collapsePropsToAttrMap(propsObj) {
|
|
|
40681
41206
|
mdAttrKey = key.slice(1);
|
|
40682
41207
|
}
|
|
40683
41208
|
const fullKey = prefix ? `${prefix}.${mdAttrKey}` : mdAttrKey;
|
|
40684
|
-
if (
|
|
41209
|
+
if (isJsonObject(value)) {
|
|
40685
41210
|
walk(value, fullKey);
|
|
40686
41211
|
} else {
|
|
40687
41212
|
result[fullKey] = String(value);
|
|
@@ -40692,13 +41217,13 @@ function collapsePropsToAttrMap(propsObj) {
|
|
|
40692
41217
|
return result;
|
|
40693
41218
|
}
|
|
40694
41219
|
function nodeToMdast(node, ctx, scope) {
|
|
40695
|
-
if (
|
|
41220
|
+
if (isString(node)) {
|
|
40696
41221
|
return node.trim() ? [{ type: "text", value: node }] : [];
|
|
40697
41222
|
}
|
|
40698
|
-
if (
|
|
41223
|
+
if (isNumber(node)) {
|
|
40699
41224
|
return [{ type: "text", value: String(node) }];
|
|
40700
41225
|
}
|
|
40701
|
-
if (!node
|
|
41226
|
+
if (!isNodeObject(node)) {
|
|
40702
41227
|
return [];
|
|
40703
41228
|
}
|
|
40704
41229
|
if (node.$prototype === "Array") {
|
|
@@ -40706,7 +41231,7 @@ function nodeToMdast(node, ctx, scope) {
|
|
|
40706
41231
|
}
|
|
40707
41232
|
const tag = serializableTag(node.tagName) || "div";
|
|
40708
41233
|
const text = resolveText(node.textContent, ctx, scope);
|
|
40709
|
-
if (
|
|
41234
|
+
if (isString(node.innerHTML) && node.innerHTML.trim()) {
|
|
40710
41235
|
const htmlNodes = htmlToMdast(node.innerHTML);
|
|
40711
41236
|
if (htmlNodes.length > 0) {
|
|
40712
41237
|
return htmlNodes;
|
|
@@ -40721,7 +41246,7 @@ function nodeToMdast(node, ctx, scope) {
|
|
|
40721
41246
|
}
|
|
40722
41247
|
return exportChildren(node, ctx, scope);
|
|
40723
41248
|
}
|
|
40724
|
-
const mdastType = TAG_MDAST_MAP[tag];
|
|
41249
|
+
const mdastType = hasMdastType(tag) ? TAG_MDAST_MAP[tag] : undefined;
|
|
40725
41250
|
if (!mdastType) {
|
|
40726
41251
|
if (text != null) {
|
|
40727
41252
|
return text.trim() ? [{ children: [{ type: "text", value: text }], type: "paragraph" }] : [];
|
|
@@ -40752,14 +41277,14 @@ function nodeToMdast(node, ctx, scope) {
|
|
|
40752
41277
|
}
|
|
40753
41278
|
case "link": {
|
|
40754
41279
|
const href = String(node.attributes?.href ?? "");
|
|
40755
|
-
const title = node.attributes?.title
|
|
41280
|
+
const title = attributeTitle(node.attributes?.title);
|
|
40756
41281
|
const children = text != null ? [{ type: "text", value: text }] : exportChildren(node, ctx, scope);
|
|
40757
41282
|
return [{ children, title, type: "link", url: href }];
|
|
40758
41283
|
}
|
|
40759
41284
|
case "image": {
|
|
40760
41285
|
const src = String(node.attributes?.src ?? "");
|
|
40761
41286
|
const alt = String(node.attributes?.alt ?? "");
|
|
40762
|
-
const title = node.attributes?.title
|
|
41287
|
+
const title = attributeTitle(node.attributes?.title);
|
|
40763
41288
|
return [{ alt, title, type: "image", url: src }];
|
|
40764
41289
|
}
|
|
40765
41290
|
case "blockquote": {
|
|
@@ -40784,7 +41309,7 @@ function nodeToMdast(node, ctx, scope) {
|
|
|
40784
41309
|
return [{ children, spread: false, type: "listItem" }];
|
|
40785
41310
|
}
|
|
40786
41311
|
case "code": {
|
|
40787
|
-
const codeChild =
|
|
41312
|
+
const codeChild = childList(node).find((c) => isNodeObject(c) && c.tagName === "code");
|
|
40788
41313
|
const value = textOf(codeChild) ?? text ?? "";
|
|
40789
41314
|
return [
|
|
40790
41315
|
{
|
|
@@ -40853,7 +41378,7 @@ function inlineComponent(node, tag, ctx) {
|
|
|
40853
41378
|
for (const [key, value] of Object.entries(props)) {
|
|
40854
41379
|
if (key in stateDefs) {
|
|
40855
41380
|
const existing = stateDefs[key];
|
|
40856
|
-
stateDefs[key] =
|
|
41381
|
+
stateDefs[key] = isJsonObject(existing) && "default" in existing ? { ...existing, default: value } : value;
|
|
40857
41382
|
} else {
|
|
40858
41383
|
stateDefs[key] = value;
|
|
40859
41384
|
}
|
|
@@ -40865,7 +41390,7 @@ function inlineComponent(node, tag, ctx) {
|
|
|
40865
41390
|
const resolved = deepResolve(def.children, scope ?? {}, ctx);
|
|
40866
41391
|
const instanceChildren = node.children;
|
|
40867
41392
|
return resolved.flatMap((child) => {
|
|
40868
|
-
if (
|
|
41393
|
+
if (isNodeObject(child) && child.tagName === "slot" && Array.isArray(instanceChildren)) {
|
|
40869
41394
|
return instanceChildren.flatMap((c) => nodeToMdast(c, ctx));
|
|
40870
41395
|
}
|
|
40871
41396
|
return nodeToMdast(child, ctx, scope);
|
|
@@ -40875,21 +41400,21 @@ function deepResolve(nodes, scope, ctx) {
|
|
|
40875
41400
|
return nodes.map((node) => resolveNode(node, scope, ctx));
|
|
40876
41401
|
}
|
|
40877
41402
|
function resolveNode(node, scope, ctx) {
|
|
40878
|
-
if (
|
|
41403
|
+
if (isString(node)) {
|
|
40879
41404
|
const evaluated = ctx.evaluateTemplate?.(node, scope);
|
|
40880
41405
|
return evaluated !== undefined ? String(evaluated) : node;
|
|
40881
41406
|
}
|
|
40882
|
-
if (!node
|
|
41407
|
+
if (!isNonNullObject(node)) {
|
|
40883
41408
|
return node;
|
|
40884
41409
|
}
|
|
40885
41410
|
const result = { ...node };
|
|
40886
|
-
if (
|
|
41411
|
+
if (isString(result.textContent)) {
|
|
40887
41412
|
const evaluated = ctx.evaluateTemplate?.(result.textContent, scope);
|
|
40888
41413
|
if (evaluated !== undefined) {
|
|
40889
41414
|
result.textContent = String(evaluated);
|
|
40890
41415
|
}
|
|
40891
41416
|
}
|
|
40892
|
-
if (
|
|
41417
|
+
if (isString(result.innerHTML)) {
|
|
40893
41418
|
const evaluated = ctx.evaluateTemplate?.(result.innerHTML, scope);
|
|
40894
41419
|
if (evaluated !== undefined) {
|
|
40895
41420
|
result.innerHTML = String(evaluated);
|
|
@@ -40898,7 +41423,7 @@ function resolveNode(node, scope, ctx) {
|
|
|
40898
41423
|
if (result.attributes) {
|
|
40899
41424
|
result.attributes = { ...result.attributes };
|
|
40900
41425
|
for (const [k, v] of Object.entries(result.attributes)) {
|
|
40901
|
-
if (
|
|
41426
|
+
if (isString(v)) {
|
|
40902
41427
|
const evaluated = ctx.evaluateTemplate?.(v, scope);
|
|
40903
41428
|
if (evaluated !== undefined) {
|
|
40904
41429
|
result.attributes[k] = evaluated;
|
|
@@ -40925,42 +41450,33 @@ function expandArray(arrayDef, ctx, scope) {
|
|
|
40925
41450
|
if (!mapTemplate) {
|
|
40926
41451
|
return [];
|
|
40927
41452
|
}
|
|
40928
|
-
return items.flatMap((
|
|
40929
|
-
const resolved = resolveMapNode(mapTemplate,
|
|
41453
|
+
return items.flatMap((row) => {
|
|
41454
|
+
const resolved = isNodeObject(mapTemplate) ? resolveMapNode(mapTemplate, row) : mapTemplate;
|
|
40930
41455
|
return nodeToMdast(resolved, ctx, scope);
|
|
40931
41456
|
});
|
|
40932
41457
|
}
|
|
40933
|
-
function resolveMapNode(node,
|
|
40934
|
-
if (typeof node === "string") {
|
|
40935
|
-
return node;
|
|
40936
|
-
}
|
|
40937
|
-
if (!node || typeof node !== "object") {
|
|
40938
|
-
return node;
|
|
40939
|
-
}
|
|
41458
|
+
function resolveMapNode(node, row) {
|
|
40940
41459
|
const result = { ...node };
|
|
40941
41460
|
for (const [key, value] of Object.entries(result)) {
|
|
40942
|
-
if (value &&
|
|
40943
|
-
const
|
|
40944
|
-
|
|
40945
|
-
const path = ref.slice("$map/".length);
|
|
40946
|
-
result[key] = resolvePath(item, path.startsWith("item/") ? path.slice("item/".length) : path);
|
|
40947
|
-
}
|
|
41461
|
+
if (isRef(value) && value.$ref.startsWith("$map/")) {
|
|
41462
|
+
const path = value.$ref.slice("$map/".length);
|
|
41463
|
+
result[key] = resolvePath(row, path.startsWith("item/") ? path.slice("item/".length) : path);
|
|
40948
41464
|
}
|
|
40949
41465
|
}
|
|
40950
|
-
if (result.$props) {
|
|
40951
|
-
result.$props = resolveMapNode(result.$props,
|
|
41466
|
+
if (isNodeObject(result.$props)) {
|
|
41467
|
+
result.$props = resolveMapNode(result.$props, row);
|
|
40952
41468
|
}
|
|
40953
|
-
if (
|
|
40954
|
-
result.textContent = resolvePath(
|
|
41469
|
+
if (isString(result.textContent) && result.textContent.startsWith("$map/")) {
|
|
41470
|
+
result.textContent = resolvePath(row, result.textContent.slice("$map/".length));
|
|
40955
41471
|
}
|
|
40956
41472
|
if (Array.isArray(result.children)) {
|
|
40957
|
-
result.children = result.children.map((c) => resolveMapNode(c,
|
|
41473
|
+
result.children = result.children.map((c) => isNodeObject(c) ? resolveMapNode(c, row) : c);
|
|
40958
41474
|
}
|
|
40959
41475
|
return result;
|
|
40960
41476
|
}
|
|
40961
|
-
function resolvePath(
|
|
41477
|
+
function resolvePath(root, path) {
|
|
40962
41478
|
const parts = path.split(/[/.]/);
|
|
40963
|
-
let current =
|
|
41479
|
+
let current = root;
|
|
40964
41480
|
for (const part of parts) {
|
|
40965
41481
|
if (current == null) {
|
|
40966
41482
|
return;
|
|
@@ -40970,16 +41486,14 @@ function resolvePath(obj, path) {
|
|
|
40970
41486
|
return current;
|
|
40971
41487
|
}
|
|
40972
41488
|
function resolveRef(ref, scope) {
|
|
40973
|
-
|
|
40974
|
-
|
|
40975
|
-
}
|
|
40976
|
-
return resolvePath(scope, ref);
|
|
41489
|
+
const path = ref.startsWith("#/state/") ? ref.slice("#/state/".length) : ref;
|
|
41490
|
+
return resolvePath(scope, path);
|
|
40977
41491
|
}
|
|
40978
41492
|
function resolveText(value, ctx, scope) {
|
|
40979
41493
|
if (value == null) {
|
|
40980
41494
|
return null;
|
|
40981
41495
|
}
|
|
40982
|
-
if (
|
|
41496
|
+
if (isString(value)) {
|
|
40983
41497
|
if (scope) {
|
|
40984
41498
|
const evaluated = ctx.evaluateTemplate?.(value, scope);
|
|
40985
41499
|
if (evaluated !== undefined) {
|
|
@@ -41254,6 +41768,9 @@ function serializeJxMarkdown(doc, opts = {}) {
|
|
|
41254
41768
|
}
|
|
41255
41769
|
return serializeRoundtrip(doc, opts);
|
|
41256
41770
|
}
|
|
41771
|
+
function createProcessor() {
|
|
41772
|
+
return unified();
|
|
41773
|
+
}
|
|
41257
41774
|
function serializeRoundtrip(doc, opts) {
|
|
41258
41775
|
const lines = [];
|
|
41259
41776
|
if (opts.frontmatter !== false) {
|
|
@@ -41270,7 +41787,7 @@ function serializeRoundtrip(doc, opts) {
|
|
|
41270
41787
|
}
|
|
41271
41788
|
if (Array.isArray(doc.children) && doc.children.length > 0) {
|
|
41272
41789
|
const mdast = jxToMdast(doc, opts);
|
|
41273
|
-
const processor =
|
|
41790
|
+
const processor = createProcessor().use(remarkGfm).use(remarkDirective).use(remarkStringifyPlugin, { bullet: "-", emphasis: "*", strong: "*" });
|
|
41274
41791
|
const md = processor.stringify(mdast);
|
|
41275
41792
|
lines.push(md);
|
|
41276
41793
|
}
|
|
@@ -41312,7 +41829,7 @@ function serializeExport(doc, opts) {
|
|
|
41312
41829
|
children: cleaned,
|
|
41313
41830
|
type: "root"
|
|
41314
41831
|
};
|
|
41315
|
-
const processor =
|
|
41832
|
+
const processor = createProcessor().use(remarkGfm).use(remarkStringifyPlugin, {
|
|
41316
41833
|
bullet: "-",
|
|
41317
41834
|
emphasis: "*",
|
|
41318
41835
|
setext: false,
|
|
@@ -41324,7 +41841,7 @@ function serializeExport(doc, opts) {
|
|
|
41324
41841
|
`).trim()}
|
|
41325
41842
|
`;
|
|
41326
41843
|
}
|
|
41327
|
-
var MD_ELEMENTS, MD_BLOCK, MD_INLINE, MD_ALL, MD_VOID, MD_TEXT_ONLY, TAG_MDAST_MAP, WRAPPER_TAGS, INLINE_CONTENT_TAGS, MDAST_TAG_MAP, CSS_PSEUDO_NAMES2, JX_DOLLAR_KEYS2, PROTOTYPE_DIRECTIVE_NAMES2, JX_ANNOTATION_KEYS2;
|
|
41844
|
+
var MD_ELEMENTS, MD_BLOCK, MD_INLINE, MD_ALL, MD_VOID, MD_TEXT_ONLY, TAG_MDAST_MAP, WRAPPER_TAGS, INLINE_CONTENT_TAGS, MDAST_TAG_MAP, CSS_PSEUDO_NAMES2, JX_DOLLAR_KEYS2, PROTOTYPE_DIRECTIVE_NAMES2, JX_ANNOTATION_KEYS2, remarkStringifyPlugin;
|
|
41328
41845
|
var init_serialize = __esm(() => {
|
|
41329
41846
|
init_unified();
|
|
41330
41847
|
init_guards();
|
|
@@ -41498,6 +42015,7 @@ var init_serialize = __esm(() => {
|
|
|
41498
42015
|
]);
|
|
41499
42016
|
PROTOTYPE_DIRECTIVE_NAMES2 = new Set(["Array"]);
|
|
41500
42017
|
JX_ANNOTATION_KEYS2 = new Set(["$title", "$description"]);
|
|
42018
|
+
remarkStringifyPlugin = remarkStringify;
|
|
41501
42019
|
});
|
|
41502
42020
|
|
|
41503
42021
|
// src/walk.ts
|
|
@@ -48310,12 +48828,12 @@ var init_siblings = __esm(() => {
|
|
|
48310
48828
|
function omission(handlers) {
|
|
48311
48829
|
return omit;
|
|
48312
48830
|
function omit(node, index, parent) {
|
|
48313
|
-
return
|
|
48831
|
+
return own11.call(handlers, node.tagName) && handlers[node.tagName](node, index, parent);
|
|
48314
48832
|
}
|
|
48315
48833
|
}
|
|
48316
|
-
var
|
|
48834
|
+
var own11;
|
|
48317
48835
|
var init_omission = __esm(() => {
|
|
48318
|
-
|
|
48836
|
+
own11 = {}.hasOwnProperty;
|
|
48319
48837
|
});
|
|
48320
48838
|
|
|
48321
48839
|
// ../../node_modules/hast-util-to-html/lib/omission/closing.js
|
|
@@ -53473,17 +53991,17 @@ function highlightFence(code, info) {
|
|
|
53473
53991
|
}
|
|
53474
53992
|
function highlightCodeBlocks(nodes) {
|
|
53475
53993
|
for (const node of nodes) {
|
|
53476
|
-
if (!node
|
|
53994
|
+
if (!isNonNullObject(node)) {
|
|
53477
53995
|
continue;
|
|
53478
53996
|
}
|
|
53479
53997
|
if (node.tagName === "pre" && Array.isArray(node.children)) {
|
|
53480
53998
|
for (const child of node.children) {
|
|
53481
|
-
if (!child ||
|
|
53999
|
+
if (!isNonNullObject(child) || child.tagName !== "code") {
|
|
53482
54000
|
continue;
|
|
53483
54001
|
}
|
|
53484
54002
|
const lang = /^language-(\S+)/.exec(child.className ?? "")?.[1];
|
|
53485
54003
|
const code = child.textContent;
|
|
53486
|
-
if (!lang ||
|
|
54004
|
+
if (!lang || !isString(code) || code.length === 0) {
|
|
53487
54005
|
continue;
|
|
53488
54006
|
}
|
|
53489
54007
|
const spans = highlightFence(code, lang);
|
|
@@ -53527,6 +54045,7 @@ var init_highlight = __esm(() => {
|
|
|
53527
54045
|
init_typescript();
|
|
53528
54046
|
init_xml2();
|
|
53529
54047
|
init_yaml();
|
|
54048
|
+
init_guards();
|
|
53530
54049
|
init_caddyfile();
|
|
53531
54050
|
THEMES = { dark: "github-dark-default", light: "github-light-default" };
|
|
53532
54051
|
});
|
|
@@ -53540,7 +54059,7 @@ function neutralizeTemplateAttribute(value) {
|
|
|
53540
54059
|
}
|
|
53541
54060
|
function makeTemplatesInert(nodes) {
|
|
53542
54061
|
for (const [i, node] of nodes.entries()) {
|
|
53543
|
-
if (
|
|
54062
|
+
if (isString(node)) {
|
|
53544
54063
|
if (node.includes("${")) {
|
|
53545
54064
|
nodes[i] = { innerHTML: escapeTemplateText(node), tagName: "span" };
|
|
53546
54065
|
}
|
|
@@ -53550,10 +54069,10 @@ function makeTemplatesInert(nodes) {
|
|
|
53550
54069
|
makeTemplatesInert(node);
|
|
53551
54070
|
continue;
|
|
53552
54071
|
}
|
|
53553
|
-
if (
|
|
54072
|
+
if (!isNonNullObject(node)) {
|
|
53554
54073
|
continue;
|
|
53555
54074
|
}
|
|
53556
|
-
if (
|
|
54075
|
+
if (isString(node.textContent) && node.textContent.includes("${")) {
|
|
53557
54076
|
node.innerHTML = escapeTemplateText(node.textContent);
|
|
53558
54077
|
delete node.textContent;
|
|
53559
54078
|
}
|
|
@@ -53561,7 +54080,7 @@ function makeTemplatesInert(nodes) {
|
|
|
53561
54080
|
if (attributes) {
|
|
53562
54081
|
for (const name of PROSE_ATTRIBUTES) {
|
|
53563
54082
|
const value = attributes[name];
|
|
53564
|
-
if (
|
|
54083
|
+
if (isString(value) && value.includes("${")) {
|
|
53565
54084
|
attributes[name] = neutralizeTemplateAttribute(value);
|
|
53566
54085
|
}
|
|
53567
54086
|
}
|
|
@@ -53573,36 +54092,25 @@ function makeTemplatesInert(nodes) {
|
|
|
53573
54092
|
}
|
|
53574
54093
|
var PROSE_ATTRIBUTES;
|
|
53575
54094
|
var init_inert = __esm(() => {
|
|
54095
|
+
init_guards();
|
|
53576
54096
|
PROSE_ATTRIBUTES = ["alt", "title", "data-title"];
|
|
53577
54097
|
});
|
|
53578
54098
|
|
|
53579
54099
|
// src/md.ts
|
|
53580
|
-
import { basename as basename2, extname, relative, resolve
|
|
53581
|
-
function
|
|
53582
|
-
|
|
53583
|
-
|
|
53584
|
-
|
|
53585
|
-
|
|
53586
|
-
|
|
53587
|
-
|
|
53588
|
-
|
|
53589
|
-
visitor(node);
|
|
53590
|
-
}
|
|
53591
|
-
if (Array.isArray(node.children)) {
|
|
53592
|
-
for (const child of node.children) {
|
|
53593
|
-
walk(child);
|
|
53594
|
-
}
|
|
54100
|
+
import { basename as basename2, extname, relative, resolve } from "node:path";
|
|
54101
|
+
function findFirst(node, type) {
|
|
54102
|
+
if (node.type === type) {
|
|
54103
|
+
return node;
|
|
54104
|
+
}
|
|
54105
|
+
for (const child of node.children ?? []) {
|
|
54106
|
+
const found = findFirst(child, type);
|
|
54107
|
+
if (found) {
|
|
54108
|
+
return found;
|
|
53595
54109
|
}
|
|
53596
54110
|
}
|
|
53597
|
-
|
|
54111
|
+
return null;
|
|
53598
54112
|
}
|
|
53599
54113
|
function mdastToString(node) {
|
|
53600
|
-
if (!node) {
|
|
53601
|
-
return "";
|
|
53602
|
-
}
|
|
53603
|
-
if (typeof node === "string") {
|
|
53604
|
-
return node;
|
|
53605
|
-
}
|
|
53606
54114
|
if (node.value) {
|
|
53607
54115
|
return node.value;
|
|
53608
54116
|
}
|
|
@@ -53624,12 +54132,7 @@ function readingTime(text) {
|
|
|
53624
54132
|
return Math.max(1, Math.ceil(countWords(text) / WORDS_PER_MINUTE));
|
|
53625
54133
|
}
|
|
53626
54134
|
function extractExcerpt(tree) {
|
|
53627
|
-
|
|
53628
|
-
visit3(tree, "paragraph", (node) => {
|
|
53629
|
-
if (!firstParagraph) {
|
|
53630
|
-
firstParagraph = node;
|
|
53631
|
-
}
|
|
53632
|
-
});
|
|
54135
|
+
const firstParagraph = findFirst(tree, "paragraph");
|
|
53633
54136
|
if (!firstParagraph) {
|
|
53634
54137
|
return "";
|
|
53635
54138
|
}
|
|
@@ -53648,8 +54151,37 @@ function deriveSlug(filePath, sourceRoot) {
|
|
|
53648
54151
|
}
|
|
53649
54152
|
return basename2(filePath, extname(filePath));
|
|
53650
54153
|
}
|
|
54154
|
+
function frontmatterEnd(source) {
|
|
54155
|
+
const firstBreak = source.indexOf(`
|
|
54156
|
+
`);
|
|
54157
|
+
if (firstBreak === -1 || !FENCE_LINE.test(source.slice(0, firstBreak))) {
|
|
54158
|
+
return 0;
|
|
54159
|
+
}
|
|
54160
|
+
let start = firstBreak + 1;
|
|
54161
|
+
while (start < source.length) {
|
|
54162
|
+
const lineEnd = source.indexOf(`
|
|
54163
|
+
`, start);
|
|
54164
|
+
const end = lineEnd === -1 ? source.length : lineEnd;
|
|
54165
|
+
if (FENCE_LINE.test(source.slice(start, end))) {
|
|
54166
|
+
return end;
|
|
54167
|
+
}
|
|
54168
|
+
start = end + 1;
|
|
54169
|
+
}
|
|
54170
|
+
return 0;
|
|
54171
|
+
}
|
|
54172
|
+
function readFrontmatter(source, filePath, sourceRoot) {
|
|
54173
|
+
const slug = deriveSlug(filePath, sourceRoot);
|
|
54174
|
+
const end = frontmatterEnd(source);
|
|
54175
|
+
if (end === 0) {
|
|
54176
|
+
return { frontmatter: {}, slug };
|
|
54177
|
+
}
|
|
54178
|
+
const processor = createProcessor2().use(remarkParse).use(remarkFrontmatter, ["yaml"]).use(import_remark_parse_frontmatter2.default);
|
|
54179
|
+
const vfile = { data: {} };
|
|
54180
|
+
processor.runSync(processor.parse(source.slice(0, end)), vfile);
|
|
54181
|
+
return { frontmatter: vfile.data.frontmatter ?? {}, slug };
|
|
54182
|
+
}
|
|
53651
54183
|
function processMarkdown(source, filePath, config = {}) {
|
|
53652
|
-
let processor =
|
|
54184
|
+
let processor = createProcessor2().use(remarkParse).use(remarkFrontmatter, ["yaml"]).use(import_remark_parse_frontmatter2.default).use(remarkGfm);
|
|
53653
54185
|
if (config.directives || config.directiveOptions) {
|
|
53654
54186
|
processor = processor.use(remarkDirective);
|
|
53655
54187
|
}
|
|
@@ -53660,13 +54192,11 @@ function processMarkdown(source, filePath, config = {}) {
|
|
|
53660
54192
|
if (alerts) {
|
|
53661
54193
|
transformAlerts(tree, alerts, config.onUnknownAlert);
|
|
53662
54194
|
}
|
|
53663
|
-
const
|
|
53664
|
-
const
|
|
53665
|
-
const mdTree = tree;
|
|
53666
|
-
const plainText = mdastToString(mdTree);
|
|
54195
|
+
const frontmatter = vfile.data.frontmatter ?? {};
|
|
54196
|
+
const plainText = mdastToString(tree);
|
|
53667
54197
|
const excerpt = extractExcerpt(tree);
|
|
53668
54198
|
const slug = deriveSlug(filePath, config.sourceRoot);
|
|
53669
|
-
const bodyNodes = tree.children.filter((n) => n.type !== "yaml" && n.type !== "toml");
|
|
54199
|
+
const bodyNodes = (tree.children ?? []).filter((n) => n.type !== "yaml" && n.type !== "toml");
|
|
53670
54200
|
const $children = bodyNodes.map((n) => mdastNodeToJx(n)).filter(Boolean);
|
|
53671
54201
|
highlightCodeBlocks($children);
|
|
53672
54202
|
const toc = assignHeadingIds($children);
|
|
@@ -53682,7 +54212,7 @@ function processMarkdown(source, filePath, config = {}) {
|
|
|
53682
54212
|
slug
|
|
53683
54213
|
};
|
|
53684
54214
|
}
|
|
53685
|
-
var import_remark_parse_frontmatter2, WORDS_PER_MINUTE = 200, WORD_SEGMENTER, WORD_LIKE;
|
|
54215
|
+
var import_remark_parse_frontmatter2, createProcessor2, WORDS_PER_MINUTE = 200, WORD_SEGMENTER, WORD_LIKE, FENCE_LINE;
|
|
53686
54216
|
var init_md = __esm(() => {
|
|
53687
54217
|
init_unified();
|
|
53688
54218
|
init_remark_parse();
|
|
@@ -53695,11 +54225,14 @@ var init_md = __esm(() => {
|
|
|
53695
54225
|
init_transpile();
|
|
53696
54226
|
init_highlight();
|
|
53697
54227
|
init_inert();
|
|
54228
|
+
init_guards();
|
|
53698
54229
|
init_markdown2();
|
|
53699
54230
|
init_transpile();
|
|
53700
54231
|
import_remark_parse_frontmatter2 = __toESM(require_dist2(), 1);
|
|
54232
|
+
createProcessor2 = unified;
|
|
53701
54233
|
WORD_SEGMENTER = new Intl.Segmenter(DEFAULT_FORMAT_LOCALE, { granularity: "word" });
|
|
53702
54234
|
WORD_LIKE = /[\p{L}\p{N}]/u;
|
|
54235
|
+
FENCE_LINE = /^---[ \t]*\r?$/;
|
|
53703
54236
|
});
|
|
53704
54237
|
|
|
53705
54238
|
// src/markdown.ts
|
|
@@ -53728,6 +54261,14 @@ class Markdown {
|
|
|
53728
54261
|
await Promise.resolve().then(() => init_md());
|
|
53729
54262
|
const { readFileSync, statSync } = await import("node:fs");
|
|
53730
54263
|
const source = readFileSync(path, "utf8");
|
|
54264
|
+
const _meta = {};
|
|
54265
|
+
try {
|
|
54266
|
+
_meta.mtime = statSync(path).mtime.toISOString().replace(/\.\d{3}Z$/, "Z");
|
|
54267
|
+
} catch {}
|
|
54268
|
+
if (options.deferBody) {
|
|
54269
|
+
const { frontmatter, slug } = readFrontmatter(source, path, options.sourceRoot);
|
|
54270
|
+
return [{ _meta, body: source, data: frontmatter, id: slug }];
|
|
54271
|
+
}
|
|
53731
54272
|
const result = processMarkdown(source, path, {
|
|
53732
54273
|
...options.directives !== undefined && { directives: options.directives },
|
|
53733
54274
|
...options.directiveOptions !== undefined && {
|
|
@@ -53737,22 +54278,10 @@ class Markdown {
|
|
|
53737
54278
|
...options.alerts !== undefined && { alerts: options.alerts },
|
|
53738
54279
|
...options.onUnknownAlert !== undefined && { onUnknownAlert: options.onUnknownAlert }
|
|
53739
54280
|
});
|
|
53740
|
-
|
|
53741
|
-
|
|
53742
|
-
|
|
53743
|
-
|
|
53744
|
-
if (result.$excerpt != null) {
|
|
53745
|
-
_meta.excerpt = result.$excerpt;
|
|
53746
|
-
}
|
|
53747
|
-
if (result.$toc != null) {
|
|
53748
|
-
_meta.toc = result.$toc;
|
|
53749
|
-
}
|
|
53750
|
-
if (result.$readingTime != null) {
|
|
53751
|
-
_meta.readingTime = result.$readingTime;
|
|
53752
|
-
}
|
|
53753
|
-
if (result.$wordCount != null) {
|
|
53754
|
-
_meta.wordCount = result.$wordCount;
|
|
53755
|
-
}
|
|
54281
|
+
_meta.excerpt = result.$excerpt;
|
|
54282
|
+
_meta.toc = result.$toc;
|
|
54283
|
+
_meta.readingTime = result.$readingTime;
|
|
54284
|
+
_meta.wordCount = result.$wordCount;
|
|
53756
54285
|
return [
|
|
53757
54286
|
{
|
|
53758
54287
|
$children: result.$children,
|