@quartz-community/remark-obsidian 2.1.0 → 2.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -2260,20 +2260,20 @@ function decodeNamedCharacterReference(value2) {
2260
2260
 
2261
2261
  // node_modules/micromark-util-decode-numeric-character-reference/index.js
2262
2262
  function decodeNumericCharacterReference(value2, base) {
2263
- const code2 = Number.parseInt(value2, base);
2263
+ const code = Number.parseInt(value2, base);
2264
2264
  if (
2265
2265
  // C0 except for HT, LF, FF, CR, space.
2266
- code2 < 9 || code2 === 11 || code2 > 13 && code2 < 32 || // Control character (DEL) of C0, and C1 controls.
2267
- code2 > 126 && code2 < 160 || // Lone high surrogates and low surrogates.
2268
- code2 > 55295 && code2 < 57344 || // Noncharacters.
2269
- code2 > 64975 && code2 < 65008 || /* eslint-disable no-bitwise */
2270
- (code2 & 65535) === 65535 || (code2 & 65535) === 65534 || /* eslint-enable no-bitwise */
2266
+ code < 9 || code === 11 || code > 13 && code < 32 || // Control character (DEL) of C0, and C1 controls.
2267
+ code > 126 && code < 160 || // Lone high surrogates and low surrogates.
2268
+ code > 55295 && code < 57344 || // Noncharacters.
2269
+ code > 64975 && code < 65008 || /* eslint-disable no-bitwise */
2270
+ (code & 65535) === 65535 || (code & 65535) === 65534 || /* eslint-enable no-bitwise */
2271
2271
  // Out of range
2272
- code2 > 1114111
2272
+ code > 1114111
2273
2273
  ) {
2274
2274
  return "\uFFFD";
2275
2275
  }
2276
- return String.fromCodePoint(code2);
2276
+ return String.fromCodePoint(code);
2277
2277
  }
2278
2278
 
2279
2279
  // node_modules/micromark-util-decode-string/index.js
@@ -2522,10 +2522,10 @@ function mathDisplayTransform(tree, source) {
2522
2522
  function resolveTarget(target) {
2523
2523
  return target.replace(/\u00a0/gu, " ").normalize("NFC");
2524
2524
  }
2525
- function spelledTarget(path, heading2, resolved) {
2525
+ function spelledTarget(path, heading, resolved) {
2526
2526
  const spelled = {};
2527
2527
  if (path !== resolved.path) spelled.spelledPath = path;
2528
- if (heading2 !== resolved.heading) spelled.spelledHeading = heading2;
2528
+ if (heading !== resolved.heading) spelled.spelledHeading = heading;
2529
2529
  return Object.keys(spelled).length > 0 ? spelled : void 0;
2530
2530
  }
2531
2531
  function writtenPart(part, spelled, strippedBackslash) {
@@ -2534,28 +2534,28 @@ function writtenPart(part, spelled, strippedBackslash) {
2534
2534
  }
2535
2535
 
2536
2536
  // src/lib/syntax/legacy-scan.ts
2537
- function codeToCharacter(code2) {
2538
- if (code2 === -5 || code2 === -4 || code2 === -3) return "\n";
2539
- if (code2 === -2) return " ";
2540
- if (code2 === -1) return " ";
2541
- return String.fromCodePoint(code2);
2537
+ function codeToCharacter(code) {
2538
+ if (code === -5 || code === -4 || code === -3) return "\n";
2539
+ if (code === -2) return " ";
2540
+ if (code === -1) return " ";
2541
+ return String.fromCodePoint(code);
2542
2542
  }
2543
2543
  function createChunkScan(sink, stopAfter) {
2544
2544
  return {
2545
2545
  partial: true,
2546
2546
  tokenize(effects, ok3) {
2547
- return function enter(code2) {
2547
+ return function enter(code) {
2548
2548
  effects.enter("legacyChunkScan");
2549
- return step2(code2);
2549
+ return step2(code);
2550
2550
  };
2551
- function step2(code2) {
2552
- if (code2 === null) {
2551
+ function step2(code) {
2552
+ if (code === null) {
2553
2553
  effects.exit("legacyChunkScan");
2554
- return ok3(code2);
2554
+ return ok3(code);
2555
2555
  }
2556
- const character = codeToCharacter(code2);
2556
+ const character = codeToCharacter(code);
2557
2557
  sink.push(character);
2558
- effects.consume(code2);
2558
+ effects.consume(code);
2559
2559
  if (stopAfter?.(character) === true) {
2560
2560
  effects.exit("legacyChunkScan");
2561
2561
  return ok3;
@@ -3316,24 +3316,24 @@ var highlight = {
3316
3316
  let segments = [];
3317
3317
  let index = 0;
3318
3318
  let remaining = 0;
3319
- function startBody(code2) {
3319
+ function startBody(code) {
3320
3320
  segments = planBody(queue, { stripContinuationIndent: true });
3321
3321
  index = 0;
3322
- return nextSegment(code2);
3322
+ return nextSegment(code);
3323
3323
  }
3324
- function nextSegment(code2) {
3324
+ function nextSegment(code) {
3325
3325
  const segment = segments[index];
3326
- if (!segment) return closeStart(code2);
3326
+ if (!segment) return closeStart(code);
3327
3327
  remaining = segment.length;
3328
3328
  if (segment.kind === "eol") effects.enter(types.lineEnding);
3329
3329
  else if (segment.kind === "data") effects.enter("data");
3330
3330
  else if (segment.kind === "prefix") effects.enter(types.linePrefix);
3331
3331
  else if (segment.kind === "hardBreak") effects.enter("hardBreakEscape");
3332
3332
  else effects.enter(TEXT_TOKEN, { contentType: "text" });
3333
- return consumeSegment(code2);
3333
+ return consumeSegment(code);
3334
3334
  }
3335
- function consumeSegment(code2) {
3336
- effects.consume(code2);
3335
+ function consumeSegment(code) {
3336
+ effects.consume(code);
3337
3337
  if (--remaining > 0) return consumeSegment;
3338
3338
  const segment = segments[index];
3339
3339
  effects.exit(
@@ -3343,34 +3343,34 @@ var highlight = {
3343
3343
  return nextSegment;
3344
3344
  }
3345
3345
  return start;
3346
- function start(code2) {
3347
- if (code2 !== EQUALS) return nok(code2);
3346
+ function start(code) {
3347
+ if (code !== EQUALS) return nok(code);
3348
3348
  characters.length = 0;
3349
- return effects.check(scan, decide, decide)(code2);
3349
+ return effects.check(scan, decide, decide)(code);
3350
3350
  }
3351
- function decide(code2) {
3351
+ function decide(code) {
3352
3352
  const found = legacyHighlightQueue(characters.join(""));
3353
- if (found === null) return nok(code2);
3354
- if (emphasisClosesInside(self, found)) return nok(code2);
3353
+ if (found === null) return nok(code);
3354
+ if (emphasisClosesInside(self, found)) return nok(code);
3355
3355
  queue = found;
3356
3356
  effects.enter("highlight");
3357
3357
  effects.enter("highlightSequence");
3358
3358
  remaining = MARKER_LENGTH;
3359
- return openSequence(code2);
3359
+ return openSequence(code);
3360
3360
  }
3361
- function openSequence(code2) {
3362
- effects.consume(code2);
3361
+ function openSequence(code) {
3362
+ effects.consume(code);
3363
3363
  if (--remaining > 0) return openSequence;
3364
3364
  effects.exit("highlightSequence");
3365
3365
  return startBody;
3366
3366
  }
3367
- function closeStart(code2) {
3367
+ function closeStart(code) {
3368
3368
  effects.enter("highlightSequence");
3369
3369
  remaining = MARKER_LENGTH;
3370
- return closeSequence(code2);
3370
+ return closeSequence(code);
3371
3371
  }
3372
- function closeSequence(code2) {
3373
- effects.consume(code2);
3372
+ function closeSequence(code) {
3373
+ effects.consume(code);
3374
3374
  if (--remaining > 0) return closeSequence;
3375
3375
  effects.exit("highlightSequence");
3376
3376
  effects.exit("highlight");
@@ -3412,12 +3412,12 @@ function emphasisClosesInside(self, body) {
3412
3412
  };
3413
3413
  for (const [kind, token] of self.events) {
3414
3414
  if (kind !== "enter" || token.type !== "attentionSequence") continue;
3415
- const text4 = self.sliceSerialize(token);
3415
+ const text3 = self.sliceSerialize(token);
3416
3416
  const flags = token;
3417
3417
  take(
3418
3418
  {
3419
- marker: text4[0],
3420
- size: text4.length,
3419
+ marker: text3[0],
3420
+ size: text3.length,
3421
3421
  open: Boolean(flags._open),
3422
3422
  close: Boolean(flags._close)
3423
3423
  },
@@ -3470,25 +3470,25 @@ function isWordCharacter(character) {
3470
3470
  return /\w/.test(charOf(character));
3471
3471
  }
3472
3472
  function isDecimal(character) {
3473
- const code2 = codeOf(character);
3474
- return code2 >= 48 && code2 <= 57;
3473
+ const code = codeOf(character);
3474
+ return code >= 48 && code <= 57;
3475
3475
  }
3476
3476
  function isAlphabetical(character) {
3477
- const code2 = codeOf(character);
3478
- return code2 >= 97 && code2 <= 122 || code2 >= 65 && code2 <= 90;
3477
+ const code = codeOf(character);
3478
+ return code >= 97 && code <= 122 || code >= 65 && code <= 90;
3479
3479
  }
3480
3480
  function isHexadecimal(character) {
3481
- const code2 = codeOf(character);
3482
- return code2 >= 97 && code2 <= 102 || code2 >= 65 && code2 <= 70 || code2 >= 48 && code2 <= 57;
3481
+ const code = codeOf(character);
3482
+ return code >= 97 && code <= 102 || code >= 65 && code <= 70 || code >= 48 && code <= 57;
3483
3483
  }
3484
3484
  function isAlphanumerical(character) {
3485
3485
  return isAlphabetical(character) || isDecimal(character);
3486
3486
  }
3487
3487
  function trimTrailingLines(value2) {
3488
- const text4 = String(value2);
3489
- let end = text4.length;
3490
- while (end > 0 && text4.charCodeAt(end - 1) === 10) end--;
3491
- return text4.slice(0, end);
3488
+ const text3 = String(value2);
3489
+ let end = text3.length;
3490
+ while (end > 0 && text3.charCodeAt(end - 1) === 10) end--;
3491
+ return text3.slice(0, end);
3492
3492
  }
3493
3493
  function collapseWhiteSpace(value2) {
3494
3494
  return String(value2).replace(/\s+/g, " ");
@@ -4074,7 +4074,7 @@ function attachParser(parser, options) {
4074
4074
  }
4075
4075
  before(blockMethods, "definition", "footnoteDefinition");
4076
4076
  before(inlineMethods, "reference", "footnoteCall");
4077
- blocks.definition = definition3;
4077
+ blocks.definition = definition2;
4078
4078
  blocks.footnoteDefinition = footnoteDefinition;
4079
4079
  spans.footnoteCall = footnoteCall;
4080
4080
  spans.reference = reference2;
@@ -4092,7 +4092,7 @@ function attachParser(parser, options) {
4092
4092
  var label;
4093
4093
  var labelStart;
4094
4094
  var labelEnd;
4095
- var code2;
4095
+ var code;
4096
4096
  var now;
4097
4097
  var add;
4098
4098
  var exit;
@@ -4103,19 +4103,19 @@ function attachParser(parser, options) {
4103
4103
  var lines;
4104
4104
  var line;
4105
4105
  while (index2 < length2) {
4106
- code2 = value2.charCodeAt(index2);
4107
- if (code2 !== tab3 && code2 !== space4) break;
4106
+ code = value2.charCodeAt(index2);
4107
+ if (code !== tab3 && code !== space4) break;
4108
4108
  index2++;
4109
4109
  }
4110
4110
  if (value2.charCodeAt(index2++) !== leftSquareBracket) return;
4111
4111
  if (value2.charCodeAt(index2++) !== caret) return;
4112
4112
  labelStart = index2;
4113
4113
  while (index2 < length2) {
4114
- code2 = value2.charCodeAt(index2);
4115
- if (code2 !== code2 || code2 === lineFeed3 || code2 === tab3 || code2 === space4) {
4114
+ code = value2.charCodeAt(index2);
4115
+ if (code !== code || code === lineFeed3 || code === tab3 || code === space4) {
4116
4116
  return;
4117
4117
  }
4118
- if (code2 === rightSquareBracket) {
4118
+ if (code === rightSquareBracket) {
4119
4119
  labelEnd = index2;
4120
4120
  index2++;
4121
4121
  break;
@@ -4135,8 +4135,8 @@ function attachParser(parser, options) {
4135
4135
  contentStart = index2;
4136
4136
  lines = [];
4137
4137
  while (index2 < length2) {
4138
- code2 = value2.charCodeAt(index2);
4139
- if (code2 !== code2 || code2 === lineFeed3) {
4138
+ code = value2.charCodeAt(index2);
4139
+ if (code !== code || code === lineFeed3) {
4140
4140
  line = {
4141
4141
  start,
4142
4142
  contentStart: contentStart || index2,
@@ -4144,15 +4144,15 @@ function attachParser(parser, options) {
4144
4144
  end: index2
4145
4145
  };
4146
4146
  lines.push(line);
4147
- if (code2 === lineFeed3) {
4147
+ if (code === lineFeed3) {
4148
4148
  start = index2 + 1;
4149
4149
  indent2 = 0;
4150
4150
  contentStart = void 0;
4151
4151
  line.end = start;
4152
4152
  }
4153
4153
  } else if (indent2 !== void 0) {
4154
- if (code2 === space4 || code2 === tab3) {
4155
- indent2 += code2 === space4 ? 1 : tabSize3 - indent2 % tabSize3;
4154
+ if (code === space4 || code === tab3) {
4155
+ indent2 += code === space4 ? 1 : tabSize3 - indent2 % tabSize3;
4156
4156
  if (indent2 > tabSize3) {
4157
4157
  indent2 = void 0;
4158
4158
  contentStart = index2;
@@ -4202,16 +4202,16 @@ function attachParser(parser, options) {
4202
4202
  var label;
4203
4203
  var labelStart;
4204
4204
  var labelEnd;
4205
- var code2;
4205
+ var code;
4206
4206
  if (value2.charCodeAt(index2++) !== leftSquareBracket) return;
4207
4207
  if (value2.charCodeAt(index2++) !== caret) return;
4208
4208
  labelStart = index2;
4209
4209
  while (index2 < length2) {
4210
- code2 = value2.charCodeAt(index2);
4211
- if (code2 !== code2 || code2 === lineFeed3 || code2 === tab3 || code2 === space4) {
4210
+ code = value2.charCodeAt(index2);
4211
+ if (code !== code || code === lineFeed3 || code === tab3 || code === space4) {
4212
4212
  return;
4213
4213
  }
4214
- if (code2 === rightSquareBracket) {
4214
+ if (code === rightSquareBracket) {
4215
4215
  labelEnd = index2;
4216
4216
  index2++;
4217
4217
  break;
@@ -4237,7 +4237,7 @@ function attachParser(parser, options) {
4237
4237
  var index2 = 0;
4238
4238
  var balance = 0;
4239
4239
  var now;
4240
- var code2;
4240
+ var code;
4241
4241
  var contentStart;
4242
4242
  var contentEnd;
4243
4243
  var fenceStart;
@@ -4247,17 +4247,17 @@ function attachParser(parser, options) {
4247
4247
  if (value2.charCodeAt(index2++) !== leftSquareBracket) return;
4248
4248
  contentStart = index2;
4249
4249
  while (index2 < length2) {
4250
- code2 = value2.charCodeAt(index2);
4251
- if (code2 !== code2) {
4250
+ code = value2.charCodeAt(index2);
4251
+ if (code !== code) {
4252
4252
  return;
4253
4253
  }
4254
4254
  if (fenceOpenSize === void 0) {
4255
- if (code2 === backslash) {
4255
+ if (code === backslash) {
4256
4256
  index2 += 2;
4257
- } else if (code2 === leftSquareBracket) {
4257
+ } else if (code === leftSquareBracket) {
4258
4258
  balance++;
4259
4259
  index2++;
4260
- } else if (code2 === rightSquareBracket) {
4260
+ } else if (code === rightSquareBracket) {
4261
4261
  if (balance === 0) {
4262
4262
  contentEnd = index2;
4263
4263
  index2++;
@@ -4266,7 +4266,7 @@ function attachParser(parser, options) {
4266
4266
  balance--;
4267
4267
  index2++;
4268
4268
  }
4269
- } else if (code2 === graveAccent) {
4269
+ } else if (code === graveAccent) {
4270
4270
  fenceStart = index2;
4271
4271
  fenceOpenSize = 1;
4272
4272
  while (value2.charCodeAt(fenceStart + fenceOpenSize) === graveAccent) {
@@ -4277,7 +4277,7 @@ function attachParser(parser, options) {
4277
4277
  index2++;
4278
4278
  }
4279
4279
  } else {
4280
- if (code2 === graveAccent) {
4280
+ if (code === graveAccent) {
4281
4281
  fenceStart = index2;
4282
4282
  fenceCloseSize = 1;
4283
4283
  while (value2.charCodeAt(fenceStart + fenceCloseSize) === graveAccent) {
@@ -4314,11 +4314,11 @@ function attachParser(parser, options) {
4314
4314
  if (value2.charCodeAt(index2 + 1) === caret) return;
4315
4315
  return originalReference.call(this, eat, value2, silent);
4316
4316
  }
4317
- function definition3(eat, value2, silent) {
4317
+ function definition2(eat, value2, silent) {
4318
4318
  var index2 = 0;
4319
- var code2 = value2.charCodeAt(index2);
4320
- while (code2 === space4 || code2 === tab3) code2 = value2.charCodeAt(++index2);
4321
- if (code2 !== leftSquareBracket) return;
4319
+ var code = value2.charCodeAt(index2);
4320
+ while (code === space4 || code === tab3) code = value2.charCodeAt(++index2);
4321
+ if (code !== leftSquareBracket) return;
4322
4322
  if (value2.charCodeAt(index2 + 1) === caret) return;
4323
4323
  return originalDefinition.call(this, eat, value2, silent);
4324
4324
  }
@@ -4354,14 +4354,14 @@ function attachCompiler(compiler) {
4354
4354
  return "[^" + (node2.label || node2.identifier) + "]: " + lines.join("\n");
4355
4355
  }
4356
4356
  }
4357
- function before(list4, before2, value2) {
4358
- list4.splice(list4.indexOf(before2), 0, value2);
4357
+ function before(list3, before2, value2) {
4358
+ list3.splice(list3.indexOf(before2), 0, value2);
4359
4359
  }
4360
- function interrupt2(list4, tokenizers, ctx, parameters) {
4361
- var length = list4.length;
4360
+ function interrupt2(list3, tokenizers, ctx, parameters) {
4361
+ var length = list3.length;
4362
4362
  var index = -1;
4363
4363
  while (++index < length) {
4364
- if (tokenizers[list4[index][0]].apply(ctx, parameters)) {
4364
+ if (tokenizers[list3[index][0]].apply(ctx, parameters)) {
4365
4365
  return true;
4366
4366
  }
4367
4367
  }
@@ -4411,7 +4411,7 @@ function attachParser2(parser, options) {
4411
4411
  let escaped2 = false;
4412
4412
  let index = 0;
4413
4413
  let previous2;
4414
- let code2;
4414
+ let code;
4415
4415
  let next;
4416
4416
  let contentStart;
4417
4417
  let contentEnd;
@@ -4441,9 +4441,9 @@ function attachParser2(parser, options) {
4441
4441
  }
4442
4442
  contentStart = index;
4443
4443
  while (index < length) {
4444
- code2 = next;
4444
+ code = next;
4445
4445
  next = value2.charCodeAt(index + 1);
4446
- if (code2 === dollarSign) {
4446
+ if (code === dollarSign) {
4447
4447
  previous2 = value2.charCodeAt(index - 1);
4448
4448
  if (previous2 !== space5 && previous2 !== tab4 && (next !== next || next < digit0 || next > digit9) && (!double || next === dollarSign)) {
4449
4449
  contentEnd = index - 1;
@@ -4454,7 +4454,7 @@ function attachParser2(parser, options) {
4454
4454
  valueEnd = index;
4455
4455
  break;
4456
4456
  }
4457
- } else if (code2 === backslash2) {
4457
+ } else if (code === backslash2) {
4458
4458
  index++;
4459
4459
  next = value2.charCodeAt(index + 1);
4460
4460
  }
@@ -4532,7 +4532,7 @@ function attachParser3(parser) {
4532
4532
  function mathBlockTokenizer(eat, value2, silent) {
4533
4533
  var length = value2.length;
4534
4534
  var index = 0;
4535
- let code2;
4535
+ let code;
4536
4536
  let content;
4537
4537
  let lineEnd2;
4538
4538
  let lineIndex;
@@ -4559,11 +4559,11 @@ function attachParser3(parser) {
4559
4559
  }
4560
4560
  openingFenceContentStart = index;
4561
4561
  while (index < length) {
4562
- code2 = value2.charCodeAt(index);
4563
- if (code2 === dollarSign2) {
4562
+ code = value2.charCodeAt(index);
4563
+ if (code === dollarSign2) {
4564
4564
  return;
4565
4565
  }
4566
- if (code2 === lineFeed4) {
4566
+ if (code === lineFeed4) {
4567
4567
  break;
4568
4568
  }
4569
4569
  index++;
@@ -4947,11 +4947,11 @@ function parse(value2, settings) {
4947
4947
  offset: index + (pos.offset || 0)
4948
4948
  };
4949
4949
  }
4950
- function parseError(code2, offset) {
4950
+ function parseError(code, offset) {
4951
4951
  var position = now();
4952
4952
  position.column += offset;
4953
4953
  position.offset += offset;
4954
- handleWarning.call(warningContext, messages[code2], position, code2);
4954
+ handleWarning.call(warningContext, messages[code], position, code);
4955
4955
  }
4956
4956
  function flush() {
4957
4957
  if (queue) {
@@ -4963,11 +4963,11 @@ function parse(value2, settings) {
4963
4963
  }
4964
4964
  }
4965
4965
  }
4966
- function prohibited(code2) {
4967
- return code2 >= 55296 && code2 <= 57343 || code2 > 1114111;
4966
+ function prohibited(code) {
4967
+ return code >= 55296 && code <= 57343 || code > 1114111;
4968
4968
  }
4969
- function disallowed(code2) {
4970
- return code2 >= 1 && code2 <= 8 || code2 === 11 || code2 >= 13 && code2 <= 31 || code2 >= 127 && code2 <= 159 || code2 >= 64976 && code2 <= 65007 || (code2 & 65535) === 65535 || (code2 & 65535) === 65534;
4969
+ function disallowed(code) {
4970
+ return code >= 1 && code <= 8 || code === 11 || code >= 13 && code <= 31 || code >= 127 && code <= 159 || code >= 64976 && code <= 65007 || (code & 65535) === 65535 || (code & 65535) === 65534;
4971
4971
  }
4972
4972
 
4973
4973
  // src/rp8/vendor/remark-parse/decode.ts
@@ -5003,8 +5003,8 @@ function factory2(ctx) {
5003
5003
  xtend(options, { position: normalize2(position), warning: handleWarning })
5004
5004
  );
5005
5005
  }
5006
- function handleWarning(reason, position, code2) {
5007
- if (code2 !== 3) {
5006
+ function handleWarning(reason, position, code) {
5007
+ if (code !== 3) {
5008
5008
  ctx.file.message(reason, position);
5009
5009
  }
5010
5010
  }
@@ -7004,7 +7004,7 @@ function autoLink(eat, value2, silent) {
7004
7004
  var index = 0;
7005
7005
  var queue = "";
7006
7006
  var hasAtCharacter = false;
7007
- var link4 = "";
7007
+ var link3 = "";
7008
7008
  var character;
7009
7009
  var now;
7010
7010
  var content;
@@ -7026,10 +7026,10 @@ function autoLink(eat, value2, silent) {
7026
7026
  if (!queue) {
7027
7027
  return;
7028
7028
  }
7029
- link4 += queue;
7029
+ link3 += queue;
7030
7030
  queue = "";
7031
7031
  character = value2.charAt(index);
7032
- link4 += character;
7032
+ link3 += character;
7033
7033
  index++;
7034
7034
  if (character === atSign) {
7035
7035
  hasAtCharacter = true;
@@ -7037,7 +7037,7 @@ function autoLink(eat, value2, silent) {
7037
7037
  if (character !== ":" || value2.charAt(index + 1) !== slash) {
7038
7038
  return;
7039
7039
  }
7040
- link4 += slash;
7040
+ link3 += slash;
7041
7041
  index++;
7042
7042
  }
7043
7043
  while (index < length) {
@@ -7055,19 +7055,19 @@ function autoLink(eat, value2, silent) {
7055
7055
  if (silent) {
7056
7056
  return true;
7057
7057
  }
7058
- link4 += queue;
7059
- content = link4;
7060
- subvalue += link4 + character;
7058
+ link3 += queue;
7059
+ content = link3;
7060
+ subvalue += link3 + character;
7061
7061
  now = eat.now();
7062
7062
  now.column++;
7063
7063
  now.offset++;
7064
7064
  if (hasAtCharacter) {
7065
- if (link4.slice(0, mailtoLength).toLowerCase() === mailto) {
7065
+ if (link3.slice(0, mailtoLength).toLowerCase() === mailto) {
7066
7066
  content = content.slice(mailtoLength);
7067
7067
  now.column += mailtoLength;
7068
7068
  now.offset += mailtoLength;
7069
7069
  } else {
7070
- link4 = mailto + link4;
7070
+ link3 = mailto + link3;
7071
7071
  }
7072
7072
  }
7073
7073
  tokenizers = self.inlineTokenizers;
@@ -7079,7 +7079,7 @@ function autoLink(eat, value2, silent) {
7079
7079
  return eat(subvalue)({
7080
7080
  type: "link",
7081
7081
  title: null,
7082
- url: parse_entities_default(link4, { nonTerminated: false }),
7082
+ url: parse_entities_default(link3, { nonTerminated: false }),
7083
7083
  children: content
7084
7084
  });
7085
7085
  }
@@ -7138,7 +7138,7 @@ function url(eat, value2, silent) {
7138
7138
  var index;
7139
7139
  var pathStart;
7140
7140
  var path;
7141
- var code2;
7141
+ var code;
7142
7142
  var end;
7143
7143
  var leftCount;
7144
7144
  var rightCount;
@@ -7163,8 +7163,8 @@ function url(eat, value2, silent) {
7163
7163
  start = index;
7164
7164
  dots = [];
7165
7165
  while (index < length) {
7166
- code2 = value2.charCodeAt(index);
7167
- if (code2 === dot3) {
7166
+ code = value2.charCodeAt(index);
7167
+ if (code === dot3) {
7168
7168
  if (previousDot === index - 1) {
7169
7169
  break;
7170
7170
  }
@@ -7173,13 +7173,13 @@ function url(eat, value2, silent) {
7173
7173
  index++;
7174
7174
  continue;
7175
7175
  }
7176
- if (isDecimal(code2) || isAlphabetical(code2) || code2 === dash6 || code2 === underscore4) {
7176
+ if (isDecimal(code) || isAlphabetical(code) || code === dash6 || code === underscore4) {
7177
7177
  index++;
7178
7178
  continue;
7179
7179
  }
7180
7180
  break;
7181
7181
  }
7182
- if (code2 === dot3) {
7182
+ if (code === dot3) {
7183
7183
  dots.pop();
7184
7184
  index--;
7185
7185
  }
@@ -7196,12 +7196,12 @@ function url(eat, value2, silent) {
7196
7196
  end = index;
7197
7197
  pathStart = index;
7198
7198
  while (index < length) {
7199
- code2 = value2.charCodeAt(index);
7200
- if (isWhitespaceCharacter(code2) || code2 === lessThan5) {
7199
+ code = value2.charCodeAt(index);
7200
+ if (isWhitespaceCharacter(code) || code === lessThan5) {
7201
7201
  break;
7202
7202
  }
7203
7203
  index++;
7204
- if (code2 === exclamationMark4 || code2 === asterisk4 || code2 === comma || code2 === dot3 || code2 === colon4 || code2 === questionMark || code2 === underscore4 || code2 === tilde2) {
7204
+ if (code === exclamationMark4 || code === asterisk4 || code === comma || code === dot3 || code === colon4 || code === questionMark || code === underscore4 || code === tilde2) {
7205
7205
  } else {
7206
7206
  end = index;
7207
7207
  }
@@ -7268,8 +7268,8 @@ function locate4(value2, fromIndex) {
7268
7268
  }
7269
7269
  return position;
7270
7270
  }
7271
- function isGfmAtext(code2) {
7272
- return isDecimal(code2) || isAlphabetical(code2) || code2 === plusSign3 || code2 === dash7 || code2 === dot4 || code2 === underscore5;
7271
+ function isGfmAtext(code) {
7272
+ return isDecimal(code) || isAlphabetical(code) || code === plusSign3 || code === dash7 || code === dot4 || code === underscore5;
7273
7273
  }
7274
7274
 
7275
7275
  // src/rp8/vendor/remark-parse/tokenize/email.ts
@@ -7288,39 +7288,39 @@ function email(eat, value2, silent) {
7288
7288
  var index = 0;
7289
7289
  var length = value2.length;
7290
7290
  var firstDot = -1;
7291
- var code2;
7291
+ var code;
7292
7292
  var content;
7293
7293
  var children;
7294
7294
  var exit;
7295
7295
  if (!gfm) {
7296
7296
  return;
7297
7297
  }
7298
- code2 = value2.charCodeAt(index);
7299
- while (isDecimal(code2) || isAlphabetical(code2) || code2 === plusSign4 || code2 === dash8 || code2 === dot5 || code2 === underscore6) {
7300
- code2 = value2.charCodeAt(++index);
7298
+ code = value2.charCodeAt(index);
7299
+ while (isDecimal(code) || isAlphabetical(code) || code === plusSign4 || code === dash8 || code === dot5 || code === underscore6) {
7300
+ code = value2.charCodeAt(++index);
7301
7301
  }
7302
7302
  if (index === 0) {
7303
7303
  return;
7304
7304
  }
7305
- if (code2 !== atSign2) {
7305
+ if (code !== atSign2) {
7306
7306
  return;
7307
7307
  }
7308
7308
  index++;
7309
7309
  while (index < length) {
7310
- code2 = value2.charCodeAt(index);
7311
- if (isDecimal(code2) || isAlphabetical(code2) || code2 === dash8 || code2 === dot5 || code2 === underscore6) {
7310
+ code = value2.charCodeAt(index);
7311
+ if (isDecimal(code) || isAlphabetical(code) || code === dash8 || code === dot5 || code === underscore6) {
7312
7312
  index++;
7313
- if (firstDot === -1 && code2 === dot5) {
7313
+ if (firstDot === -1 && code === dot5) {
7314
7314
  firstDot = index;
7315
7315
  }
7316
7316
  continue;
7317
7317
  }
7318
7318
  break;
7319
7319
  }
7320
- if (firstDot === -1 || firstDot === index || code2 === dash8 || code2 === underscore6) {
7320
+ if (firstDot === -1 || firstDot === index || code === dash8 || code === underscore6) {
7321
7321
  return;
7322
7322
  }
7323
- if (code2 === dot5) {
7323
+ if (code === dot5) {
7324
7324
  index--;
7325
7325
  }
7326
7326
  content = value2.slice(0, index);
@@ -7380,12 +7380,12 @@ function inlineHTML(eat, value2, silent) {
7380
7380
  // src/rp8/vendor/remark-parse/locate/link.ts
7381
7381
  var link_default = locate5;
7382
7382
  function locate5(value2, fromIndex) {
7383
- var link4 = value2.indexOf("[", fromIndex);
7384
- var image3 = value2.indexOf("![", fromIndex);
7385
- if (image3 === -1) {
7386
- return link4;
7383
+ var link3 = value2.indexOf("[", fromIndex);
7384
+ var image2 = value2.indexOf("![", fromIndex);
7385
+ if (image2 === -1) {
7386
+ return link3;
7387
7387
  }
7388
- return link4 < image3 ? link4 : image3;
7388
+ return link3 < image2 ? link3 : image2;
7389
7389
  }
7390
7390
 
7391
7391
  // src/rp8/vendor/remark-parse/tokenize/link.ts
@@ -8017,7 +8017,7 @@ function inlineCode(eat, value2, silent) {
8017
8017
  var openingFenceEnd;
8018
8018
  var closingFenceStart;
8019
8019
  var closingFenceEnd;
8020
- var code2;
8020
+ var code;
8021
8021
  var next;
8022
8022
  var found;
8023
8023
  while (index < length) {
@@ -8032,9 +8032,9 @@ function inlineCode(eat, value2, silent) {
8032
8032
  openingFenceEnd = index;
8033
8033
  next = value2.charCodeAt(index);
8034
8034
  while (index < length) {
8035
- code2 = next;
8035
+ code = next;
8036
8036
  next = value2.charCodeAt(index + 1);
8037
- if (code2 === graveAccent4) {
8037
+ if (code === graveAccent4) {
8038
8038
  if (closingFenceStart === void 0) {
8039
8039
  closingFenceStart = index;
8040
8040
  }
@@ -8057,15 +8057,15 @@ function inlineCode(eat, value2, silent) {
8057
8057
  }
8058
8058
  index = openingFenceEnd;
8059
8059
  length = closingFenceStart;
8060
- code2 = value2.charCodeAt(index);
8060
+ code = value2.charCodeAt(index);
8061
8061
  next = value2.charCodeAt(length - 1);
8062
8062
  found = false;
8063
- if (length - index > 2 && (code2 === space20 || code2 === lineFeed21) && (next === space20 || next === lineFeed21)) {
8063
+ if (length - index > 2 && (code === space20 || code === lineFeed21) && (next === space20 || next === lineFeed21)) {
8064
8064
  index++;
8065
8065
  length--;
8066
8066
  while (index < length) {
8067
- code2 = value2.charCodeAt(index);
8068
- if (code2 !== space20 && code2 !== lineFeed21) {
8067
+ code = value2.charCodeAt(index);
8068
+ if (code !== space20 && code !== lineFeed21) {
8069
8069
  found = true;
8070
8070
  break;
8071
8071
  }
@@ -8573,13 +8573,13 @@ function closingBracket(frame, open) {
8573
8573
  const { value: value2 } = frame;
8574
8574
  const balance = new Int32Array(value2.length + 1);
8575
8575
  for (let at3 = 0, level = 0; at3 < value2.length; at3++) {
8576
- const code2 = value2.charCodeAt(at3);
8576
+ const code = value2.charCodeAt(at3);
8577
8577
  balance[at3] = level;
8578
- if (code2 === 92 && at3 + 1 < value2.length) {
8578
+ if (code === 92 && at3 + 1 < value2.length) {
8579
8579
  balance[at3 + 1] = level;
8580
8580
  at3++;
8581
- } else if (code2 === 91) level++;
8582
- else if (code2 === 93) level--;
8581
+ } else if (code === 91) level++;
8582
+ else if (code === 93) level--;
8583
8583
  balance[at3 + 1] = level;
8584
8584
  }
8585
8585
  const lower = new Int32Array(value2.length + 1).fill(-1);
@@ -8621,7 +8621,7 @@ function speedUps(tables, features) {
8621
8621
  }
8622
8622
  };
8623
8623
  const stockText = tables.inlineTokenizers.text;
8624
- const text4 = function(eat, value2, silent) {
8624
+ const text3 = function(eat, value2, silent) {
8625
8625
  const frame = frameOf(this, value2);
8626
8626
  if (silent === true || !frame)
8627
8627
  return stockText.call(this, eat, value2, silent);
@@ -8657,9 +8657,9 @@ function speedUps(tables, features) {
8657
8657
  );
8658
8658
  return void 0;
8659
8659
  };
8660
- tables.inlineTokenizers.text = text4;
8660
+ tables.inlineTokenizers.text = text3;
8661
8661
  const stockCode = tables.inlineTokenizers.code;
8662
- const code2 = function(eat, value2, silent) {
8662
+ const code = function(eat, value2, silent) {
8663
8663
  const frame = frameOf(this, value2);
8664
8664
  if (!frame || value2.charCodeAt(0) !== 96)
8665
8665
  return stockCode.call(this, eat, value2, silent);
@@ -8675,8 +8675,8 @@ function speedUps(tables, features) {
8675
8675
  if (!starts || starts[starts.length - 1] < base + width) return void 0;
8676
8676
  return stockCode.call(this, eat, value2, silent);
8677
8677
  };
8678
- code2.locator = stockCode.locator;
8679
- tables.inlineTokenizers.code = code2;
8678
+ code.locator = stockCode.locator;
8679
+ tables.inlineTokenizers.code = code;
8680
8680
  const precheck = (name2, declines) => {
8681
8681
  const stock = tables.inlineTokenizers[name2];
8682
8682
  if (!stock) throw new Error(`No inline reader named ${name2} to speed up`);
@@ -8749,9 +8749,9 @@ function backtickRuns(value2) {
8749
8749
  let end = at3;
8750
8750
  while (value2.charCodeAt(end) === 96) end++;
8751
8751
  const width = end - at3;
8752
- let list4 = runs.get(width);
8753
- if (!list4) runs.set(width, list4 = []);
8754
- list4.push(at3);
8752
+ let list3 = runs.get(width);
8753
+ if (!list3) runs.set(width, list3 = []);
8754
+ list3.push(at3);
8755
8755
  at3 = value2.indexOf("`", end);
8756
8756
  }
8757
8757
  return runs;
@@ -9195,17 +9195,17 @@ function parseLegacy8(input, options) {
9195
9195
  const definitions = /* @__PURE__ */ new Set();
9196
9196
  const footnotes2 = /* @__PURE__ */ new Set();
9197
9197
  collectDefinitions(tree, definitions, footnotes2);
9198
- const root2 = convert2(
9198
+ const root = convert2(
9199
9199
  tree,
9200
9200
  { doc, definitions, footnotes: footnotes2, options },
9201
9201
  false
9202
9202
  )[0];
9203
- mergeText2(root2);
9204
- clampToParent(root2);
9205
- if (options.lineOffsets) root2.data = { lineOffsets: offsets };
9206
- if (options.math) mathDisplayTransform(root2, doc);
9207
- if (crlf.length > 0) restoreCrlf(root2, crlf);
9208
- return root2;
9203
+ mergeText2(root);
9204
+ clampToParent(root);
9205
+ if (options.lineOffsets) root.data = { lineOffsets: offsets };
9206
+ if (options.math) mathDisplayTransform(root, doc);
9207
+ if (crlf.length > 0) restoreCrlf(root, crlf);
9208
+ return root;
9209
9209
  }
9210
9210
 
9211
9211
  // src/lib/comment-hoist.ts
@@ -9215,18 +9215,18 @@ var CONTAINERS = /* @__PURE__ */ new Set(["list", "blockquote", "callout"]);
9215
9215
  function commentHoistTransform(tree, source) {
9216
9216
  visit(tree, "paragraph", (node2, index, parent) => {
9217
9217
  if (!parent || typeof index !== "number") return;
9218
- const paragraph3 = node2;
9219
- const lead = paragraph3.children[0];
9218
+ const paragraph2 = node2;
9219
+ const lead = paragraph2.children[0];
9220
9220
  if (!lead || lead.type !== "comment" || !spansLines(lead)) return;
9221
- if (lead.position?.start?.offset !== paragraph3.position?.start?.offset) {
9221
+ if (lead.position?.start?.offset !== paragraph2.position?.start?.offset) {
9222
9222
  return;
9223
9223
  }
9224
- paragraph3.children.shift();
9225
- if (paragraph3.position && lead.position?.end) {
9226
- paragraph3.position.start = { ...lead.position.end };
9224
+ paragraph2.children.shift();
9225
+ if (paragraph2.position && lead.position?.end) {
9226
+ paragraph2.position.start = { ...lead.position.end };
9227
9227
  }
9228
9228
  const siblings = parent.children;
9229
- const remaining = paragraph3.children.length > 0;
9229
+ const remaining = paragraph2.children.length > 0;
9230
9230
  siblings.splice(index, remaining ? 0 : 1, lead);
9231
9231
  return index + (remaining ? 2 : 1);
9232
9232
  });
@@ -9290,7 +9290,7 @@ var QUOTE_PREFIX = /^[ \t]*>[ \t]?/u;
9290
9290
  var LEADING_QUOTES = /^(?:[ \t]*>[ \t]?)*/u;
9291
9291
  function mapLines(source, start, end, startLine, quoteDepth2) {
9292
9292
  const raw = source.slice(start, end).split("\n");
9293
- const text4 = [];
9293
+ const text3 = [];
9294
9294
  const starts = [];
9295
9295
  const lines = [];
9296
9296
  let offset = start;
@@ -9309,25 +9309,25 @@ function mapLines(source, start, end, startLine, quoteDepth2) {
9309
9309
  }
9310
9310
  starts.push(offset + prefix2.length);
9311
9311
  lines.push(startLine + index);
9312
- text4.push(line.slice(prefix2.length));
9312
+ text3.push(line.slice(prefix2.length));
9313
9313
  offset += line.length + 1;
9314
9314
  }
9315
- return { text: text4.join("\n"), starts, lines };
9315
+ return { text: text3.join("\n"), starts, lines };
9316
9316
  }
9317
- function shiftByMap(node2, map3, from) {
9317
+ function shiftByMap(node2, map, from) {
9318
9318
  const candidate = node2;
9319
9319
  if (candidate.position) {
9320
9320
  for (const point of [candidate.position.start, candidate.position.end]) {
9321
9321
  const index = from + point.line - 1;
9322
- const lineStart = map3.starts[index];
9323
- const line = map3.lines[index];
9322
+ const lineStart = map.starts[index];
9323
+ const line = map.lines[index];
9324
9324
  if (lineStart !== void 0 && line !== void 0) {
9325
9325
  point.offset = lineStart + point.column - 1;
9326
9326
  point.line = line;
9327
9327
  }
9328
9328
  }
9329
9329
  }
9330
- for (const child of candidate.children ?? []) shiftByMap(child, map3, from);
9330
+ for (const child of candidate.children ?? []) shiftByMap(child, map, from);
9331
9331
  }
9332
9332
  function paragraphSlice(slice) {
9333
9333
  return slice.replace(/(\r?\n)[ \t]*(?:>[ \t]?)*[ \t]*/gu, "$1");
@@ -9343,14 +9343,14 @@ function commentDefinitionExtentTransform(tree, source, reparse) {
9343
9343
  const parent = node2;
9344
9344
  if (!Array.isArray(parent.children)) return;
9345
9345
  for (let index = 0; index < parent.children.length; index++) {
9346
- const definition3 = parent.children[index];
9347
- if (definition3?.type !== "footnoteDefinition") continue;
9348
- const inner = definition3.children;
9346
+ const definition2 = parent.children[index];
9347
+ if (definition2?.type !== "footnoteDefinition") continue;
9348
+ const inner = definition2.children;
9349
9349
  const comment2 = inner.find((child) => isComment(child));
9350
9350
  if (!isComment(comment2)) continue;
9351
9351
  const from = comment2.position?.start?.offset;
9352
9352
  const ownEnd = comment2.position?.end?.offset;
9353
- const end = definition3.position?.end?.offset;
9353
+ const end = definition2.position?.end?.offset;
9354
9354
  const startLine = comment2.position?.start?.line;
9355
9355
  if (from === void 0 || ownEnd === void 0 || end === void 0 || startLine === void 0) {
9356
9356
  continue;
@@ -9370,14 +9370,14 @@ function commentDefinitionExtentTransform(tree, source, reparse) {
9370
9370
  comment2.position.end = { ...comment2.position.end, offset: cut };
9371
9371
  }
9372
9372
  delete comment2.children;
9373
- if (definition3.position) {
9374
- definition3.position.end = { ...definition3.position.end, offset: cut };
9373
+ if (definition2.position) {
9374
+ definition2.position.end = { ...definition2.position.end, offset: cut };
9375
9375
  }
9376
9376
  const tailFrom = from + lines.slice(0, blank + 1).join("\n").length + 1;
9377
9377
  if (tailFrom >= end) continue;
9378
- const map3 = mapLines(source, tailFrom, end, startLine + blank + 1);
9379
- const tail = reparse(map3.text);
9380
- for (const child of tail.children) shiftByMap(child, map3, 0);
9378
+ const map = mapLines(source, tailFrom, end, startLine + blank + 1);
9379
+ const tail = reparse(map.text);
9380
+ for (const child of tail.children) shiftByMap(child, map, 0);
9381
9381
  parent.children.splice(index + 1, 0, ...tail.children);
9382
9382
  index += tail.children.length;
9383
9383
  }
@@ -9526,11 +9526,11 @@ function commentInDefinitionTransform(tree, source, reparse) {
9526
9526
  if (source === "") return;
9527
9527
  const children = tree.children;
9528
9528
  for (let index = 0; index < children.length; index++) {
9529
- const definition3 = children[index];
9530
- if (definition3?.type !== "footnoteDefinition") continue;
9531
- const last = definition3.children[definition3.children.length - 1];
9529
+ const definition2 = children[index];
9530
+ if (definition2?.type !== "footnoteDefinition") continue;
9531
+ const last = definition2.children[definition2.children.length - 1];
9532
9532
  if (!isComment2(last)) continue;
9533
- const above = definition3.children[definition3.children.length - 2];
9533
+ const above = definition2.children[definition2.children.length - 2];
9534
9534
  if (above?.type !== "paragraph") continue;
9535
9535
  const host = above;
9536
9536
  const hostEnd = host.position?.end?.offset;
@@ -9540,7 +9540,7 @@ function commentInDefinitionTransform(tree, source, reparse) {
9540
9540
  }
9541
9541
  const from = last.position?.start?.offset;
9542
9542
  const to = last.position?.end?.offset;
9543
- definition3.children.pop();
9543
+ definition2.children.pop();
9544
9544
  host.children.push(
9545
9545
  lineEnding(source, from === void 0 ? void 0 : from - 1, from)
9546
9546
  );
@@ -9551,14 +9551,14 @@ function commentInDefinitionTransform(tree, source, reparse) {
9551
9551
  }
9552
9552
  while (index + 1 < children.length) {
9553
9553
  const next = children[index + 1];
9554
- const gapFrom = definition3.position?.end?.offset;
9554
+ const gapFrom = definition2.position?.end?.offset;
9555
9555
  const gapTo = next?.position?.start?.offset;
9556
9556
  if (next?.type !== "paragraph" || gapFrom === void 0 || gapTo === void 0 || source.slice(gapFrom, gapTo) !== "\n") {
9557
9557
  break;
9558
9558
  }
9559
9559
  host.children.push(lineEnding(source, gapFrom, gapTo), ...next.children);
9560
- if (definition3.position && next.position) {
9561
- definition3.position.end = { ...next.position.end };
9560
+ if (definition2.position && next.position) {
9561
+ definition2.position.end = { ...next.position.end };
9562
9562
  }
9563
9563
  children.splice(index + 1, 1);
9564
9564
  }
@@ -9976,9 +9976,9 @@ function referenceAt(source, index) {
9976
9976
  const hex = numeric[1] !== void 0;
9977
9977
  const digits = numeric[2];
9978
9978
  if (!hex && !/^\d+$/u.test(digits)) return void 0;
9979
- const code2 = Number.parseInt(digits, hex ? 16 : 10);
9980
- const text4 = code2 === 0 || code2 > 1114111 || code2 >= 55296 && code2 <= 57343 ? "\uFFFD" : String.fromCodePoint(code2);
9981
- return { text: text4, length: 1 + numeric[0].length };
9979
+ const code = Number.parseInt(digits, hex ? 16 : 10);
9980
+ const text3 = code === 0 || code > 1114111 || code >= 55296 && code <= 57343 ? "\uFFFD" : String.fromCodePoint(code);
9981
+ return { text: text3, length: 1 + numeric[0].length };
9982
9982
  }
9983
9983
  const named = /^([A-Za-z][\dA-Za-z]*)(;?)/u.exec(rest);
9984
9984
  if (!named) return void 0;
@@ -10247,14 +10247,14 @@ function bracketLabelReferences(tree, source) {
10247
10247
  });
10248
10248
  }
10249
10249
  function tailAfter(sibling, from, to, source) {
10250
- const text4 = sibling;
10251
- const start = text4?.position?.start?.offset;
10252
- const end = text4?.position?.end?.offset;
10253
- if (text4?.type === "text" && start !== void 0 && end !== void 0) {
10254
- const aligned = alignToSource(source.slice(start, end), text4.value);
10250
+ const text3 = sibling;
10251
+ const start = text3?.position?.start?.offset;
10252
+ const end = text3?.position?.end?.offset;
10253
+ if (text3?.type === "text" && start !== void 0 && end !== void 0) {
10254
+ const aligned = alignToSource(source.slice(start, end), text3.value);
10255
10255
  if (aligned) {
10256
10256
  const index = aligned.at.findIndex((offset) => start + offset >= from);
10257
- if (index !== -1) return text4.value.slice(index);
10257
+ if (index !== -1) return text3.value.slice(index);
10258
10258
  }
10259
10259
  }
10260
10260
  return decodeString(paragraphSlice(source.slice(from, to)));
@@ -10286,14 +10286,14 @@ function bareFootnoteRefTransform(tree, source = "", options = {}) {
10286
10286
  rejoinSplitReferences(tree, source);
10287
10287
  }
10288
10288
  visit(tree, "text", (node2, index, parent) => {
10289
- const text4 = node2;
10290
- if (!text4.value.includes("[^")) return;
10289
+ const text3 = node2;
10290
+ if (!text3.value.includes("[^")) return;
10291
10291
  if (insideAutolink(parent, source)) return;
10292
- const from = text4.position?.start?.offset;
10293
- const to = text4.position?.end?.offset;
10294
- const startPoint = text4.position?.start;
10292
+ const from = text3.position?.start?.offset;
10293
+ const to = text3.position?.end?.offset;
10294
+ const startPoint = text3.position?.start;
10295
10295
  const slice = source && from !== void 0 && to !== void 0 ? source.slice(from, to) : "";
10296
- const aligned = slice ? alignToSource(slice, text4.value) : null;
10296
+ const aligned = slice ? alignToSource(slice, text3.value) : null;
10297
10297
  const pointAt3 = aligned && from !== void 0 && startPoint ? (valueIndex) => {
10298
10298
  const sliceIndex = aligned.at[valueIndex] ?? slice.length;
10299
10299
  const before2 = slice.slice(0, sliceIndex);
@@ -10322,7 +10322,7 @@ function bareFootnoteRefTransform(tree, source = "", options = {}) {
10322
10322
  REFERENCE.lastIndex = 0;
10323
10323
  const pushText = (valueFrom, valueTo) => {
10324
10324
  if (valueTo <= valueFrom) return;
10325
- const value2 = text4.value.slice(valueFrom, valueTo);
10325
+ const value2 = text3.value.slice(valueFrom, valueTo);
10326
10326
  const previous2 = parts[parts.length - 1];
10327
10327
  if (previous2 && previous2.type === "text") {
10328
10328
  previous2.value += value2;
@@ -10335,7 +10335,7 @@ function bareFootnoteRefTransform(tree, source = "", options = {}) {
10335
10335
  positioned({ type: "text", value: value2 }, valueFrom, valueTo)
10336
10336
  );
10337
10337
  };
10338
- for (let match = REFERENCE.exec(text4.value); match !== null; match = REFERENCE.exec(text4.value)) {
10338
+ for (let match = REFERENCE.exec(text3.value); match !== null; match = REFERENCE.exec(text3.value)) {
10339
10339
  const name2 = match[1];
10340
10340
  if (aligned?.escaped[match.index]) continue;
10341
10341
  if (inClosedComment(source, pointAt3?.(match.index)?.offset)) continue;
@@ -10360,7 +10360,7 @@ function bareFootnoteRefTransform(tree, source = "", options = {}) {
10360
10360
  cursor = match.index + match[0].length;
10361
10361
  }
10362
10362
  if (parts.length === 0) return;
10363
- pushText(cursor, text4.value.length);
10363
+ pushText(cursor, text3.value.length);
10364
10364
  if (!parent || typeof index !== "number") return;
10365
10365
  parent.children.splice(index, 1, ...parts);
10366
10366
  return index + parts.length;
@@ -10494,44 +10494,44 @@ function find(node2, inDefinition, lines) {
10494
10494
  }
10495
10495
  return void 0;
10496
10496
  }
10497
- function continues(definition3, lines) {
10498
- const line = definition3.position?.start.line;
10497
+ function continues(definition2, lines) {
10498
+ const line = definition2.position?.start.line;
10499
10499
  if (line === void 0) return false;
10500
10500
  const raw = lines[line - 1];
10501
10501
  const previous2 = lines[line - 2];
10502
10502
  if (raw === void 0 || previous2 === void 0) return false;
10503
10503
  if (previous2.trim() === "") return false;
10504
- const column = definition3.position?.start.column ?? 1;
10504
+ const column = definition2.position?.start.column ?? 1;
10505
10505
  if (column === 1) return raw.startsWith("[^");
10506
10506
  return column === 5 && LABEL2.test(raw.slice(0, 6));
10507
10507
  }
10508
10508
  function unnest(parent, index, source) {
10509
10509
  const children = parent.children;
10510
10510
  if (!Array.isArray(children)) return;
10511
- const definition3 = children[index];
10512
- if (definition3?.type !== "footnoteDefinition") return;
10513
- const start = definition3.position?.start.offset;
10514
- const inner = definition3.children[0];
10515
- const label = labelText(definition3, source, start);
10511
+ const definition2 = children[index];
10512
+ if (definition2?.type !== "footnoteDefinition") return;
10513
+ const start = definition2.position?.start.offset;
10514
+ const inner = definition2.children[0];
10515
+ const label = labelText(definition2, source, start);
10516
10516
  if (start === void 0 || inner === void 0 || label === void 0) {
10517
10517
  children.splice(index, 1);
10518
10518
  return;
10519
10519
  }
10520
10520
  if (inner.type === "paragraph") inner.children.unshift(label);
10521
- if (inner.position && definition3.position)
10522
- inner.position.start = { ...definition3.position.start };
10523
- children.splice(index, 1, ...definition3.children);
10521
+ if (inner.position && definition2.position)
10522
+ inner.position.start = { ...definition2.position.start };
10523
+ children.splice(index, 1, ...definition2.children);
10524
10524
  }
10525
- function labelText(definition3, source, start) {
10525
+ function labelText(definition2, source, start) {
10526
10526
  if (start === void 0) return void 0;
10527
- const end = firstContentOffset(definition3);
10527
+ const end = firstContentOffset(definition2);
10528
10528
  if (end === void 0 || end <= start) return void 0;
10529
10529
  return {
10530
10530
  type: "text",
10531
10531
  value: source.slice(start, end),
10532
10532
  position: {
10533
- start: { ...definition3.position.start },
10534
- end: offsetPoint(definition3, end)
10533
+ start: { ...definition2.position.start },
10534
+ end: offsetPoint(definition2, end)
10535
10535
  }
10536
10536
  };
10537
10537
  }
@@ -10540,8 +10540,8 @@ function firstContentOffset(node2) {
10540
10540
  if (!child) return void 0;
10541
10541
  return firstContentOffset(child) ?? child.position?.start.offset;
10542
10542
  }
10543
- function offsetPoint(definition3, offset) {
10544
- const start = definition3.position.start;
10543
+ function offsetPoint(definition2, offset) {
10544
+ const start = definition2.position.start;
10545
10545
  return {
10546
10546
  line: start.line,
10547
10547
  column: start.column + (offset - (start.offset ?? offset)),
@@ -10556,15 +10556,15 @@ function definitionMathAbsorbTransform(tree, source) {
10556
10556
  const item = node2;
10557
10557
  if (!Array.isArray(item.children)) return;
10558
10558
  for (let index = item.children.length - 2; index >= 0; index--) {
10559
- const definition3 = item.children[index];
10559
+ const definition2 = item.children[index];
10560
10560
  const math3 = item.children[index + 1];
10561
- if (definition3?.type !== "footnoteDefinition" || math3?.type !== "math") {
10561
+ if (definition2?.type !== "footnoteDefinition" || math3?.type !== "math") {
10562
10562
  continue;
10563
10563
  }
10564
10564
  const from = math3.position?.start?.offset;
10565
10565
  const to = math3.position?.end?.offset;
10566
10566
  if (from === void 0 || to === void 0) continue;
10567
- if (math3.position.start.line !== (definition3.position?.end.line ?? -1) + 1) {
10567
+ if (math3.position.start.line !== (definition2.position?.end.line ?? -1) + 1) {
10568
10568
  continue;
10569
10569
  }
10570
10570
  const lineEnd2 = source.indexOf("\n", from);
@@ -10577,17 +10577,17 @@ function definitionMathAbsorbTransform(tree, source) {
10577
10577
  offset: reach
10578
10578
  };
10579
10579
  math3.position.end = { ...end };
10580
- definition3.position.end = { ...end };
10581
- definition3.children.push(math3);
10580
+ definition2.position.end = { ...end };
10581
+ definition2.children.push(math3);
10582
10582
  item.children.splice(index + 1, 1);
10583
10583
  if (item.position && item.position.end.offset !== void 0) {
10584
10584
  if (item.position.end.offset > reach) item.position.end = { ...end };
10585
10585
  }
10586
10586
  visit(tree, "list", (host) => {
10587
- const list4 = host;
10588
- if (!list4.children.includes(item)) return;
10589
- if (list4.position && (list4.position.end.offset ?? 0) > reach) {
10590
- list4.position.end = { ...end };
10587
+ const list3 = host;
10588
+ if (!list3.children.includes(item)) return;
10589
+ if (list3.position && (list3.position.end.offset ?? 0) > reach) {
10590
+ list3.position.end = { ...end };
10591
10591
  }
10592
10592
  });
10593
10593
  }
@@ -10618,16 +10618,16 @@ function definitionEndBeforeLabelTransform(tree, source) {
10618
10618
  if (!start || !end) return;
10619
10619
  const ownDepth = quoteDepth(lines[start.line - 1] ?? "");
10620
10620
  for (let line = start.line; line < end.line; line++) {
10621
- const text4 = lines[line] ?? "";
10622
- const inner = text4.replace(QUOTE_PREFIX2, "");
10623
- if (inner !== text4) {
10624
- const deeper = ownDepth > 0 && quoteDepth(text4) > ownDepth;
10621
+ const text3 = lines[line] ?? "";
10622
+ const inner = text3.replace(QUOTE_PREFIX2, "");
10623
+ if (inner !== text3) {
10624
+ const deeper = ownDepth > 0 && quoteDepth(text3) > ownDepth;
10625
10625
  const start2 = CANNOT_INTERRUPT.exec(inner);
10626
10626
  if (start2 && Number(start2[1]) !== 1) continue;
10627
10627
  if (!deeper && !QUOTED_BLOCK_OPENER.test(inner)) continue;
10628
10628
  } else {
10629
- if (/^[ \t]/u.test(text4)) continue;
10630
- if (!LABEL3.test(text4)) continue;
10629
+ if (/^[ \t]/u.test(text3)) continue;
10630
+ if (!LABEL3.test(text3)) continue;
10631
10631
  }
10632
10632
  let offset = 0;
10633
10633
  for (let at3 = 0; at3 < line - 1; at3++) {
@@ -10879,26 +10879,26 @@ var LEFT_BRACKET = 91;
10879
10879
  var BACKSLASH = 92;
10880
10880
  var RIGHT_BRACKET = 93;
10881
10881
  var PIPE = 124;
10882
- function isLineEnding(code2) {
10883
- return code2 === codes.lineFeed || code2 === codes.carriageReturn || code2 === codes.carriageReturnLineFeed || // U+2028 and U+2029, which Obsidian also reads as ending a wikilink (found by
10882
+ function isLineEnding(code) {
10883
+ return code === codes.lineFeed || code === codes.carriageReturn || code === codes.carriageReturnLineFeed || // U+2028 and U+2029, which Obsidian also reads as ending a wikilink (found by
10884
10884
  // `fuzz/charclass-sweep.ts`); micromark does not count them as line endings.
10885
- code2 === 8232 || code2 === 8233;
10885
+ code === 8232 || code === 8233;
10886
10886
  }
10887
10887
  var closerAhead = {
10888
10888
  partial: true,
10889
10889
  tokenize(effects, ok3, nok) {
10890
10890
  return first;
10891
- function first(code2) {
10892
- if (code2 !== RIGHT_BRACKET) return nok(code2);
10891
+ function first(code) {
10892
+ if (code !== RIGHT_BRACKET) return nok(code);
10893
10893
  effects.enter("wikilinkCloserCheck");
10894
- effects.consume(code2);
10894
+ effects.consume(code);
10895
10895
  return second;
10896
10896
  }
10897
- function second(code2) {
10898
- if (code2 !== RIGHT_BRACKET) return nok(code2);
10899
- effects.consume(code2);
10897
+ function second(code) {
10898
+ if (code !== RIGHT_BRACKET) return nok(code);
10899
+ effects.consume(code);
10900
10900
  effects.exit("wikilinkCloserCheck");
10901
- return ok3(code2);
10901
+ return ok3(code);
10902
10902
  }
10903
10903
  }
10904
10904
  };
@@ -10916,223 +10916,223 @@ function tokenize(effects, ok3, nok) {
10916
10916
  let hasHeading = false;
10917
10917
  let hasAlias = false;
10918
10918
  return start;
10919
- function start(code2) {
10920
- if (code2 === EXCLAMATION) {
10919
+ function start(code) {
10920
+ if (code === EXCLAMATION) {
10921
10921
  effects.enter("wikilink");
10922
10922
  effects.enter("wikilinkEmbedMarker");
10923
- effects.consume(code2);
10923
+ effects.consume(code);
10924
10924
  effects.exit("wikilinkEmbedMarker");
10925
10925
  return openFirst;
10926
10926
  }
10927
- if (code2 === LEFT_BRACKET) {
10927
+ if (code === LEFT_BRACKET) {
10928
10928
  effects.enter("wikilink");
10929
- return openFirst(code2);
10929
+ return openFirst(code);
10930
10930
  }
10931
- return nok(code2);
10931
+ return nok(code);
10932
10932
  }
10933
- function openFirst(code2) {
10934
- if (code2 !== LEFT_BRACKET) return nok(code2);
10933
+ function openFirst(code) {
10934
+ if (code !== LEFT_BRACKET) return nok(code);
10935
10935
  effects.enter("wikilinkMarker");
10936
- effects.consume(code2);
10936
+ effects.consume(code);
10937
10937
  return openSecond;
10938
10938
  }
10939
- function openSecond(code2) {
10940
- if (code2 !== LEFT_BRACKET) return nok(code2);
10941
- effects.consume(code2);
10939
+ function openSecond(code) {
10940
+ if (code !== LEFT_BRACKET) return nok(code);
10941
+ effects.consume(code);
10942
10942
  effects.exit("wikilinkMarker");
10943
10943
  return pathStart;
10944
10944
  }
10945
- function pathStart(code2) {
10946
- if (code2 === HASH) return headingMarker(code2);
10947
- if (code2 === null || isLineEnding(code2)) return nok(code2);
10945
+ function pathStart(code) {
10946
+ if (code === HASH) return headingMarker(code);
10947
+ if (code === null || isLineEnding(code)) return nok(code);
10948
10948
  effects.enter("wikilinkPath");
10949
10949
  hasPath = true;
10950
- if (code2 === PIPE) {
10950
+ if (code === PIPE) {
10951
10951
  pathChars++;
10952
- effects.consume(code2);
10952
+ effects.consume(code);
10953
10953
  return path;
10954
10954
  }
10955
- return path(code2);
10955
+ return path(code);
10956
10956
  }
10957
- function path(code2) {
10958
- if (code2 === BACKSLASH) {
10957
+ function path(code) {
10958
+ if (code === BACKSLASH) {
10959
10959
  pathChars++;
10960
- effects.consume(code2);
10960
+ effects.consume(code);
10961
10961
  return pathEscape;
10962
10962
  }
10963
- if (code2 === LEFT_BRACKET) {
10963
+ if (code === LEFT_BRACKET) {
10964
10964
  pathChars++;
10965
- effects.consume(code2);
10965
+ effects.consume(code);
10966
10966
  return pathBracket;
10967
10967
  }
10968
- if (code2 === HASH) {
10968
+ if (code === HASH) {
10969
10969
  effects.exit("wikilinkPath");
10970
- return headingMarker(code2);
10970
+ return headingMarker(code);
10971
10971
  }
10972
- if (code2 === PIPE) {
10972
+ if (code === PIPE) {
10973
10973
  effects.exit("wikilinkPath");
10974
- return aliasMarker(code2);
10974
+ return aliasMarker(code);
10975
10975
  }
10976
- if (code2 === RIGHT_BRACKET) {
10977
- return effects.check(closerAhead, pathCloses, pathLiteralBracket)(code2);
10976
+ if (code === RIGHT_BRACKET) {
10977
+ return effects.check(closerAhead, pathCloses, pathLiteralBracket)(code);
10978
10978
  }
10979
- if (code2 === null || isLineEnding(code2)) return nok(code2);
10979
+ if (code === null || isLineEnding(code)) return nok(code);
10980
10980
  pathChars++;
10981
- effects.consume(code2);
10981
+ effects.consume(code);
10982
10982
  return path;
10983
10983
  }
10984
- function pathCloses(code2) {
10985
- if (pathChars === 0) return pathLiteralBracket(code2);
10984
+ function pathCloses(code) {
10985
+ if (pathChars === 0) return pathLiteralBracket(code);
10986
10986
  effects.exit("wikilinkPath");
10987
- return closeFirst(code2);
10987
+ return closeFirst(code);
10988
10988
  }
10989
- function pathLiteralBracket(code2) {
10989
+ function pathLiteralBracket(code) {
10990
10990
  pathChars++;
10991
- effects.consume(code2);
10991
+ effects.consume(code);
10992
10992
  return path;
10993
10993
  }
10994
- function pathBracket(code2) {
10995
- if (code2 === LEFT_BRACKET) return nok(code2);
10996
- return path(code2);
10994
+ function pathBracket(code) {
10995
+ if (code === LEFT_BRACKET) return nok(code);
10996
+ return path(code);
10997
10997
  }
10998
- function pathEscape(code2) {
10999
- if (code2 === PIPE) {
10998
+ function pathEscape(code) {
10999
+ if (code === PIPE) {
11000
11000
  effects.exit("wikilinkPath");
11001
- return aliasMarker(code2);
11001
+ return aliasMarker(code);
11002
11002
  }
11003
- if (code2 === RIGHT_BRACKET) return path(code2);
11004
- if (code2 === HASH) {
11003
+ if (code === RIGHT_BRACKET) return path(code);
11004
+ if (code === HASH) {
11005
11005
  effects.exit("wikilinkPath");
11006
- return headingMarker(code2);
11006
+ return headingMarker(code);
11007
11007
  }
11008
- if (code2 === null || isLineEnding(code2)) return nok(code2);
11009
- if (code2 === LEFT_BRACKET) {
11008
+ if (code === null || isLineEnding(code)) return nok(code);
11009
+ if (code === LEFT_BRACKET) {
11010
11010
  pathChars++;
11011
- effects.consume(code2);
11011
+ effects.consume(code);
11012
11012
  return pathBracket;
11013
11013
  }
11014
- effects.consume(code2);
11014
+ effects.consume(code);
11015
11015
  return path;
11016
11016
  }
11017
- function headingMarker(code2) {
11018
- if (code2 !== HASH) return nok(code2);
11017
+ function headingMarker(code) {
11018
+ if (code !== HASH) return nok(code);
11019
11019
  effects.enter("wikilinkHeadingMarker");
11020
- effects.consume(code2);
11020
+ effects.consume(code);
11021
11021
  effects.exit("wikilinkHeadingMarker");
11022
11022
  return headingStart;
11023
11023
  }
11024
- function headingStart(code2) {
11025
- if (code2 === null || isLineEnding(code2)) return nok(code2);
11026
- if (code2 === RIGHT_BRACKET) {
11024
+ function headingStart(code) {
11025
+ if (code === null || isLineEnding(code)) return nok(code);
11026
+ if (code === RIGHT_BRACKET) {
11027
11027
  hasHeading = true;
11028
- return closeFirst(code2);
11028
+ return closeFirst(code);
11029
11029
  }
11030
- if (code2 === PIPE) {
11030
+ if (code === PIPE) {
11031
11031
  hasHeading = true;
11032
- return aliasMarker(code2);
11032
+ return aliasMarker(code);
11033
11033
  }
11034
11034
  effects.enter("wikilinkHeading");
11035
11035
  hasHeading = true;
11036
- return heading2(code2);
11036
+ return heading(code);
11037
11037
  }
11038
- function heading2(code2) {
11039
- if (code2 === BACKSLASH) {
11040
- effects.consume(code2);
11038
+ function heading(code) {
11039
+ if (code === BACKSLASH) {
11040
+ effects.consume(code);
11041
11041
  return headingEscape;
11042
11042
  }
11043
- if (code2 === PIPE) {
11043
+ if (code === PIPE) {
11044
11044
  effects.exit("wikilinkHeading");
11045
- return aliasMarker(code2);
11045
+ return aliasMarker(code);
11046
11046
  }
11047
- if (code2 === RIGHT_BRACKET) {
11047
+ if (code === RIGHT_BRACKET) {
11048
11048
  return effects.check(
11049
11049
  closerAhead,
11050
11050
  headingCloses,
11051
11051
  headingLiteralBracket
11052
- )(code2);
11052
+ )(code);
11053
11053
  }
11054
- if (code2 === LEFT_BRACKET) {
11055
- effects.consume(code2);
11054
+ if (code === LEFT_BRACKET) {
11055
+ effects.consume(code);
11056
11056
  return headingBracket;
11057
11057
  }
11058
- if (code2 === null || isLineEnding(code2)) return nok(code2);
11059
- effects.consume(code2);
11060
- return heading2;
11058
+ if (code === null || isLineEnding(code)) return nok(code);
11059
+ effects.consume(code);
11060
+ return heading;
11061
11061
  }
11062
- function headingCloses(code2) {
11062
+ function headingCloses(code) {
11063
11063
  effects.exit("wikilinkHeading");
11064
- return closeFirst(code2);
11064
+ return closeFirst(code);
11065
11065
  }
11066
- function headingLiteralBracket(code2) {
11067
- effects.consume(code2);
11068
- return heading2;
11066
+ function headingLiteralBracket(code) {
11067
+ effects.consume(code);
11068
+ return heading;
11069
11069
  }
11070
- function headingBracket(code2) {
11071
- if (code2 === LEFT_BRACKET) return nok(code2);
11072
- return heading2(code2);
11070
+ function headingBracket(code) {
11071
+ if (code === LEFT_BRACKET) return nok(code);
11072
+ return heading(code);
11073
11073
  }
11074
- function headingEscape(code2) {
11075
- if (code2 === PIPE) {
11074
+ function headingEscape(code) {
11075
+ if (code === PIPE) {
11076
11076
  effects.exit("wikilinkHeading");
11077
- return aliasMarker(code2);
11077
+ return aliasMarker(code);
11078
11078
  }
11079
- if (code2 === RIGHT_BRACKET) return heading2(code2);
11080
- if (code2 === null || isLineEnding(code2)) return nok(code2);
11081
- if (code2 === LEFT_BRACKET) {
11082
- effects.consume(code2);
11079
+ if (code === RIGHT_BRACKET) return heading(code);
11080
+ if (code === null || isLineEnding(code)) return nok(code);
11081
+ if (code === LEFT_BRACKET) {
11082
+ effects.consume(code);
11083
11083
  return headingBracket;
11084
11084
  }
11085
- effects.consume(code2);
11086
- return heading2;
11085
+ effects.consume(code);
11086
+ return heading;
11087
11087
  }
11088
- function aliasMarker(code2) {
11089
- if (code2 !== PIPE) return nok(code2);
11088
+ function aliasMarker(code) {
11089
+ if (code !== PIPE) return nok(code);
11090
11090
  effects.enter("wikilinkAliasMarker");
11091
- effects.consume(code2);
11091
+ effects.consume(code);
11092
11092
  effects.exit("wikilinkAliasMarker");
11093
11093
  return aliasStart;
11094
11094
  }
11095
- function aliasStart(code2) {
11096
- if (code2 === RIGHT_BRACKET) return closeFirst(code2);
11097
- if (code2 === null || isLineEnding(code2)) return nok(code2);
11095
+ function aliasStart(code) {
11096
+ if (code === RIGHT_BRACKET) return closeFirst(code);
11097
+ if (code === null || isLineEnding(code)) return nok(code);
11098
11098
  effects.enter("wikilinkAlias");
11099
11099
  hasAlias = true;
11100
- return alias(code2);
11100
+ return alias(code);
11101
11101
  }
11102
- function alias(code2) {
11103
- if (code2 === RIGHT_BRACKET) {
11104
- return effects.check(closerAhead, aliasCloses, aliasLiteralBracket)(code2);
11102
+ function alias(code) {
11103
+ if (code === RIGHT_BRACKET) {
11104
+ return effects.check(closerAhead, aliasCloses, aliasLiteralBracket)(code);
11105
11105
  }
11106
- if (code2 === LEFT_BRACKET) {
11107
- effects.consume(code2);
11106
+ if (code === LEFT_BRACKET) {
11107
+ effects.consume(code);
11108
11108
  return aliasBracket;
11109
11109
  }
11110
- if (code2 === null || isLineEnding(code2)) return nok(code2);
11111
- effects.consume(code2);
11110
+ if (code === null || isLineEnding(code)) return nok(code);
11111
+ effects.consume(code);
11112
11112
  return alias;
11113
11113
  }
11114
- function aliasCloses(code2) {
11114
+ function aliasCloses(code) {
11115
11115
  effects.exit("wikilinkAlias");
11116
- return closeFirst(code2);
11116
+ return closeFirst(code);
11117
11117
  }
11118
- function aliasLiteralBracket(code2) {
11119
- effects.consume(code2);
11118
+ function aliasLiteralBracket(code) {
11119
+ effects.consume(code);
11120
11120
  return alias;
11121
11121
  }
11122
- function aliasBracket(code2) {
11123
- if (code2 === LEFT_BRACKET) return nok(code2);
11124
- return alias(code2);
11122
+ function aliasBracket(code) {
11123
+ if (code === LEFT_BRACKET) return nok(code);
11124
+ return alias(code);
11125
11125
  }
11126
- function closeFirst(code2) {
11127
- if (code2 !== RIGHT_BRACKET) return nok(code2);
11128
- if (!hasPath && !hasHeading && !hasAlias) return nok(code2);
11126
+ function closeFirst(code) {
11127
+ if (code !== RIGHT_BRACKET) return nok(code);
11128
+ if (!hasPath && !hasHeading && !hasAlias) return nok(code);
11129
11129
  effects.enter("wikilinkMarker");
11130
- effects.consume(code2);
11130
+ effects.consume(code);
11131
11131
  return closeSecond;
11132
11132
  }
11133
- function closeSecond(code2) {
11134
- if (code2 !== RIGHT_BRACKET) return nok(code2);
11135
- effects.consume(code2);
11133
+ function closeSecond(code) {
11134
+ if (code !== RIGHT_BRACKET) return nok(code);
11135
+ effects.consume(code);
11136
11136
  effects.exit("wikilinkMarker");
11137
11137
  effects.exit("wikilink");
11138
11138
  return ok3;
@@ -11144,8 +11144,8 @@ var PERCENT = 37;
11144
11144
  var LINE_FEED = -4;
11145
11145
  var CARRIAGE_RETURN = -3;
11146
11146
  var CARRIAGE_RETURN_LINE_FEED = -5;
11147
- function isLineEnding2(code2) {
11148
- return code2 === LINE_FEED || code2 === CARRIAGE_RETURN || code2 === CARRIAGE_RETURN_LINE_FEED;
11147
+ function isLineEnding2(code) {
11148
+ return code === LINE_FEED || code === CARRIAGE_RETURN || code === CARRIAGE_RETURN_LINE_FEED;
11149
11149
  }
11150
11150
  var commentFlow = {
11151
11151
  tokenize: tokenizeFlow,
@@ -11160,27 +11160,27 @@ var noCloserOnOpeningLine = {
11160
11160
  partial: true,
11161
11161
  tokenize(effects, ok3, nok) {
11162
11162
  return start;
11163
- function start(code2) {
11164
- if (code2 !== PERCENT) return nok(code2);
11163
+ function start(code) {
11164
+ if (code !== PERCENT) return nok(code);
11165
11165
  effects.enter("chunkString", { contentType: "string" });
11166
- effects.consume(code2);
11166
+ effects.consume(code);
11167
11167
  return second;
11168
11168
  }
11169
- function second(code2) {
11170
- if (code2 !== PERCENT) return nok(code2);
11171
- effects.consume(code2);
11169
+ function second(code) {
11170
+ if (code !== PERCENT) return nok(code);
11171
+ effects.consume(code);
11172
11172
  return scan;
11173
11173
  }
11174
- function scan(code2) {
11175
- if (code2 === null || isLineEnding2(code2)) {
11174
+ function scan(code) {
11175
+ if (code === null || isLineEnding2(code)) {
11176
11176
  effects.exit("chunkString");
11177
- return ok3(code2);
11177
+ return ok3(code);
11178
11178
  }
11179
- if (code2 === PERCENT) {
11179
+ if (code === PERCENT) {
11180
11180
  effects.exit("chunkString");
11181
- return nok(code2);
11181
+ return nok(code);
11182
11182
  }
11183
- effects.consume(code2);
11183
+ effects.consume(code);
11184
11184
  return scan;
11185
11185
  }
11186
11186
  }
@@ -11207,73 +11207,73 @@ function tokenizeText(effects, ok3, nok) {
11207
11207
  firstLine = false;
11208
11208
  return true;
11209
11209
  }
11210
- function strayStart(code2) {
11210
+ function strayStart(code) {
11211
11211
  if (firstLine) strayPercent = true;
11212
- return startContent(code2);
11212
+ return startContent(code);
11213
11213
  }
11214
- function strayConsume(code2) {
11214
+ function strayConsume(code) {
11215
11215
  if (firstLine) strayPercent = true;
11216
- return contentConsume(code2);
11216
+ return contentConsume(code);
11217
11217
  }
11218
- function start(code2) {
11219
- if (code2 !== PERCENT) return nok(code2);
11218
+ function start(code) {
11219
+ if (code !== PERCENT) return nok(code);
11220
11220
  effects.enter("comment");
11221
11221
  effects.enter("commentMarker");
11222
- effects.consume(code2);
11222
+ effects.consume(code);
11223
11223
  return openSecond;
11224
11224
  }
11225
- function openSecond(code2) {
11226
- if (code2 !== PERCENT) return nok(code2);
11227
- effects.consume(code2);
11225
+ function openSecond(code) {
11226
+ if (code !== PERCENT) return nok(code);
11227
+ effects.consume(code);
11228
11228
  effects.exit("commentMarker");
11229
11229
  return atContentBoundary;
11230
11230
  }
11231
- function atContentBoundary(code2) {
11232
- if (code2 === null) return nok(code2);
11233
- if (isLineEnding2(code2)) {
11234
- if (!spansLines2()) return nok(code2);
11235
- return effects.attempt(nonLazyContinuation, atContentBoundary, nok)(code2);
11231
+ function atContentBoundary(code) {
11232
+ if (code === null) return nok(code);
11233
+ if (isLineEnding2(code)) {
11234
+ if (!spansLines2()) return nok(code);
11235
+ return effects.attempt(nonLazyContinuation, atContentBoundary, nok)(code);
11236
11236
  }
11237
- if (code2 === PERCENT) {
11238
- return effects.attempt(closeFromBoundary, closeAfter, strayStart)(code2);
11237
+ if (code === PERCENT) {
11238
+ return effects.attempt(closeFromBoundary, closeAfter, strayStart)(code);
11239
11239
  }
11240
11240
  effects.enter("commentContent");
11241
- effects.consume(code2);
11241
+ effects.consume(code);
11242
11242
  return content;
11243
11243
  }
11244
- function startContent(code2) {
11245
- if (code2 === null) return nok(code2);
11244
+ function startContent(code) {
11245
+ if (code === null) return nok(code);
11246
11246
  effects.enter("commentContent");
11247
- effects.consume(code2);
11247
+ effects.consume(code);
11248
11248
  return content;
11249
11249
  }
11250
- function content(code2) {
11251
- if (code2 === null) {
11250
+ function content(code) {
11251
+ if (code === null) {
11252
11252
  effects.exit("commentContent");
11253
- return nok(code2);
11253
+ return nok(code);
11254
11254
  }
11255
- if (isLineEnding2(code2)) {
11255
+ if (isLineEnding2(code)) {
11256
11256
  effects.exit("commentContent");
11257
- if (!spansLines2()) return nok(code2);
11258
- return effects.attempt(nonLazyContinuation, atContentBoundary, nok)(code2);
11257
+ if (!spansLines2()) return nok(code);
11258
+ return effects.attempt(nonLazyContinuation, atContentBoundary, nok)(code);
11259
11259
  }
11260
- if (code2 === PERCENT) {
11261
- return effects.attempt(closeFromContent, closeAfter, strayConsume)(code2);
11260
+ if (code === PERCENT) {
11261
+ return effects.attempt(closeFromContent, closeAfter, strayConsume)(code);
11262
11262
  }
11263
- effects.consume(code2);
11263
+ effects.consume(code);
11264
11264
  return content;
11265
11265
  }
11266
- function contentConsume(code2) {
11267
- if (code2 === null) {
11266
+ function contentConsume(code) {
11267
+ if (code === null) {
11268
11268
  effects.exit("commentContent");
11269
- return nok(code2);
11269
+ return nok(code);
11270
11270
  }
11271
- effects.consume(code2);
11271
+ effects.consume(code);
11272
11272
  return content;
11273
11273
  }
11274
- function closeAfter(code2) {
11274
+ function closeAfter(code) {
11275
11275
  effects.exit("comment");
11276
- return ok3(code2);
11276
+ return ok3(code);
11277
11277
  }
11278
11278
  function createClose(hasOpenContent) {
11279
11279
  return {
@@ -11304,107 +11304,107 @@ function tokenizeFlow(effects, ok3, nok) {
11304
11304
  partial: true
11305
11305
  };
11306
11306
  return checkOpeningLine;
11307
- function checkOpeningLine(code2) {
11308
- return effects.check(noCloserOnOpeningLine, start, nok)(code2);
11307
+ function checkOpeningLine(code) {
11308
+ return effects.check(noCloserOnOpeningLine, start, nok)(code);
11309
11309
  }
11310
- function start(code2) {
11311
- if (code2 !== PERCENT) return nok(code2);
11310
+ function start(code) {
11311
+ if (code !== PERCENT) return nok(code);
11312
11312
  effects.enter("comment");
11313
11313
  effects.enter("commentMarker");
11314
- effects.consume(code2);
11314
+ effects.consume(code);
11315
11315
  return openSecond;
11316
11316
  }
11317
- function openSecond(code2) {
11318
- if (code2 !== PERCENT) return nok(code2);
11319
- effects.consume(code2);
11317
+ function openSecond(code) {
11318
+ if (code !== PERCENT) return nok(code);
11319
+ effects.consume(code);
11320
11320
  effects.exit("commentMarker");
11321
11321
  return beforeContentChunk;
11322
11322
  }
11323
- function beforeContentChunk(code2) {
11324
- if (code2 === null) {
11323
+ function beforeContentChunk(code) {
11324
+ if (code === null) {
11325
11325
  effects.exit("comment");
11326
- return ok3(code2);
11326
+ return ok3(code);
11327
11327
  }
11328
- if (isLineEnding2(code2)) {
11328
+ if (isLineEnding2(code)) {
11329
11329
  return effects.attempt(
11330
11330
  nonLazyContinuation,
11331
11331
  beforeContentChunk,
11332
11332
  afterLazy
11333
- )(code2);
11333
+ )(code);
11334
11334
  }
11335
- if (code2 === PERCENT) {
11335
+ if (code === PERCENT) {
11336
11336
  return effects.attempt(
11337
11337
  flowClose,
11338
11338
  closeAfterLineStart,
11339
11339
  startContent
11340
- )(code2);
11340
+ )(code);
11341
11341
  }
11342
11342
  effects.enter("commentContent");
11343
- return contentChunk(code2);
11343
+ return contentChunk(code);
11344
11344
  }
11345
- function startContent(code2) {
11345
+ function startContent(code) {
11346
11346
  effects.enter("commentContent");
11347
- effects.consume(code2);
11347
+ effects.consume(code);
11348
11348
  return contentChunk;
11349
11349
  }
11350
- function contentChunk(code2) {
11351
- if (code2 === null) {
11350
+ function contentChunk(code) {
11351
+ if (code === null) {
11352
11352
  effects.exit("commentContent");
11353
11353
  effects.exit("comment");
11354
- return ok3(code2);
11354
+ return ok3(code);
11355
11355
  }
11356
- if (code2 === PERCENT) {
11356
+ if (code === PERCENT) {
11357
11357
  return effects.attempt(
11358
11358
  flowClose,
11359
11359
  closeAfterMidLine,
11360
11360
  contentConsume
11361
- )(code2);
11361
+ )(code);
11362
11362
  }
11363
- if (isLineEnding2(code2)) {
11363
+ if (isLineEnding2(code)) {
11364
11364
  effects.exit("commentContent");
11365
11365
  return effects.attempt(
11366
11366
  nonLazyContinuation,
11367
11367
  beforeContentChunk,
11368
11368
  afterLazy
11369
- )(code2);
11369
+ )(code);
11370
11370
  }
11371
- effects.consume(code2);
11371
+ effects.consume(code);
11372
11372
  return contentChunk;
11373
11373
  }
11374
- function contentConsume(code2) {
11375
- if (code2 === null) {
11374
+ function contentConsume(code) {
11375
+ if (code === null) {
11376
11376
  effects.exit("commentContent");
11377
11377
  effects.exit("comment");
11378
- return ok3(code2);
11378
+ return ok3(code);
11379
11379
  }
11380
- effects.consume(code2);
11380
+ effects.consume(code);
11381
11381
  return contentChunk;
11382
11382
  }
11383
- function closeAfterLineStart(code2) {
11384
- if (code2 === null || isLineEnding2(code2)) {
11383
+ function closeAfterLineStart(code) {
11384
+ if (code === null || isLineEnding2(code)) {
11385
11385
  effects.exit("comment");
11386
- return ok3(code2);
11386
+ return ok3(code);
11387
11387
  }
11388
11388
  effects.enter("commentContent");
11389
- return absorbCloserLine(code2);
11389
+ return absorbCloserLine(code);
11390
11390
  }
11391
- function absorbCloserLine(code2) {
11392
- if (code2 === null || isLineEnding2(code2)) {
11391
+ function absorbCloserLine(code) {
11392
+ if (code === null || isLineEnding2(code)) {
11393
11393
  effects.exit("commentContent");
11394
11394
  effects.exit("comment");
11395
- return ok3(code2);
11395
+ return ok3(code);
11396
11396
  }
11397
- effects.consume(code2);
11397
+ effects.consume(code);
11398
11398
  return absorbCloserLine;
11399
11399
  }
11400
- function closeAfterMidLine(code2) {
11401
- if (code2 !== null && !isLineEnding2(code2)) return nok(code2);
11400
+ function closeAfterMidLine(code) {
11401
+ if (code !== null && !isLineEnding2(code)) return nok(code);
11402
11402
  effects.exit("comment");
11403
- return ok3(code2);
11403
+ return ok3(code);
11404
11404
  }
11405
- function afterLazy(code2) {
11405
+ function afterLazy(code) {
11406
11406
  effects.exit("comment");
11407
- return ok3(code2);
11407
+ return ok3(code);
11408
11408
  }
11409
11409
  function tokenizeFlowClose(closeEffects, closeOk, closeNok) {
11410
11410
  let inContent = false;
@@ -11437,18 +11437,18 @@ function tokenizeFlow(effects, ok3, nok) {
11437
11437
  function tokenizeNonLazyContinuation(effects, ok3, nok) {
11438
11438
  const self = this;
11439
11439
  return start;
11440
- function start(code2) {
11441
- if (code2 === null) {
11442
- return ok3(code2);
11440
+ function start(code) {
11441
+ if (code === null) {
11442
+ return ok3(code);
11443
11443
  }
11444
- if (!isLineEnding2(code2)) return nok(code2);
11444
+ if (!isLineEnding2(code)) return nok(code);
11445
11445
  effects.enter("lineEnding");
11446
- effects.consume(code2);
11446
+ effects.consume(code);
11447
11447
  effects.exit("lineEnding");
11448
11448
  return lineStart;
11449
11449
  }
11450
- function lineStart(code2) {
11451
- return self.parser.lazy[self.now().line] ? nok(code2) : ok3(code2);
11450
+ function lineStart(code) {
11451
+ return self.parser.lazy[self.now().line] ? nok(code) : ok3(code);
11452
11452
  }
11453
11453
  }
11454
11454
 
@@ -11471,21 +11471,21 @@ function insideDoubledOpener(events) {
11471
11471
  const before2 = events[index - 1];
11472
11472
  return !!before2 && before2[0] === "exit" && LABEL_OPENERS.has(before2[1].type);
11473
11473
  }
11474
- function isWhitespace(code2) {
11475
- return code2 === codes.space || code2 === codes.horizontalTab || // micromark expands a tab to `horizontalTab` plus `virtualSpace` fillers up
11474
+ function isWhitespace(code) {
11475
+ return code === codes.space || code === codes.horizontalTab || // micromark expands a tab to `horizontalTab` plus `virtualSpace` fillers up
11476
11476
  // to the next tab stop, so the code immediately before the `#` is the filler
11477
11477
  // and not the tab. Without this, `rd⇥#tag` yields no tag while `rd #tag`
11478
11478
  // does -- six recorded cases turned on this one code.
11479
- code2 === codes.virtualSpace || code2 === codes.lineFeed || code2 === codes.carriageReturn || code2 === codes.carriageReturnLineFeed;
11479
+ code === codes.virtualSpace || code === codes.lineFeed || code === codes.carriageReturn || code === codes.carriageReturnLineFeed;
11480
11480
  }
11481
- function isTagChar(code2) {
11482
- if (code2 === null || code2 < 0) return false;
11483
- if (code2 >= 55296 && code2 <= 57343) return true;
11484
- return isTagCharacter(String.fromCharCode(code2));
11481
+ function isTagChar(code) {
11482
+ if (code === null || code < 0) return false;
11483
+ if (code >= 55296 && code <= 57343) return true;
11484
+ return isTagCharacter(String.fromCharCode(code));
11485
11485
  }
11486
- function isNonDigit(code2) {
11487
- if (code2 === null) return false;
11488
- return !(code2 >= 48 && code2 <= 57);
11486
+ function isNonDigit(code) {
11487
+ if (code === null) return false;
11488
+ return !(code >= 48 && code <= 57);
11489
11489
  }
11490
11490
  function tagSyntax() {
11491
11491
  return {
@@ -11498,45 +11498,45 @@ function tokenize2(effects, ok3, nok) {
11498
11498
  let hasNonDigit = false;
11499
11499
  const context = this;
11500
11500
  return start;
11501
- function start(code2) {
11501
+ function start(code) {
11502
11502
  const previous2 = context.previous;
11503
11503
  const last = context.events[context.events.length - 1];
11504
11504
  const afterConstruct = !!last && last[0] === "exit" && last[1].type !== "data";
11505
11505
  const allowedStart = previous2 === null || isWhitespace(previous2) || previous2 === codes.rightSquareBracket || afterConstruct;
11506
- if (!allowedStart) return nok(code2);
11507
- if (insideDoubledOpener(context.events)) return nok(code2);
11508
- if (code2 !== HASH2) return nok(code2);
11506
+ if (!allowedStart) return nok(code);
11507
+ if (insideDoubledOpener(context.events)) return nok(code);
11508
+ if (code !== HASH2) return nok(code);
11509
11509
  effects.enter("tag");
11510
11510
  effects.enter("tagMarker");
11511
- effects.consume(code2);
11511
+ effects.consume(code);
11512
11512
  effects.exit("tagMarker");
11513
11513
  return tagStart;
11514
11514
  }
11515
- function tagStart(code2) {
11516
- if (!isTagChar(code2)) return nok(code2);
11515
+ function tagStart(code) {
11516
+ if (!isTagChar(code)) return nok(code);
11517
11517
  effects.enter("tagContent");
11518
- if (isNonDigit(code2)) hasNonDigit = true;
11519
- effects.consume(code2);
11518
+ if (isNonDigit(code)) hasNonDigit = true;
11519
+ effects.consume(code);
11520
11520
  return tagContent;
11521
11521
  }
11522
- function tagContent(code2) {
11523
- if (code2 === SLASH2) {
11522
+ function tagContent(code) {
11523
+ if (code === SLASH2) {
11524
11524
  hasNonDigit = true;
11525
- effects.consume(code2);
11525
+ effects.consume(code);
11526
11526
  return tagContent;
11527
11527
  }
11528
- if (isTagChar(code2)) {
11529
- if (isNonDigit(code2)) hasNonDigit = true;
11530
- effects.consume(code2);
11528
+ if (isTagChar(code)) {
11529
+ if (isNonDigit(code)) hasNonDigit = true;
11530
+ effects.consume(code);
11531
11531
  return tagContent;
11532
11532
  }
11533
- return end(code2);
11533
+ return end(code);
11534
11534
  }
11535
- function end(code2) {
11536
- if (!hasNonDigit) return nok(code2);
11535
+ function end(code) {
11536
+ if (!hasNonDigit) return nok(code);
11537
11537
  effects.exit("tagContent");
11538
11538
  effects.exit("tag");
11539
- return ok3(code2);
11539
+ return ok3(code);
11540
11540
  }
11541
11541
  }
11542
11542
 
@@ -11545,8 +11545,8 @@ var CARET = 94;
11545
11545
  var LEFT_BRACKET2 = 91;
11546
11546
  var RIGHT_BRACKET2 = 93;
11547
11547
  var BACKSLASH2 = 92;
11548
- function isLineEnding3(code2) {
11549
- return code2 === codes.lineFeed || code2 === codes.carriageReturn || code2 === codes.carriageReturnLineFeed;
11548
+ function isLineEnding3(code) {
11549
+ return code === codes.lineFeed || code === codes.carriageReturn || code === codes.carriageReturnLineFeed;
11550
11550
  }
11551
11551
  function inlineFootnoteSyntax() {
11552
11552
  return {
@@ -11559,10 +11559,10 @@ var bodyLineEnding = {
11559
11559
  partial: true,
11560
11560
  tokenize: function tokenizeBodyLineEnding(effects, ok3, nok) {
11561
11561
  return start;
11562
- function start(code2) {
11563
- if (!isLineEnding3(code2)) return nok(code2);
11562
+ function start(code) {
11563
+ if (!isLineEnding3(code)) return nok(code);
11564
11564
  effects.enter(types.lineEnding);
11565
- effects.consume(code2);
11565
+ effects.consume(code);
11566
11566
  effects.exit(types.lineEnding);
11567
11567
  return ok3;
11568
11568
  }
@@ -11579,92 +11579,92 @@ function tokenize3(effects, ok3, nok) {
11579
11579
  let sawBracket = false;
11580
11580
  let openerAt = 0;
11581
11581
  return start;
11582
- function exhausted(code2) {
11582
+ function exhausted(code) {
11583
11583
  if (!sawBracket) {
11584
11584
  const memo = memoFor(self.parser);
11585
11585
  memo.noCloserFrom = openerAt;
11586
11586
  memo.noCloserTo = self.now().offset;
11587
11587
  }
11588
- return nok(code2);
11588
+ return nok(code);
11589
11589
  }
11590
- function start(code2) {
11591
- if (code2 !== CARET) return nok(code2);
11590
+ function start(code) {
11591
+ if (code !== CARET) return nok(code);
11592
11592
  openerAt = self.now().offset ?? 0;
11593
11593
  const memo = memoFor(self.parser);
11594
11594
  if (memo.noCloserFrom !== void 0 && memo.noCloserTo !== void 0 && openerAt >= memo.noCloserFrom && openerAt < memo.noCloserTo) {
11595
- return nok(code2);
11595
+ return nok(code);
11596
11596
  }
11597
11597
  sawBracket = false;
11598
11598
  effects.enter("inlineFootnote");
11599
11599
  effects.enter("inlineFootnoteMarker");
11600
- effects.consume(code2);
11600
+ effects.consume(code);
11601
11601
  return afterCaret;
11602
11602
  }
11603
- function afterCaret(code2) {
11604
- if (code2 !== LEFT_BRACKET2) return nok(code2);
11605
- effects.consume(code2);
11603
+ function afterCaret(code) {
11604
+ if (code !== LEFT_BRACKET2) return nok(code);
11605
+ effects.consume(code);
11606
11606
  effects.exit("inlineFootnoteMarker");
11607
11607
  depth = 1;
11608
11608
  return atBoundary;
11609
11609
  }
11610
- function atBoundary(code2) {
11611
- if (code2 === null) return exhausted(code2);
11612
- if (code2 === RIGHT_BRACKET2) {
11610
+ function atBoundary(code) {
11611
+ if (code === null) return exhausted(code);
11612
+ if (code === RIGHT_BRACKET2) {
11613
11613
  sawBracket = true;
11614
- return closeHere(code2);
11614
+ return closeHere(code);
11615
11615
  }
11616
- if (isLineEnding3(code2)) {
11617
- return effects.attempt(bodyLineEnding, atBoundary, nok)(code2);
11616
+ if (isLineEnding3(code)) {
11617
+ return effects.attempt(bodyLineEnding, atBoundary, nok)(code);
11618
11618
  }
11619
11619
  effects.enter("inlineFootnoteContent", { contentType: "text" });
11620
- return content(code2);
11620
+ return content(code);
11621
11621
  }
11622
- function content(code2) {
11623
- if (code2 === null) {
11622
+ function content(code) {
11623
+ if (code === null) {
11624
11624
  effects.exit("inlineFootnoteContent");
11625
- return exhausted(code2);
11625
+ return exhausted(code);
11626
11626
  }
11627
- if (isLineEnding3(code2)) {
11627
+ if (isLineEnding3(code)) {
11628
11628
  effects.exit("inlineFootnoteContent");
11629
- return effects.attempt(bodyLineEnding, atBoundary, nok)(code2);
11629
+ return effects.attempt(bodyLineEnding, atBoundary, nok)(code);
11630
11630
  }
11631
- if (code2 === BACKSLASH2) {
11632
- effects.consume(code2);
11631
+ if (code === BACKSLASH2) {
11632
+ effects.consume(code);
11633
11633
  return escaped2;
11634
11634
  }
11635
- if (code2 === LEFT_BRACKET2) {
11635
+ if (code === LEFT_BRACKET2) {
11636
11636
  depth++;
11637
- effects.consume(code2);
11637
+ effects.consume(code);
11638
11638
  return content;
11639
11639
  }
11640
- if (code2 === RIGHT_BRACKET2) {
11640
+ if (code === RIGHT_BRACKET2) {
11641
11641
  sawBracket = true;
11642
11642
  depth--;
11643
11643
  if (depth === 0) {
11644
11644
  effects.exit("inlineFootnoteContent");
11645
- return closeHere(code2);
11645
+ return closeHere(code);
11646
11646
  }
11647
- effects.consume(code2);
11647
+ effects.consume(code);
11648
11648
  return content;
11649
11649
  }
11650
- effects.consume(code2);
11650
+ effects.consume(code);
11651
11651
  return content;
11652
11652
  }
11653
- function escaped2(code2) {
11654
- if (code2 === null) {
11653
+ function escaped2(code) {
11654
+ if (code === null) {
11655
11655
  effects.exit("inlineFootnoteContent");
11656
- return exhausted(code2);
11656
+ return exhausted(code);
11657
11657
  }
11658
- if (isLineEnding3(code2)) {
11658
+ if (isLineEnding3(code)) {
11659
11659
  effects.exit("inlineFootnoteContent");
11660
- return nok(code2);
11660
+ return nok(code);
11661
11661
  }
11662
- effects.consume(code2);
11662
+ effects.consume(code);
11663
11663
  return content;
11664
11664
  }
11665
- function closeHere(code2) {
11665
+ function closeHere(code) {
11666
11666
  effects.enter("inlineFootnoteMarker");
11667
- effects.consume(code2);
11667
+ effects.consume(code);
11668
11668
  effects.exit("inlineFootnoteMarker");
11669
11669
  effects.exit("inlineFootnote");
11670
11670
  return ok3;
@@ -11678,21 +11678,21 @@ var asciiAtext = regexCheck(/[#-'*+\--9=?A-Z^-~]/);
11678
11678
  var asciiDigit = regexCheck(/\d/);
11679
11679
  var asciiHexDigit = regexCheck(/[\dA-Fa-f]/);
11680
11680
  var asciiPunctuation = regexCheck(/[!-/:-@[-`{-~]/);
11681
- function markdownLineEnding(code2) {
11682
- return code2 !== null && code2 < -2;
11681
+ function markdownLineEnding(code) {
11682
+ return code !== null && code < -2;
11683
11683
  }
11684
- function markdownLineEndingOrSpace(code2) {
11685
- return code2 !== null && (code2 < 0 || code2 === 32);
11684
+ function markdownLineEndingOrSpace(code) {
11685
+ return code !== null && (code < 0 || code === 32);
11686
11686
  }
11687
- function markdownSpace(code2) {
11688
- return code2 === -2 || code2 === -1 || code2 === 32;
11687
+ function markdownSpace(code) {
11688
+ return code === -2 || code === -1 || code === 32;
11689
11689
  }
11690
11690
  var unicodePunctuation = regexCheck(/\p{P}|\p{S}/u);
11691
11691
  var unicodeWhitespace = regexCheck(/\s/);
11692
11692
  function regexCheck(regex) {
11693
11693
  return check;
11694
- function check(code2) {
11695
- return code2 !== null && code2 > -1 && regex.test(String.fromCharCode(code2));
11694
+ function check(code) {
11695
+ return code !== null && code > -1 && regex.test(String.fromCharCode(code));
11696
11696
  }
11697
11697
  }
11698
11698
 
@@ -11701,20 +11701,20 @@ function factorySpace(effects, ok3, type, max) {
11701
11701
  const limit = max ? max - 1 : Infinity;
11702
11702
  let size = 0;
11703
11703
  return start;
11704
- function start(code2) {
11705
- if (markdownSpace(code2)) {
11704
+ function start(code) {
11705
+ if (markdownSpace(code)) {
11706
11706
  effects.enter(type);
11707
- return prefix2(code2);
11707
+ return prefix2(code);
11708
11708
  }
11709
- return ok3(code2);
11709
+ return ok3(code);
11710
11710
  }
11711
- function prefix2(code2) {
11712
- if (markdownSpace(code2) && size++ < limit) {
11713
- effects.consume(code2);
11711
+ function prefix2(code) {
11712
+ if (markdownSpace(code) && size++ < limit) {
11713
+ effects.consume(code);
11714
11714
  return prefix2;
11715
11715
  }
11716
11716
  effects.exit(type);
11717
- return ok3(code2);
11717
+ return ok3(code);
11718
11718
  }
11719
11719
  }
11720
11720
 
@@ -11725,11 +11725,11 @@ var blankLine2 = {
11725
11725
  };
11726
11726
  function tokenizeBlankLine(effects, ok3, nok) {
11727
11727
  return start;
11728
- function start(code2) {
11729
- return markdownSpace(code2) ? factorySpace(effects, after, "linePrefix")(code2) : after(code2);
11728
+ function start(code) {
11729
+ return markdownSpace(code) ? factorySpace(effects, after, "linePrefix")(code) : after(code);
11730
11730
  }
11731
- function after(code2) {
11732
- return code2 === null || markdownLineEnding(code2) ? ok3(code2) : nok(code2);
11731
+ function after(code) {
11732
+ return code === null || markdownLineEnding(code) ? ok3(code) : nok(code);
11733
11733
  }
11734
11734
  }
11735
11735
 
@@ -11790,18 +11790,18 @@ function tokenizePotentialGfmFootnoteCall(effects, ok3, nok) {
11790
11790
  }
11791
11791
  }
11792
11792
  return start;
11793
- function start(code2) {
11794
- if (!labelStart || !labelStart._balanced) return nok(code2);
11793
+ function start(code) {
11794
+ if (!labelStart || !labelStart._balanced) return nok(code);
11795
11795
  const id = normalizeIdentifier2(
11796
11796
  self.sliceSerialize({ start: labelStart.end, end: self.now() })
11797
11797
  );
11798
11798
  if (id.codePointAt(0) !== codes.caret || !names.includes(id.slice(1))) {
11799
- return nok(code2);
11799
+ return nok(code);
11800
11800
  }
11801
11801
  effects.enter("gfmFootnoteCallLabelMarker");
11802
- effects.consume(code2);
11802
+ effects.consume(code);
11803
11803
  effects.exit("gfmFootnoteCallLabelMarker");
11804
- return ok3(code2);
11804
+ return ok3(code);
11805
11805
  }
11806
11806
  }
11807
11807
  var resolveToPotentialGfmFootnoteCall = (events, context) => {
@@ -11865,41 +11865,41 @@ function tokenizeGfmFootnoteCall(effects, ok3, nok) {
11865
11865
  let size = 0;
11866
11866
  let data = false;
11867
11867
  return start;
11868
- function start(code2) {
11868
+ function start(code) {
11869
11869
  effects.enter("gfmFootnoteCall");
11870
11870
  effects.enter("gfmFootnoteCallLabelMarker");
11871
- effects.consume(code2);
11871
+ effects.consume(code);
11872
11872
  effects.exit("gfmFootnoteCallLabelMarker");
11873
11873
  return callStart;
11874
11874
  }
11875
- function callStart(code2) {
11876
- if (code2 !== codes.caret) return nok(code2);
11875
+ function callStart(code) {
11876
+ if (code !== codes.caret) return nok(code);
11877
11877
  effects.enter("gfmFootnoteCallMarker");
11878
- effects.consume(code2);
11878
+ effects.consume(code);
11879
11879
  effects.exit("gfmFootnoteCallMarker");
11880
11880
  effects.enter("gfmFootnoteCallString");
11881
11881
  effects.enter("chunkString").contentType = "string";
11882
11882
  return callData;
11883
11883
  }
11884
- function callData(code2) {
11885
- if (size > constants.linkReferenceSizeMax || code2 === codes.rightSquareBracket && !data || code2 === codes.eof || markdownLineEndingOrSpace(code2)) {
11886
- return nok(code2);
11884
+ function callData(code) {
11885
+ if (size > constants.linkReferenceSizeMax || code === codes.rightSquareBracket && !data || code === codes.eof || markdownLineEndingOrSpace(code)) {
11886
+ return nok(code);
11887
11887
  }
11888
- if (code2 === codes.rightSquareBracket) {
11888
+ if (code === codes.rightSquareBracket) {
11889
11889
  effects.exit("chunkString");
11890
11890
  const token = effects.exit("gfmFootnoteCallString");
11891
11891
  if (!names.includes(normalizeIdentifier2(self.sliceSerialize(token)))) {
11892
- return nok(code2);
11892
+ return nok(code);
11893
11893
  }
11894
11894
  effects.enter("gfmFootnoteCallLabelMarker");
11895
- effects.consume(code2);
11895
+ effects.consume(code);
11896
11896
  effects.exit("gfmFootnoteCallLabelMarker");
11897
11897
  effects.exit("gfmFootnoteCall");
11898
11898
  return ok3;
11899
11899
  }
11900
11900
  data = true;
11901
11901
  size++;
11902
- effects.consume(code2);
11902
+ effects.consume(code);
11903
11903
  return callData;
11904
11904
  }
11905
11905
  }
@@ -11910,47 +11910,47 @@ function tokenizeDefinitionStart(effects, ok3, nok) {
11910
11910
  let size = 0;
11911
11911
  let data = false;
11912
11912
  return start;
11913
- function start(code2) {
11914
- const definition3 = effects.enter("gfmFootnoteDefinition");
11915
- definition3._container = true;
11913
+ function start(code) {
11914
+ const definition2 = effects.enter("gfmFootnoteDefinition");
11915
+ definition2._container = true;
11916
11916
  effects.enter("gfmFootnoteDefinitionLabel");
11917
11917
  effects.enter("gfmFootnoteDefinitionLabelMarker");
11918
- effects.consume(code2);
11918
+ effects.consume(code);
11919
11919
  effects.exit("gfmFootnoteDefinitionLabelMarker");
11920
11920
  return labelAtMarker;
11921
11921
  }
11922
- function labelAtMarker(code2) {
11923
- if (code2 !== codes.caret) return nok(code2);
11922
+ function labelAtMarker(code) {
11923
+ if (code !== codes.caret) return nok(code);
11924
11924
  effects.enter("gfmFootnoteDefinitionMarker");
11925
- effects.consume(code2);
11925
+ effects.consume(code);
11926
11926
  effects.exit("gfmFootnoteDefinitionMarker");
11927
11927
  effects.enter("gfmFootnoteDefinitionLabelString");
11928
11928
  effects.enter("chunkString").contentType = "string";
11929
11929
  return labelInside;
11930
11930
  }
11931
- function labelInside(code2) {
11932
- if (size > constants.linkReferenceSizeMax || code2 === codes.rightSquareBracket && !data || code2 === codes.eof || markdownLineEndingOrSpace(code2)) {
11933
- return nok(code2);
11931
+ function labelInside(code) {
11932
+ if (size > constants.linkReferenceSizeMax || code === codes.rightSquareBracket && !data || code === codes.eof || markdownLineEndingOrSpace(code)) {
11933
+ return nok(code);
11934
11934
  }
11935
- if (code2 === codes.rightSquareBracket) {
11935
+ if (code === codes.rightSquareBracket) {
11936
11936
  effects.exit("chunkString");
11937
11937
  const token = effects.exit("gfmFootnoteDefinitionLabelString");
11938
11938
  identifier = normalizeIdentifier2(self.sliceSerialize(token));
11939
11939
  effects.enter("gfmFootnoteDefinitionLabelMarker");
11940
- effects.consume(code2);
11940
+ effects.consume(code);
11941
11941
  effects.exit("gfmFootnoteDefinitionLabelMarker");
11942
11942
  effects.exit("gfmFootnoteDefinitionLabel");
11943
11943
  return labelAfter;
11944
11944
  }
11945
11945
  data = true;
11946
11946
  size++;
11947
- effects.consume(code2);
11947
+ effects.consume(code);
11948
11948
  return labelInside;
11949
11949
  }
11950
- function labelAfter(code2) {
11951
- if (code2 !== codes.colon) return nok(code2);
11950
+ function labelAfter(code) {
11951
+ if (code !== codes.colon) return nok(code);
11952
11952
  effects.enter("definitionMarker");
11953
- effects.consume(code2);
11953
+ effects.consume(code);
11954
11954
  effects.exit("definitionMarker");
11955
11955
  if (!names.includes(identifier)) names.push(identifier);
11956
11956
  return factorySpace(effects, ok3, "gfmFootnoteDefinitionWhitespace");
@@ -11970,9 +11970,9 @@ function tokenizeIndent(effects, ok3, nok) {
11970
11970
  "gfmFootnoteDefinitionIndent",
11971
11971
  constants.tabSize + 1
11972
11972
  );
11973
- function afterPrefix(code2) {
11973
+ function afterPrefix(code) {
11974
11974
  const tail = self.events[self.events.length - 1];
11975
- return tail && tail[1].type === "gfmFootnoteDefinitionIndent" && tail[2].sliceSerialize(tail[1], true).length === constants.tabSize ? ok3(code2) : nok(code2);
11975
+ return tail && tail[1].type === "gfmFootnoteDefinitionIndent" && tail[2].sliceSerialize(tail[1], true).length === constants.tabSize ? ok3(code) : nok(code);
11976
11976
  }
11977
11977
  }
11978
11978
 
@@ -12171,10 +12171,10 @@ function wikilinkToMarkdown() {
12171
12171
  data?.spelledPath,
12172
12172
  stripped === "path"
12173
12173
  );
12174
- const heading2 = node2.heading || stripped === "heading" ? `#${writtenPart(node2.heading, data?.spelledHeading, stripped === "heading")}` : "";
12174
+ const heading = node2.heading || stripped === "heading" ? `#${writtenPart(node2.heading, data?.spelledHeading, stripped === "heading")}` : "";
12175
12175
  const writtenEmpty = !node2.embedded && node2.value === "" && (node2.path !== "" || node2.heading !== "");
12176
12176
  const alias = node2.alias || writtenEmpty ? `|${node2.alias}` : "";
12177
- const body = path === "" && heading2 === "" && alias === "" ? " " : `${path}${heading2}${alias}`;
12177
+ const body = path === "" && heading === "" && alias === "" ? " " : `${path}${heading}${alias}`;
12178
12178
  const written2 = `${prefix2}[[${body}]]`;
12179
12179
  return state.stack.includes("tableCell") ? written2.replace(/\|/gu, "\\|") : written2;
12180
12180
  }
@@ -12182,283 +12182,8 @@ function wikilinkToMarkdown() {
12182
12182
  };
12183
12183
  }
12184
12184
 
12185
- // node_modules/mdast-util-phrasing/lib/index.js
12186
- var phrasing = (
12187
- /** @type {(node?: unknown) => node is Exclude<PhrasingContent, Html>} */
12188
- convert([
12189
- "break",
12190
- "delete",
12191
- "emphasis",
12192
- // To do: next major: removed since footnotes were added to GFM.
12193
- "footnote",
12194
- "footnoteReference",
12195
- "image",
12196
- "imageReference",
12197
- "inlineCode",
12198
- // Enabled by `mdast-util-math`:
12199
- "inlineMath",
12200
- "link",
12201
- "linkReference",
12202
- // Enabled by `mdast-util-mdx`:
12203
- "mdxJsxTextElement",
12204
- // Enabled by `mdast-util-mdx`:
12205
- "mdxTextExpression",
12206
- "strong",
12207
- "text",
12208
- // Enabled by `mdast-util-directive`:
12209
- "textDirective"
12210
- ])
12211
- );
12212
-
12213
- // node_modules/mdast-util-to-markdown/lib/handle/blockquote.js
12214
- function blockquote2(node2, _, state, info) {
12215
- const exit = state.enter("blockquote");
12216
- const tracker = state.createTracker(info);
12217
- tracker.move("> ");
12218
- tracker.shift(2);
12219
- const value2 = state.indentLines(
12220
- state.containerFlow(node2, tracker.current()),
12221
- map
12222
- );
12223
- exit();
12224
- return value2;
12225
- }
12226
- function map(line, _, blank) {
12227
- return ">" + (blank ? "" : " ") + line;
12228
- }
12229
-
12230
- // node_modules/mdast-util-to-markdown/lib/util/pattern-in-scope.js
12231
- function patternInScope(stack, pattern) {
12232
- return listInScope(stack, pattern.inConstruct, true) && !listInScope(stack, pattern.notInConstruct, false);
12233
- }
12234
- function listInScope(stack, list4, none) {
12235
- if (typeof list4 === "string") {
12236
- list4 = [list4];
12237
- }
12238
- if (!list4 || list4.length === 0) {
12239
- return none;
12240
- }
12241
- let index = -1;
12242
- while (++index < list4.length) {
12243
- if (stack.includes(list4[index])) {
12244
- return true;
12245
- }
12246
- }
12247
- return false;
12248
- }
12249
-
12250
- // node_modules/mdast-util-to-markdown/lib/handle/break.js
12251
- function hardBreak2(_, _1, state, info) {
12252
- let index = -1;
12253
- while (++index < state.unsafe.length) {
12254
- const pattern = state.unsafe[index];
12255
- if (pattern.character === "\n" && !pattern.before && !pattern.after && patternInScope(state.stack, pattern)) {
12256
- return /[\t ]/.test(info.before) ? "" : " ";
12257
- }
12258
- }
12259
- return "\\\n";
12260
- }
12261
-
12262
- // node_modules/longest-streak/index.js
12263
- function longestStreak(value2, substring) {
12264
- const source = String(value2);
12265
- let index = source.indexOf(substring);
12266
- let expected = index;
12267
- let count = 0;
12268
- let max = 0;
12269
- if (typeof substring !== "string") {
12270
- throw new TypeError("Expected substring");
12271
- }
12272
- while (index !== -1) {
12273
- if (index === expected) {
12274
- if (++count > max) {
12275
- max = count;
12276
- }
12277
- } else {
12278
- count = 1;
12279
- }
12280
- expected = index + substring.length;
12281
- index = source.indexOf(substring, expected);
12282
- }
12283
- return max;
12284
- }
12285
-
12286
- // node_modules/mdast-util-to-markdown/lib/util/format-code-as-indented.js
12287
- function formatCodeAsIndented(node2, state) {
12288
- return Boolean(
12289
- state.options.fences === false && node2.value && // If there’s no info…
12290
- !node2.lang && // And there’s a non-whitespace character…
12291
- /[^\n\r ]/.test(node2.value) && // And the value doesn’t start or end in a blank…
12292
- !/^[\t ]*(?:[\n\r]|$)|(?:^|[\n\r])[\t ]*$/.test(node2.value)
12293
- );
12294
- }
12295
-
12296
- // node_modules/mdast-util-to-markdown/lib/util/check-fence.js
12297
- function checkFence(state) {
12298
- const marker = state.options.fence || "`";
12299
- if (marker !== "`" && marker !== "~") {
12300
- throw new Error(
12301
- "Cannot serialize code with `" + marker + "` for `options.fence`, expected `` ` `` or `~`"
12302
- );
12303
- }
12304
- return marker;
12305
- }
12306
-
12307
- // node_modules/mdast-util-to-markdown/lib/handle/code.js
12308
- function code(node2, _, state, info) {
12309
- const marker = checkFence(state);
12310
- const raw = node2.value || "";
12311
- if (formatCodeAsIndented(node2, state)) {
12312
- const exit2 = state.enter("codeIndented");
12313
- const value3 = state.indentLines(raw, map2);
12314
- exit2();
12315
- return value3;
12316
- }
12317
- const tracker = state.createTracker(info);
12318
- const sequence = marker.repeat(Math.max(longestStreak(raw, marker) + 1, 3));
12319
- const exit = state.enter("codeFenced");
12320
- const suffix = marker === "`" ? "GraveAccent" : "Tilde";
12321
- let value2 = tracker.move(sequence);
12322
- if (node2.lang) {
12323
- const subexit = state.enter(`codeFencedLang${suffix}`);
12324
- value2 += tracker.move(
12325
- state.safe(node2.lang, {
12326
- before: value2,
12327
- after: " ",
12328
- encode: ["`"],
12329
- ...tracker.current()
12330
- })
12331
- );
12332
- subexit();
12333
- }
12334
- if (node2.lang && node2.meta) {
12335
- const subexit = state.enter(`codeFencedMeta${suffix}`);
12336
- value2 += tracker.move(" ");
12337
- value2 += tracker.move(
12338
- state.safe(node2.meta, {
12339
- before: value2,
12340
- after: "\n",
12341
- encode: ["`"],
12342
- ...tracker.current()
12343
- })
12344
- );
12345
- subexit();
12346
- }
12347
- value2 += tracker.move("\n");
12348
- if (raw) {
12349
- value2 += tracker.move(raw + "\n");
12350
- }
12351
- value2 += tracker.move(sequence);
12352
- exit();
12353
- return value2;
12354
- }
12355
- function map2(line, _, blank) {
12356
- return (blank ? "" : " ") + line;
12357
- }
12358
-
12359
- // node_modules/mdast-util-to-markdown/lib/util/check-quote.js
12360
- function checkQuote(state) {
12361
- const marker = state.options.quote || '"';
12362
- if (marker !== '"' && marker !== "'") {
12363
- throw new Error(
12364
- "Cannot serialize title with `" + marker + "` for `options.quote`, expected `\"`, or `'`"
12365
- );
12366
- }
12367
- return marker;
12368
- }
12369
-
12370
- // node_modules/mdast-util-to-markdown/lib/handle/definition.js
12371
- function definition2(node2, _, state, info) {
12372
- const quote = checkQuote(state);
12373
- const suffix = quote === '"' ? "Quote" : "Apostrophe";
12374
- const exit = state.enter("definition");
12375
- let subexit = state.enter("label");
12376
- const tracker = state.createTracker(info);
12377
- let value2 = tracker.move("[");
12378
- value2 += tracker.move(
12379
- state.safe(state.associationId(node2), {
12380
- before: value2,
12381
- after: "]",
12382
- ...tracker.current()
12383
- })
12384
- );
12385
- value2 += tracker.move("]: ");
12386
- subexit();
12387
- if (
12388
- // If there’s no url, or…
12389
- !node2.url || // If there are control characters or whitespace.
12390
- /[\0- \u007F]/.test(node2.url)
12391
- ) {
12392
- subexit = state.enter("destinationLiteral");
12393
- value2 += tracker.move("<");
12394
- value2 += tracker.move(
12395
- state.safe(node2.url, { before: value2, after: ">", ...tracker.current() })
12396
- );
12397
- value2 += tracker.move(">");
12398
- } else {
12399
- subexit = state.enter("destinationRaw");
12400
- value2 += tracker.move(
12401
- state.safe(node2.url, {
12402
- before: value2,
12403
- after: node2.title ? " " : "\n",
12404
- ...tracker.current()
12405
- })
12406
- );
12407
- }
12408
- subexit();
12409
- if (node2.title) {
12410
- subexit = state.enter(`title${suffix}`);
12411
- value2 += tracker.move(" " + quote);
12412
- value2 += tracker.move(
12413
- state.safe(node2.title, {
12414
- before: value2,
12415
- after: quote,
12416
- ...tracker.current()
12417
- })
12418
- );
12419
- value2 += tracker.move(quote);
12420
- subexit();
12421
- }
12422
- exit();
12423
- return value2;
12424
- }
12425
-
12426
- // node_modules/mdast-util-to-markdown/lib/util/check-emphasis.js
12427
- function checkEmphasis(state) {
12428
- const marker = state.options.emphasis || "*";
12429
- if (marker !== "*" && marker !== "_") {
12430
- throw new Error(
12431
- "Cannot serialize emphasis with `" + marker + "` for `options.emphasis`, expected `*`, or `_`"
12432
- );
12433
- }
12434
- return marker;
12435
- }
12436
-
12437
- // node_modules/mdast-util-to-markdown/lib/handle/emphasis.js
12438
- emphasis2.attention = attention;
12439
- emphasis2.peek = peek;
12440
- function emphasis2(node2, _, state, info) {
12441
- const exit = state.enter("phrasing");
12442
- const value2 = state.containerPhrasing({ type: "root", children: [node2] }, info);
12443
- exit();
12444
- return value2;
12445
- }
12446
- function attention(_, state) {
12447
- const marker = checkEmphasis(state);
12448
- return {
12449
- construct: "emphasis",
12450
- markers: marker === "*" ? ["*", "_"] : ["_", "*"],
12451
- sizes: [1]
12452
- };
12453
- }
12454
- function peek(_, _1, state) {
12455
- return state.options.emphasis || "*";
12456
- }
12457
-
12458
- // node_modules/mdast-util-to-markdown/lib/util/encode-character-reference.js
12459
- function encodeCharacterReference(code2) {
12460
- return "&#x" + code2.toString(16).toUpperCase() + ";";
12461
- }
12185
+ // src/lib/mdast/break-to-markdown.ts
12186
+ import { defaultHandlers } from "mdast-util-to-markdown";
12462
12187
 
12463
12188
  // node_modules/mdast-util-to-string/lib/index.js
12464
12189
  var emptyOptions = {};
@@ -12497,576 +12222,40 @@ function node(value2) {
12497
12222
  return Boolean(value2 && typeof value2 === "object");
12498
12223
  }
12499
12224
 
12500
- // node_modules/mdast-util-to-markdown/lib/util/format-heading-as-setext.js
12501
- function formatHeadingAsSetext(node2, state) {
12502
- let literalWithBreak = false;
12503
- visit(node2, function(node3) {
12504
- if ("value" in node3 && /\r?\n|\r/.test(node3.value) || node3.type === "break") {
12505
- literalWithBreak = true;
12506
- return EXIT;
12507
- }
12508
- });
12509
- return Boolean(
12510
- (!node2.depth || node2.depth < 3) && toString(node2) && (state.options.setext || literalWithBreak)
12511
- );
12512
- }
12513
-
12514
- // node_modules/mdast-util-to-markdown/lib/handle/heading.js
12515
- function heading(node2, _, state, info) {
12516
- const rank = Math.max(Math.min(6, node2.depth || 1), 1);
12517
- const tracker = state.createTracker(info);
12518
- if (formatHeadingAsSetext(node2, state)) {
12519
- const exit2 = state.enter("headingSetext");
12520
- const subexit2 = state.enter("phrasing");
12521
- const value3 = state.containerPhrasing(node2, {
12522
- ...tracker.current(),
12523
- before: "\n",
12524
- after: "\n"
12525
- });
12526
- subexit2();
12527
- exit2();
12528
- return value3 + "\n" + (rank === 1 ? "=" : "-").repeat(
12529
- // The whole size…
12530
- value3.length - // Minus the position of the character after the last EOL (or
12531
- // 0 if there is none)…
12532
- (Math.max(value3.lastIndexOf("\r"), value3.lastIndexOf("\n")) + 1)
12533
- );
12534
- }
12535
- const sequence = "#".repeat(rank);
12536
- const exit = state.enter("headingAtx");
12537
- const subexit = state.enter("phrasing");
12538
- tracker.move(sequence + " ");
12539
- let value2 = state.containerPhrasing(node2, {
12540
- before: "# ",
12541
- after: "\n",
12542
- ...tracker.current()
12543
- });
12544
- const head = value2.charCodeAt(0);
12545
- if (head === 9 || head === 32) {
12546
- value2 = encodeCharacterReference(head) + value2.slice(1);
12547
- }
12548
- value2 = value2 ? sequence + " " + value2 : sequence;
12549
- if (state.options.closeAtx) {
12550
- value2 += " " + sequence;
12551
- }
12552
- subexit();
12553
- exit();
12554
- return value2;
12555
- }
12556
-
12557
- // node_modules/mdast-util-to-markdown/lib/handle/html.js
12558
- html.peek = htmlPeek;
12559
- function html(node2) {
12560
- return node2.value || "";
12561
- }
12562
- function htmlPeek() {
12563
- return "<";
12225
+ // src/lib/mdast/empty-delete-to-markdown.ts
12226
+ var EMPTY_DELETE = "obsidianEmptyDelete";
12227
+ function isEmptyDelete(node2) {
12228
+ return node2?.type === EMPTY_DELETE || node2?.type === "delete" && (node2.children ?? []).length === 0;
12564
12229
  }
12565
-
12566
- // node_modules/mdast-util-to-markdown/lib/handle/image.js
12567
- image2.peek = imagePeek;
12568
- function image2(node2, _, state, info) {
12569
- const quote = checkQuote(state);
12570
- const suffix = quote === '"' ? "Quote" : "Apostrophe";
12571
- const exit = state.enter("image");
12572
- let subexit = state.enter("label");
12573
- const tracker = state.createTracker(info);
12574
- let value2 = tracker.move("![");
12575
- value2 += tracker.move(
12576
- state.safe(node2.alt, { before: value2, after: "]", ...tracker.current() })
12577
- );
12578
- value2 += tracker.move("](");
12579
- subexit();
12580
- if (
12581
- // If there’s no url but there is a title…
12582
- !node2.url && node2.title || // If there are control characters or whitespace.
12583
- /[\0- \u007F]/.test(node2.url)
12584
- ) {
12585
- subexit = state.enter("destinationLiteral");
12586
- value2 += tracker.move("<");
12587
- value2 += tracker.move(
12588
- state.safe(node2.url, { before: value2, after: ">", ...tracker.current() })
12589
- );
12590
- value2 += tracker.move(">");
12591
- } else {
12592
- subexit = state.enter("destinationRaw");
12593
- value2 += tracker.move(
12594
- state.safe(node2.url, {
12595
- before: value2,
12596
- after: node2.title ? " " : ")",
12597
- ...tracker.current()
12598
- })
12599
- );
12600
- }
12601
- subexit();
12602
- if (node2.title) {
12603
- subexit = state.enter(`title${suffix}`);
12604
- value2 += tracker.move(" " + quote);
12605
- value2 += tracker.move(
12606
- state.safe(node2.title, {
12607
- before: value2,
12608
- after: quote,
12609
- ...tracker.current()
12610
- })
12611
- );
12612
- value2 += tracker.move(quote);
12613
- subexit();
12614
- }
12615
- value2 += tracker.move(")");
12616
- exit();
12617
- return value2;
12618
- }
12619
- function imagePeek() {
12620
- return "!";
12621
- }
12622
-
12623
- // node_modules/mdast-util-to-markdown/lib/handle/image-reference.js
12624
- imageReference.peek = imageReferencePeek;
12625
- function imageReference(node2, _, state, info) {
12626
- const type = node2.referenceType;
12627
- const exit = state.enter("imageReference");
12628
- let subexit = state.enter("label");
12629
- const tracker = state.createTracker(info);
12630
- let value2 = tracker.move("![");
12631
- const alt = state.safe(node2.alt, {
12632
- before: value2,
12633
- after: "]",
12634
- ...tracker.current()
12635
- });
12636
- value2 += tracker.move(alt + "][");
12637
- subexit();
12638
- const stack = state.stack;
12639
- state.stack = stack.filter(function(d) {
12640
- return d !== "phrasing";
12641
- });
12642
- subexit = state.enter("reference");
12643
- const reference2 = state.safe(state.associationId(node2), {
12644
- before: value2,
12645
- after: "]",
12646
- ...tracker.current()
12647
- });
12648
- subexit();
12649
- state.stack = stack;
12650
- exit();
12651
- if (type === "full" || !alt || alt !== reference2) {
12652
- value2 += tracker.move(reference2 + "]");
12653
- } else if (type === "shortcut") {
12654
- value2 = value2.slice(0, -1);
12655
- } else {
12656
- value2 += tracker.move("]");
12657
- }
12658
- return value2;
12659
- }
12660
- function imageReferencePeek() {
12661
- return "!";
12662
- }
12663
-
12664
- // node_modules/mdast-util-to-markdown/lib/handle/inline-code.js
12665
- inlineCode2.peek = inlineCodePeek;
12666
- function inlineCode2(node2, _, state) {
12667
- let value2 = node2.value || "";
12668
- let sequence = "`";
12669
- let index = -1;
12670
- while (new RegExp("(^|[^`])" + sequence + "([^`]|$)").test(value2)) {
12671
- sequence += "`";
12672
- }
12673
- if (/[^\n\r ]/.test(value2) && (/^[\n\r ]/.test(value2) && /[\n\r ]$/.test(value2) || /^`|`$/.test(value2))) {
12674
- value2 = " " + value2 + " ";
12675
- }
12676
- while (++index < state.unsafe.length) {
12677
- const pattern = state.unsafe[index];
12678
- const expression = state.compilePattern(pattern);
12679
- if (!pattern.atBreak) continue;
12680
- let match;
12681
- while (match = expression.exec(value2)) {
12682
- let position = match.index;
12683
- if (value2.charCodeAt(position) === 10 && value2.charCodeAt(position - 1) === 13) {
12684
- position--;
12685
- }
12686
- value2 = value2.slice(0, position) + " " + value2.slice(match.index + 1);
12687
- }
12688
- }
12689
- return sequence + value2 + sequence;
12690
- }
12691
- function inlineCodePeek() {
12692
- return "`";
12693
- }
12694
-
12695
- // node_modules/mdast-util-to-markdown/lib/util/format-link-as-autolink.js
12696
- function formatLinkAsAutolink(node2, state) {
12697
- const raw = toString(node2);
12698
- return Boolean(
12699
- !state.options.resourceLink && // If there’s a url…
12700
- node2.url && // And there’s no title…
12701
- !node2.title && // And the content of `node` is a single text node…
12702
- node2.children && node2.children.length === 1 && node2.children[0].type === "text" && // And if the url is the same as the content…
12703
- (raw === node2.url || "mailto:" + raw === node2.url) && // And that starts w/ a protocol…
12704
- /^[a-z][+\-.a-z]+:/i.test(node2.url) && // And that doesn’t contain ASCII control codes (character escapes and
12705
- // references don’t work), space, or angle brackets…
12706
- !/[\0- <>\u007F]/.test(node2.url)
12707
- );
12708
- }
12709
-
12710
- // node_modules/mdast-util-to-markdown/lib/handle/link.js
12711
- link3.peek = linkPeek;
12712
- function link3(node2, _, state, info) {
12713
- const quote = checkQuote(state);
12714
- const suffix = quote === '"' ? "Quote" : "Apostrophe";
12715
- const tracker = state.createTracker(info);
12716
- if (formatLinkAsAutolink(node2, state)) {
12717
- const stack = state.stack;
12718
- state.stack = stack.filter(function(d) {
12719
- return d !== "phrasing";
12720
- });
12721
- const exit2 = state.enter("autolink");
12722
- let value3 = tracker.move("<");
12723
- value3 += tracker.move(
12724
- state.containerPhrasing(node2, {
12725
- before: value3,
12726
- after: ">",
12727
- ...tracker.current()
12728
- })
12729
- );
12730
- value3 += tracker.move(">");
12731
- exit2();
12732
- state.stack = stack;
12733
- return value3;
12734
- }
12735
- const exit = state.enter("link");
12736
- let subexit = state.enter("label");
12737
- let value2 = tracker.move("[");
12738
- value2 += tracker.move(
12739
- state.containerPhrasing(node2, {
12740
- before: value2,
12741
- after: "](",
12742
- ...tracker.current()
12743
- })
12744
- );
12745
- value2 += tracker.move("](");
12746
- subexit();
12747
- if (
12748
- // If there’s no url but there is a title…
12749
- !node2.url && node2.title || // If there are control characters or whitespace.
12750
- /[\0- \u007F]/.test(node2.url)
12751
- ) {
12752
- subexit = state.enter("destinationLiteral");
12753
- value2 += tracker.move("<");
12754
- value2 += tracker.move(
12755
- state.safe(node2.url, { before: value2, after: ">", ...tracker.current() })
12756
- );
12757
- value2 += tracker.move(">");
12758
- } else {
12759
- subexit = state.enter("destinationRaw");
12760
- value2 += tracker.move(
12761
- state.safe(node2.url, {
12762
- before: value2,
12763
- after: node2.title ? " " : ")",
12764
- ...tracker.current()
12765
- })
12766
- );
12767
- }
12768
- subexit();
12769
- if (node2.title) {
12770
- subexit = state.enter(`title${suffix}`);
12771
- value2 += tracker.move(" " + quote);
12772
- value2 += tracker.move(
12773
- state.safe(node2.title, {
12774
- before: value2,
12775
- after: quote,
12776
- ...tracker.current()
12777
- })
12778
- );
12779
- value2 += tracker.move(quote);
12780
- subexit();
12781
- }
12782
- value2 += tracker.move(")");
12783
- exit();
12784
- return value2;
12785
- }
12786
- function linkPeek(node2, _, state) {
12787
- return formatLinkAsAutolink(node2, state) ? "<" : "[";
12788
- }
12789
-
12790
- // node_modules/mdast-util-to-markdown/lib/handle/link-reference.js
12791
- linkReference.peek = linkReferencePeek;
12792
- function linkReference(node2, _, state, info) {
12793
- const type = node2.referenceType;
12794
- const exit = state.enter("linkReference");
12795
- let subexit = state.enter("label");
12796
- const tracker = state.createTracker(info);
12797
- let value2 = tracker.move("[");
12798
- const text4 = state.containerPhrasing(node2, {
12799
- before: value2,
12800
- after: "]",
12801
- ...tracker.current()
12802
- });
12803
- value2 += tracker.move(text4 + "][");
12804
- subexit();
12805
- const stack = state.stack;
12806
- state.stack = stack.filter(function(d) {
12807
- return d !== "phrasing";
12808
- });
12809
- subexit = state.enter("reference");
12810
- const reference2 = state.safe(state.associationId(node2), {
12811
- before: value2,
12812
- after: "]",
12813
- ...tracker.current()
12814
- });
12815
- subexit();
12816
- state.stack = stack;
12817
- exit();
12818
- if (type === "full" || !text4 || text4 !== reference2) {
12819
- value2 += tracker.move(reference2 + "]");
12820
- } else if (type === "shortcut") {
12821
- value2 = value2.slice(0, -1);
12822
- } else {
12823
- value2 += tracker.move("]");
12824
- }
12825
- return value2;
12826
- }
12827
- function linkReferencePeek() {
12828
- return "[";
12829
- }
12830
-
12831
- // node_modules/mdast-util-to-markdown/lib/util/check-bullet.js
12832
- function checkBullet(state) {
12833
- const marker = state.options.bullet || "*";
12834
- if (marker !== "*" && marker !== "+" && marker !== "-") {
12835
- throw new Error(
12836
- "Cannot serialize items with `" + marker + "` for `options.bullet`, expected `*`, `+`, or `-`"
12837
- );
12838
- }
12839
- return marker;
12840
- }
12841
-
12842
- // node_modules/mdast-util-to-markdown/lib/util/check-bullet-other.js
12843
- function checkBulletOther(state) {
12844
- const bullet = checkBullet(state);
12845
- const bulletOther = state.options.bulletOther;
12846
- if (!bulletOther) {
12847
- return bullet === "*" ? "-" : "*";
12848
- }
12849
- if (bulletOther !== "*" && bulletOther !== "+" && bulletOther !== "-") {
12850
- throw new Error(
12851
- "Cannot serialize items with `" + bulletOther + "` for `options.bulletOther`, expected `*`, `+`, or `-`"
12852
- );
12853
- }
12854
- if (bulletOther === bullet) {
12855
- throw new Error(
12856
- "Expected `bullet` (`" + bullet + "`) and `bulletOther` (`" + bulletOther + "`) to be different"
12857
- );
12858
- }
12859
- return bulletOther;
12860
- }
12861
-
12862
- // node_modules/mdast-util-to-markdown/lib/util/check-bullet-ordered.js
12863
- function checkBulletOrdered(state) {
12864
- const marker = state.options.bulletOrdered || ".";
12865
- if (marker !== "." && marker !== ")") {
12866
- throw new Error(
12867
- "Cannot serialize items with `" + marker + "` for `options.bulletOrdered`, expected `.` or `)`"
12868
- );
12869
- }
12870
- return marker;
12871
- }
12872
-
12873
- // node_modules/mdast-util-to-markdown/lib/util/check-rule.js
12874
- function checkRule(state) {
12875
- const marker = state.options.rule || "*";
12876
- if (marker !== "*" && marker !== "-" && marker !== "_") {
12877
- throw new Error(
12878
- "Cannot serialize rules with `" + marker + "` for `options.rule`, expected `*`, `-`, or `_`"
12879
- );
12880
- }
12881
- return marker;
12882
- }
12883
-
12884
- // node_modules/mdast-util-to-markdown/lib/handle/list.js
12885
- function list3(node2, parent, state, info) {
12886
- const exit = state.enter("list");
12887
- const bulletCurrent = state.bulletCurrent;
12888
- let bullet = node2.ordered ? checkBulletOrdered(state) : checkBullet(state);
12889
- const bulletOther = node2.ordered ? bullet === "." ? ")" : "." : checkBulletOther(state);
12890
- let useDifferentMarker = parent && state.bulletLastUsed ? bullet === state.bulletLastUsed : false;
12891
- if (!node2.ordered) {
12892
- const firstListItem = node2.children ? node2.children[0] : void 0;
12893
- if (
12894
- // Bullet could be used as a thematic break marker:
12895
- (bullet === "*" || bullet === "-") && // Empty first list item:
12896
- firstListItem && (!firstListItem.children || !firstListItem.children[0]) && // Directly in two other list items:
12897
- state.stack[state.stack.length - 1] === "list" && state.stack[state.stack.length - 2] === "listItem" && state.stack[state.stack.length - 3] === "list" && state.stack[state.stack.length - 4] === "listItem" && // That are each the first child.
12898
- state.indexStack[state.indexStack.length - 1] === 0 && state.indexStack[state.indexStack.length - 2] === 0 && state.indexStack[state.indexStack.length - 3] === 0
12899
- ) {
12900
- useDifferentMarker = true;
12901
- }
12902
- if (checkRule(state) === bullet && firstListItem) {
12903
- let index = -1;
12904
- while (++index < node2.children.length) {
12905
- const item = node2.children[index];
12906
- if (item && item.type === "listItem" && item.children && item.children[0] && item.children[0].type === "thematicBreak") {
12907
- useDifferentMarker = true;
12908
- break;
12909
- }
12910
- }
12911
- }
12912
- }
12913
- if (useDifferentMarker) {
12914
- bullet = bulletOther;
12915
- }
12916
- state.bulletCurrent = bullet;
12917
- const value2 = state.containerFlow(node2, info);
12918
- state.bulletLastUsed = bullet;
12919
- state.bulletCurrent = bulletCurrent;
12920
- exit();
12921
- return value2;
12922
- }
12923
-
12924
- // node_modules/mdast-util-to-markdown/lib/util/check-list-item-indent.js
12925
- function checkListItemIndent(state) {
12926
- const style = state.options.listItemIndent || "one";
12927
- if (style !== "tab" && style !== "one" && style !== "mixed") {
12928
- throw new Error(
12929
- "Cannot serialize items with `" + style + "` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`"
12930
- );
12931
- }
12932
- return style;
12933
- }
12934
-
12935
- // node_modules/mdast-util-to-markdown/lib/handle/list-item.js
12936
- function listItem3(node2, parent, state, info) {
12937
- const listItemIndent = checkListItemIndent(state);
12938
- let bullet = state.bulletCurrent || checkBullet(state);
12939
- if (parent && parent.type === "list" && parent.ordered) {
12940
- bullet = (typeof parent.start === "number" && parent.start > -1 ? parent.start : 1) + (state.options.incrementListMarker === false ? 0 : parent.children.indexOf(node2)) + bullet;
12941
- }
12942
- let size = bullet.length + 1;
12943
- if (listItemIndent === "tab" || listItemIndent === "mixed" && (parent && parent.type === "list" && parent.spread || node2.spread)) {
12944
- size = Math.ceil(size / 4) * 4;
12945
- }
12946
- const tracker = state.createTracker(info);
12947
- tracker.move(bullet + " ".repeat(size - bullet.length));
12948
- tracker.shift(size);
12949
- const exit = state.enter("listItem");
12950
- const value2 = state.indentLines(
12951
- state.containerFlow(node2, tracker.current()),
12952
- map3
12953
- );
12954
- exit();
12955
- return value2;
12956
- function map3(line, index, blank) {
12957
- if (index) {
12958
- return (blank ? "" : " ".repeat(size)) + line;
12230
+ function markEmptyDeletes(tree) {
12231
+ const marked = [];
12232
+ const walk = (node2) => {
12233
+ const children = node2.children;
12234
+ if (node2.type === "delete" && children?.length === 0) {
12235
+ node2.type = EMPTY_DELETE;
12236
+ marked.push(node2);
12959
12237
  }
12960
- return (blank ? bullet : bullet + " ".repeat(size - bullet.length)) + line;
12961
- }
12962
- }
12963
-
12964
- // node_modules/mdast-util-to-markdown/lib/handle/paragraph.js
12965
- function paragraph2(node2, _, state, info) {
12966
- const exit = state.enter("paragraph");
12967
- const subexit = state.enter("phrasing");
12968
- const value2 = state.containerPhrasing(node2, info);
12969
- subexit();
12970
- exit();
12971
- return value2;
12972
- }
12973
-
12974
- // node_modules/mdast-util-to-markdown/lib/handle/root.js
12975
- function root(node2, _, state, info) {
12976
- const hasPhrasing = node2.children.some(function(d) {
12977
- return phrasing(d);
12978
- });
12979
- if (!hasPhrasing) return state.containerFlow(node2, info);
12980
- const exit = state.enter("phrasing");
12981
- const value2 = state.containerPhrasing(node2, info);
12982
- exit();
12983
- return value2;
12984
- }
12985
-
12986
- // node_modules/mdast-util-to-markdown/lib/util/check-strong.js
12987
- function checkStrong(state) {
12988
- const marker = state.options.strong || "*";
12989
- if (marker !== "*" && marker !== "_") {
12990
- throw new Error(
12991
- "Cannot serialize strong with `" + marker + "` for `options.strong`, expected `*`, or `_`"
12992
- );
12993
- }
12994
- return marker;
12995
- }
12996
-
12997
- // node_modules/mdast-util-to-markdown/lib/handle/strong.js
12998
- strong2.attention = attention2;
12999
- strong2.peek = peek2;
13000
- function strong2(node2, _, state, info) {
13001
- const exit = state.enter("phrasing");
13002
- const value2 = state.containerPhrasing({ type: "root", children: [node2] }, info);
13003
- exit();
13004
- return value2;
13005
- }
13006
- function attention2(_, state) {
13007
- const marker = checkStrong(state);
13008
- return {
13009
- construct: "strong",
13010
- markers: marker === "*" ? ["*", "_"] : ["_", "*"],
13011
- sizes: [2]
12238
+ children?.forEach(walk);
12239
+ };
12240
+ walk(tree);
12241
+ return () => {
12242
+ for (const node2 of marked) node2.type = "delete";
13012
12243
  };
13013
12244
  }
13014
- function peek2(_, _1, state) {
13015
- return state.options.strong || "*";
13016
- }
13017
-
13018
- // node_modules/mdast-util-to-markdown/lib/handle/text.js
13019
- function text3(node2, parent, state, info) {
13020
- const siblings = parent ? parent.children : [];
13021
- const index = siblings.indexOf(node2);
13022
- return state.safe(node2.value, {
13023
- ...info,
13024
- afterNode: siblings[index + 1],
13025
- beforeNode: siblings[index - 1]
13026
- });
13027
- }
13028
-
13029
- // node_modules/mdast-util-to-markdown/lib/util/check-rule-repetition.js
13030
- function checkRuleRepetition(state) {
13031
- const repetition = state.options.ruleRepetition || 3;
13032
- if (repetition < 3) {
13033
- throw new Error(
13034
- "Cannot serialize rules with repetition `" + repetition + "` for `options.ruleRepetition`, expected `3` or more"
13035
- );
13036
- }
13037
- return repetition;
13038
- }
13039
-
13040
- // node_modules/mdast-util-to-markdown/lib/handle/thematic-break.js
13041
- function thematicBreak2(_, _1, state) {
13042
- const value2 = (checkRule(state) + (state.options.ruleSpaces ? " " : "")).repeat(checkRuleRepetition(state));
13043
- return state.options.ruleSpaces ? value2.slice(0, -1) : value2;
12245
+ function emptyDeleteToMarkdown() {
12246
+ const handle = Object.assign(
12247
+ ((_node, _parent, state, info) => {
12248
+ const tracker = state.createTracker(info);
12249
+ const exit = state.enter("strikethrough");
12250
+ const value2 = tracker.move("~~") + tracker.move("~~");
12251
+ exit();
12252
+ return value2;
12253
+ }),
12254
+ { peek: () => "~" }
12255
+ );
12256
+ return { handlers: { [EMPTY_DELETE]: handle } };
13044
12257
  }
13045
12258
 
13046
- // node_modules/mdast-util-to-markdown/lib/handle/index.js
13047
- var handle = {
13048
- blockquote: blockquote2,
13049
- break: hardBreak2,
13050
- code,
13051
- definition: definition2,
13052
- emphasis: emphasis2,
13053
- hardBreak: hardBreak2,
13054
- heading,
13055
- html,
13056
- image: image2,
13057
- imageReference,
13058
- inlineCode: inlineCode2,
13059
- link: link3,
13060
- linkReference,
13061
- list: list3,
13062
- listItem: listItem3,
13063
- paragraph: paragraph2,
13064
- root,
13065
- strong: strong2,
13066
- text: text3,
13067
- thematicBreak: thematicBreak2
13068
- };
13069
-
13070
12259
  // src/lib/mdast/break-to-markdown.ts
13071
12260
  function breakToMarkdown(escaped2 = false) {
13072
12261
  return {
@@ -13087,7 +12276,7 @@ function breakToMarkdown(escaped2 = false) {
13087
12276
  return void 0;
13088
12277
  });
13089
12278
  if (!lines || node2.depth >= 3 || toString(node2) !== "") {
13090
- return handle.heading(node2, parent, state, info);
12279
+ return defaultHandlers.heading(node2, parent, state, info);
13091
12280
  }
13092
12281
  const exit = state.enter("headingSetext");
13093
12282
  const subexit = state.enter("phrasing");
@@ -13109,7 +12298,7 @@ ${(node2.depth === 1 ? "=" : "-").repeat(
13109
12298
  const ending = escaped2 || opens2 ? "\\\n" : "\n";
13110
12299
  const siblings = parent?.children ?? [];
13111
12300
  const next = siblings[siblings.indexOf(node2) + 1];
13112
- if (next?.type === "delete" && (next.children ?? []).length === 0) {
12301
+ if (isEmptyDelete(next)) {
13113
12302
  return `${ending}&#x20;`;
13114
12303
  }
13115
12304
  return ending;
@@ -13213,7 +12402,11 @@ function commentToMarkdown() {
13213
12402
  // comment, hiding the words (found by `fuzz/invariant-sweep.ts`).
13214
12403
  unsafe: [{ character: "%", after: "%", inConstruct: "phrasing" }],
13215
12404
  handlers: {
13216
- comment(node2, parent, _state, info) {
12405
+ comment(node2, parent) {
12406
+ const value2 = node2.value.split("\n").map(
12407
+ (line, index, lines) => index > 0 && index < lines.length - 1 && /^[ \t]+$/u.test(line) ? "" : line
12408
+ ).join("\n");
12409
+ if (value2 !== node2.value) node2 = { ...node2, value: value2 };
13217
12410
  if (parent && FLOW.has(parent.type) && !node2.value.includes("\n")) {
13218
12411
  return `%%${node2.value}
13219
12412
  %%`;
@@ -13277,8 +12470,8 @@ function tagToMarkdown(options = {}) {
13277
12470
  tag(node2, parent) {
13278
12471
  const siblings = parent?.children ?? [];
13279
12472
  const next = siblings[siblings.indexOf(node2) + 1];
13280
- const attention3 = next?.type === "emphasis" || next?.type === "strong" || next?.type === "delete";
13281
- return `#${node2.value}${options.legacy && attention3 ? TAG_END : ""}`;
12473
+ const attention = next?.type === "emphasis" || next?.type === "strong" || next?.type === "delete";
12474
+ return `#${node2.value}${options.legacy && attention ? TAG_END : ""}`;
13282
12475
  }
13283
12476
  }
13284
12477
  };
@@ -13430,9 +12623,9 @@ function atMarkerColumn(line) {
13430
12623
  rest = rest.slice(quote[0].length);
13431
12624
  continue;
13432
12625
  }
13433
- const list4 = LIST_MARKER.exec(rest);
13434
- if (!list4) break;
13435
- rest = rest.slice(list4[0].length);
12626
+ const list3 = LIST_MARKER.exec(rest);
12627
+ if (!list3) break;
12628
+ rest = rest.slice(list3[0].length);
13436
12629
  }
13437
12630
  return AT_MARKER.test(rest);
13438
12631
  }
@@ -13480,16 +12673,16 @@ function calloutTransform(tree, source = "", reparse = () => ({
13480
12673
  if (!first || first.type !== "paragraph" && first.type !== "heading") {
13481
12674
  return;
13482
12675
  }
13483
- const paragraph3 = first;
13484
- if (paragraph3.position?.start?.line !== void 0 && quote.position?.start?.line !== void 0 && paragraph3.position.start.line !== quote.position.start.line) {
12676
+ const paragraph2 = first;
12677
+ if (paragraph2.position?.start?.line !== void 0 && quote.position?.start?.line !== void 0 && paragraph2.position.start.line !== quote.position.start.line) {
13485
12678
  return;
13486
12679
  }
13487
- const lead = paragraph3.children[0];
12680
+ const lead = paragraph2.children[0];
13488
12681
  if (!lead || lead.type !== "text") return;
13489
12682
  const match = MARKER6.exec(lead.value);
13490
12683
  if (!match) return;
13491
12684
  if (match[1].trim() === "") return;
13492
- const from = paragraph3.position?.start?.offset;
12685
+ const from = paragraph2.position?.start?.offset;
13493
12686
  if (source !== "" && from !== void 0) {
13494
12687
  const lineStart = source.lastIndexOf("\n", from - 1) + 1;
13495
12688
  const lineEnd2 = source.indexOf("\n", lineStart);
@@ -13515,20 +12708,20 @@ function calloutTransform(tree, source = "", reparse = () => ({
13515
12708
  }
13516
12709
  function bodyUnderTitleLine() {
13517
12710
  const from2 = leadText.position?.start?.offset;
13518
- const to = paragraph3.position?.end?.offset;
12711
+ const to = paragraph2.position?.end?.offset;
13519
12712
  if (from2 === void 0 || to === void 0 || source === "") return [];
13520
12713
  const breakAt = source.indexOf("\n", from2);
13521
12714
  if (breakAt === -1 || breakAt >= to) return [];
13522
12715
  const bodyFrom = breakAt + 1 + (LINE_PREFIX.exec(source.slice(breakAt + 1))?.[0].length ?? 0);
13523
12716
  if (bodyFrom >= to) return [];
13524
- const map3 = mapLines(
12717
+ const map = mapLines(
13525
12718
  source,
13526
12719
  bodyFrom,
13527
12720
  to,
13528
12721
  source.slice(0, bodyFrom).split("\n").length
13529
12722
  );
13530
- const parsed = reparse(map3.text);
13531
- for (const child of parsed.children) shiftByMap(child, map3, 0);
12723
+ const parsed = reparse(map.text);
12724
+ for (const child of parsed.children) shiftByMap(child, map, 0);
13532
12725
  return parsed.children;
13533
12726
  }
13534
12727
  const asBlock = titleLineIsBlock(firstLine, reparse);
@@ -13569,7 +12762,7 @@ function calloutTransform(tree, source = "", reparse = () => ({
13569
12762
  }
13570
12763
  function splitAcrossConstruct() {
13571
12764
  const from2 = leadText.position?.start?.offset;
13572
- const to = paragraph3.position?.end?.offset;
12765
+ const to = paragraph2.position?.end?.offset;
13573
12766
  if (from2 === void 0 || to === void 0) return void 0;
13574
12767
  const breakAtSource = source.indexOf("\n", from2);
13575
12768
  if (breakAtSource === -1 || breakAtSource >= to) return void 0;
@@ -13600,7 +12793,7 @@ function calloutTransform(tree, source = "", reparse = () => ({
13600
12793
  function splitAtLineEnd(lineEnd2, bodyFrom, reread) {
13601
12794
  const title2 = [];
13602
12795
  const body = [];
13603
- for (const child of paragraph3.children) {
12796
+ for (const child of paragraph2.children) {
13604
12797
  const span2 = child.position;
13605
12798
  if (span2?.start.offset === void 0 || span2.end.offset === void 0) {
13606
12799
  return void 0;
@@ -13648,15 +12841,15 @@ function calloutTransform(tree, source = "", reparse = () => ({
13648
12841
  body: reread
13649
12842
  };
13650
12843
  }
13651
- const map3 = mapLines(
12844
+ const map = mapLines(
13652
12845
  source,
13653
12846
  bodyFrom,
13654
12847
  span2.end.offset,
13655
12848
  source.slice(0, bodyFrom).split("\n").length
13656
12849
  );
13657
- const tail = reparse(map3.text).children[0];
12850
+ const tail = reparse(map.text).children[0];
13658
12851
  if (tail?.type !== "paragraph") return void 0;
13659
- for (const node3 of tail.children) shiftByMap(node3, map3, 0);
12852
+ for (const node3 of tail.children) shiftByMap(node3, map, 0);
13660
12853
  title2.push(titleText);
13661
12854
  body.push(...tail.children);
13662
12855
  }
@@ -13685,29 +12878,29 @@ function calloutTransform(tree, source = "", reparse = () => ({
13685
12878
  }
13686
12879
  ];
13687
12880
  leadText.value = leadText.value.slice(newlineAt + 1);
13688
- if (leadText.value === "") paragraph3.children.shift();
12881
+ if (leadText.value === "") paragraph2.children.shift();
13689
12882
  else if (bodyStart !== void 0 && titleStart) {
13690
12883
  moveStartTo(leadText, source, bodyStart, titleStart.line + 1);
13691
- moveStartTo(paragraph3, source, bodyStart, titleStart.line + 1);
12884
+ moveStartTo(paragraph2, source, bodyStart, titleStart.line + 1);
13692
12885
  }
13693
12886
  } else {
13694
- const breakAt = paragraph3.children.findIndex((c) => c.type === "break");
12887
+ const breakAt = paragraph2.children.findIndex((c) => c.type === "break");
13695
12888
  const split = breakAt === -1 ? splitAcrossConstruct() : void 0;
13696
- titleNodes = split?.title ?? (breakAt === -1 ? paragraph3.children.slice() : paragraph3.children.slice(0, breakAt));
13697
- if (split) paragraph3.children = split.body;
12889
+ titleNodes = split?.title ?? (breakAt === -1 ? paragraph2.children.slice() : paragraph2.children.slice(0, breakAt));
12890
+ if (split) paragraph2.children = split.body;
13698
12891
  if (!split) {
13699
- paragraph3.children = breakAt === -1 ? [] : paragraph3.children.slice(breakAt + 1);
12892
+ paragraph2.children = breakAt === -1 ? [] : paragraph2.children.slice(breakAt + 1);
13700
12893
  }
13701
- const first2 = paragraph3.children[0];
12894
+ const first2 = paragraph2.children[0];
13702
12895
  const start = first2?.position?.start;
13703
- if (start?.offset !== void 0 && paragraph3.position) {
13704
- paragraph3.position.start = { ...start };
13705
- } else if (first2 && paragraph3.position && titleFrom !== void 0) {
12896
+ if (start?.offset !== void 0 && paragraph2.position) {
12897
+ paragraph2.position.start = { ...start };
12898
+ } else if (first2 && paragraph2.position && titleFrom !== void 0) {
13706
12899
  const lineEnd2 = source.indexOf("\n", titleFrom);
13707
12900
  if (lineEnd2 !== -1) {
13708
12901
  const bodyStart = lineEnd2 + 1 + (LINE_PREFIX.exec(source.slice(lineEnd2 + 1))?.[0].length ?? 0);
13709
12902
  moveStartTo(
13710
- paragraph3,
12903
+ paragraph2,
13711
12904
  source,
13712
12905
  bodyStart,
13713
12906
  source.slice(0, bodyStart).split("\n").length
@@ -13716,7 +12909,7 @@ function calloutTransform(tree, source = "", reparse = () => ({
13716
12909
  }
13717
12910
  }
13718
12911
  const title = collect(titleNodes).trim();
13719
- if (paragraph3.children.length === 0 || paragraph3.children.length === 1 && paragraph3.children[0].type === "text" && paragraph3.children[0].value.trim() === "") {
12912
+ if (paragraph2.children.length === 0 || paragraph2.children.length === 1 && paragraph2.children[0].type === "text" && paragraph2.children[0].value.trim() === "") {
13720
12913
  quote.children.shift();
13721
12914
  }
13722
12915
  const blankTitle = title === "" && firstLine !== "";
@@ -13774,7 +12967,7 @@ function obsidianReadingTransform(tree, source, parse3, options) {
13774
12967
  for (let round = 0; round < MAX_ROUNDS; round += 1) {
13775
12968
  const view = lineTable(neutralized(source, edits));
13776
12969
  const detected = detect(tree, source, view, parse3, options);
13777
- const unseen = (list4) => list4.filter((edit) => !seen.has(`${edit.kind}@${String(edit.offset)}`));
12970
+ const unseen = (list3) => list3.filter((edit) => !seen.has(`${edit.kind}@${String(edit.offset)}`));
13778
12971
  let found = unseen(detected.alone);
13779
12972
  if (found.length === 0) found = unseen(detected.edits);
13780
12973
  if (found.length === 0) found = unseen(detected.late);
@@ -13791,14 +12984,14 @@ function obsidianReadingTransform(tree, source, parse3, options) {
13791
12984
  }
13792
12985
  }
13793
12986
  function neutralized(source, edits) {
13794
- let text4 = source;
12987
+ let text3 = source;
13795
12988
  for (const edit of edits) {
13796
12989
  if (edit.kind !== "neutralize") continue;
13797
12990
  const placeholder = PLACEHOLDERS[source[edit.offset]];
13798
12991
  if (placeholder === void 0) continue;
13799
- text4 = text4.slice(0, edit.offset) + placeholder + text4.slice(edit.offset + 1);
12992
+ text3 = text3.slice(0, edit.offset) + placeholder + text3.slice(edit.offset + 1);
13800
12993
  }
13801
- return text4;
12994
+ return text3;
13802
12995
  }
13803
12996
  var MAX_ROUNDS = 32;
13804
12997
  var PLACEHOLDERS = {
@@ -13831,23 +13024,23 @@ function restoreHints(nodes) {
13831
13024
  var PLACEHOLDER_ALL = /[\uE000-\uE005]/gu;
13832
13025
  function lineTable(source) {
13833
13026
  const starts = [0];
13834
- const text4 = [];
13027
+ const text3 = [];
13835
13028
  const pattern = /\r\n|\r|\n/gu;
13836
13029
  let last = 0;
13837
13030
  for (const match of source.matchAll(pattern)) {
13838
- text4.push(source.slice(last, match.index));
13031
+ text3.push(source.slice(last, match.index));
13839
13032
  last = match.index + match[0].length;
13840
13033
  starts.push(last);
13841
13034
  }
13842
- text4.push(source.slice(last));
13843
- return { starts, text: text4 };
13035
+ text3.push(source.slice(last));
13036
+ return { starts, text: text3 };
13844
13037
  }
13845
13038
  var SETEXT_UNDERLINE2 = /^(?:=+|-+)$/u;
13846
13039
  var COMMENT_OPENER = /^%%[^%]*$/u;
13847
13040
  var OPENER_INDENT = /^(?:\t[ \t]*| *)$/u;
13848
- function opensComment(text4) {
13849
- const lead = /^[> \t]*/u.exec(text4)[0];
13850
- if (!COMMENT_OPENER.test(text4.slice(lead.length))) return void 0;
13041
+ function opensComment(text3) {
13042
+ const lead = /^[> \t]*/u.exec(text3)[0];
13043
+ if (!COMMENT_OPENER.test(text3.slice(lead.length))) return void 0;
13851
13044
  return OPENER_INDENT.test(lead.slice(lead.lastIndexOf(">") + 1)) ? { lead } : void 0;
13852
13045
  }
13853
13046
  var CONTAINERS2 = /* @__PURE__ */ new Set(["blockquote", "listItem", "footnoteDefinition"]);
@@ -13931,20 +13124,20 @@ function detect(tree, source, lines, parse3, options) {
13931
13124
  }
13932
13125
  };
13933
13126
  walk(tree, false, void 0, 0);
13934
- for (const { node: definition3, item, hostLine } of definitions) {
13935
- const position = definition3.position;
13127
+ for (const { node: definition2, item, hostLine } of definitions) {
13128
+ const position = definition2.position;
13936
13129
  if (!position || position.start.offset === void 0) continue;
13937
13130
  const labelLine = position.start.line;
13938
- const colon5 = labelColon(definition3, source);
13131
+ const colon5 = labelColon(definition2, source);
13939
13132
  const prefixLength = position.start.offset - (lines.starts[labelLine - 1] ?? 0);
13940
13133
  const above = (openParagraphEnds.get(labelLine - 1) ?? []).filter(
13941
- (paragraph3) => (paragraph3.position?.end.offset ?? Infinity) < position.start.offset && !(calloutTitles2.has(paragraph3) && titleLeavesLabel(paragraph3, labelLine, lines, parse3))
13134
+ (paragraph2) => (paragraph2.position?.end.offset ?? Infinity) < position.start.offset && !(calloutTitles2.has(paragraph2) && titleLeavesLabel(paragraph2, labelLine, lines, parse3))
13942
13135
  );
13943
13136
  if (colon5 !== void 0 && hostLine < labelLine && above.length > 0) {
13944
13137
  edits.push({ kind: "neutralize", offset: colon5 });
13945
13138
  continue;
13946
13139
  }
13947
- const children = definition3.children;
13140
+ const children = definition2.children;
13948
13141
  const first = children[0];
13949
13142
  const last = children[children.length - 1];
13950
13143
  if (first?.type === "paragraph" && first.position?.start.line === labelLine) {
@@ -13964,12 +13157,12 @@ function detect(tree, source, lines, parse3, options) {
13964
13157
  }
13965
13158
  }
13966
13159
  if (last?.type === "paragraph" && last.position) {
13967
- for (const { list: list4, item: listItem4 } of listStarts.get(
13160
+ for (const { list: list3, item: listItem3 } of listStarts.get(
13968
13161
  last.position.end.line + 1
13969
13162
  ) ?? []) {
13970
- if (list4.start === 1 || list4.start === null) continue;
13971
- if (item !== void 0 && listItem4 !== item) continue;
13972
- const delimiter = orderedDelimiter(list4, source);
13163
+ if (list3.start === 1 || list3.start === null) continue;
13164
+ if (item !== void 0 && listItem3 !== item) continue;
13165
+ const delimiter = orderedDelimiter(list3, source);
13973
13166
  if (delimiter !== void 0) {
13974
13167
  edits.push({ kind: "neutralize", offset: delimiter });
13975
13168
  }
@@ -14013,16 +13206,16 @@ var INTERRUPTERS = /* @__PURE__ */ new Set([
14013
13206
  "comment",
14014
13207
  "blockquote"
14015
13208
  ]);
14016
- function interrupts(text4, next, parse3) {
14017
- const first = parse3(text4).children[0];
13209
+ function interrupts(text3, next, parse3) {
13210
+ const first = parse3(text3).children[0];
14018
13211
  if (!first) return true;
14019
13212
  if (INTERRUPTERS.has(first.type)) return true;
14020
13213
  if (first.type === "list") {
14021
- const list4 = first;
14022
- return !list4.ordered || list4.start === 1;
13214
+ const list3 = first;
13215
+ return !list3.ordered || list3.start === 1;
14023
13216
  }
14024
13217
  if (next === void 0 || next.trim() === "") return false;
14025
- const pair = parse3(`${text4}
13218
+ const pair = parse3(`${text3}
14026
13219
  ${next}`).children[0];
14027
13220
  return pair?.type === "heading" && pair.position?.end.line === 2;
14028
13221
  }
@@ -14056,12 +13249,12 @@ function keptLazyLines(node2, source, lines, parse3) {
14056
13249
  );
14057
13250
  const edits = [];
14058
13251
  for (let line = last + 1; line <= lines.text.length; line += 1) {
14059
- const text4 = lines.text[line - 1] ?? "";
14060
- if (text4.trim() === "") break;
14061
- const own5 = /^[> \t]*/u.exec(text4)[0];
13252
+ const text3 = lines.text[line - 1] ?? "";
13253
+ if (text3.trim() === "") break;
13254
+ const own5 = /^[> \t]*/u.exec(text3)[0];
14062
13255
  const lazy = own5.split(">").length - 1 < quotes || columns(own5) < width;
14063
13256
  if (!lazy) continue;
14064
- if (interrupts(text4, lines.text[line], parse3)) break;
13257
+ if (interrupts(text3, lines.text[line], parse3)) break;
14065
13258
  const offset = lines.starts[line - 1];
14066
13259
  if (offset !== void 0)
14067
13260
  edits.push({ kind: "prefix", offset, text: prefix2 });
@@ -14076,11 +13269,11 @@ function closesMidline(node2, parent) {
14076
13269
  if (before2.position?.end.line !== (node2.position?.start.line ?? 0) - 1) {
14077
13270
  return false;
14078
13271
  }
14079
- let text4 = "";
13272
+ let text3 = "";
14080
13273
  visitText(before2, (value2) => {
14081
- text4 += value2;
13274
+ text3 += value2;
14082
13275
  });
14083
- return (text4.match(/\$\$/gu)?.length ?? 0) % 2 === 1;
13276
+ return (text3.match(/\$\$/gu)?.length ?? 0) % 2 === 1;
14084
13277
  }
14085
13278
  function visitText(node2, onText) {
14086
13279
  if (node2.type === "text")
@@ -14097,25 +13290,25 @@ function containedMathOpener(node2, lines) {
14097
13290
  const opener2 = (lines.text[first - 1] ?? "").slice(start);
14098
13291
  if (!opener2.startsWith("$$") || opener2.slice(2).trim() === "") return [];
14099
13292
  for (let line = first; line <= position.end.line; line += 1) {
14100
- const text4 = (line === first ? opener2.slice(2) : lines.text[line - 1] ?? "").trimEnd();
14101
- if (text4.endsWith("$$")) return [];
13293
+ const text3 = (line === first ? opener2.slice(2) : lines.text[line - 1] ?? "").trimEnd();
13294
+ if (text3.endsWith("$$")) return [];
14102
13295
  }
14103
13296
  return [
14104
13297
  { kind: "neutralize", offset: position.start.offset },
14105
13298
  { kind: "neutralize", offset: position.start.offset + 1 }
14106
13299
  ];
14107
13300
  }
14108
- function lazyCommentUnderDefinition(definition3, lines) {
14109
- const comment2 = definition3.children.at(-1);
14110
- const paragraph3 = definition3.children.at(-2);
14111
- if (comment2?.type !== "comment" || paragraph3?.type !== "paragraph") {
13301
+ function lazyCommentUnderDefinition(definition2, lines) {
13302
+ const comment2 = definition2.children.at(-1);
13303
+ const paragraph2 = definition2.children.at(-2);
13304
+ if (comment2?.type !== "comment" || paragraph2?.type !== "paragraph") {
14112
13305
  return [];
14113
13306
  }
14114
13307
  const offset = comment2.position?.start.offset;
14115
- const line = paragraph3.position?.end.line;
13308
+ const line = paragraph2.position?.end.line;
14116
13309
  if (offset === void 0 || line === void 0) return [];
14117
13310
  if (comment2.position?.start.line !== line + 1) return [];
14118
- const start = definition3.position?.start;
13311
+ const start = definition2.position?.start;
14119
13312
  if (!start || start.offset === void 0) return [];
14120
13313
  const lead = (lines.text[start.line - 1] ?? "").slice(
14121
13314
  0,
@@ -14136,30 +13329,30 @@ function linkedReference(reference2, parent, source) {
14136
13329
  }
14137
13330
  return source.slice(start, start + 2) === "[^" ? start + 1 : void 0;
14138
13331
  }
14139
- function labelRowUnderTable(definition3, parent, source, lines) {
14140
- const index = parent.children.indexOf(definition3);
13332
+ function labelRowUnderTable(definition2, parent, source, lines) {
13333
+ const index = parent.children.indexOf(definition2);
14141
13334
  const table2 = parent.children[index - 1];
14142
13335
  const at3 = table2?.position?.start.offset;
14143
- const line = definition3.position?.start.line;
13336
+ const line = definition2.position?.start.line;
14144
13337
  if (table2?.type !== "table" || at3 === void 0 || line === void 0) {
14145
13338
  return void 0;
14146
13339
  }
14147
13340
  if (table2.position?.end.line !== line - 1) return void 0;
14148
13341
  if (source[at3] === "|") return void 0;
14149
- const colon5 = labelColon(definition3, source);
13342
+ const colon5 = labelColon(definition2, source);
14150
13343
  if (colon5 === void 0) return void 0;
14151
13344
  const lineEnd2 = (lines.starts[line - 1] ?? 0) + (lines.text[line - 1] ?? "").length;
14152
13345
  return source.slice(colon5, lineEnd2).includes("|") ? colon5 : void 0;
14153
13346
  }
14154
- function isCalloutTitle(paragraph3, parent) {
14155
- if (parent?.type !== "blockquote" || parent.children[0] !== paragraph3) {
13347
+ function isCalloutTitle(paragraph2, parent) {
13348
+ if (parent?.type !== "blockquote" || parent.children[0] !== paragraph2) {
14156
13349
  return false;
14157
13350
  }
14158
- const lead = paragraph3.children[0];
13351
+ const lead = paragraph2.children[0];
14159
13352
  return lead?.type === "text" && MARKER6.test(lead.value);
14160
13353
  }
14161
- function titleLeavesLabel(paragraph3, labelLine, lines, parse3) {
14162
- const position = paragraph3.position;
13354
+ function titleLeavesLabel(paragraph2, labelLine, lines, parse3) {
13355
+ const position = paragraph2.position;
14163
13356
  if (!position || position.start.offset === void 0) return false;
14164
13357
  const prefixLength = position.start.offset - (lines.starts[position.start.line - 1] ?? 0);
14165
13358
  const body = [];
@@ -14171,14 +13364,14 @@ function titleLeavesLabel(paragraph3, labelLine, lines, parse3) {
14171
13364
  const before2 = blocks[blocks.length - 2];
14172
13365
  return label?.type === "footnoteDefinition" && label.position?.start.line === body.length && !(before2?.type === "paragraph" && before2.position?.end.line === body.length - 1);
14173
13366
  }
14174
- function columns(text4) {
13367
+ function columns(text3) {
14175
13368
  let column = 0;
14176
- for (const character of text4)
13369
+ for (const character of text3)
14177
13370
  column = character === " " ? column + 4 - column % 4 : column + 1;
14178
13371
  return column;
14179
13372
  }
14180
- function lazyCommentOpener(paragraph3, lines) {
14181
- const position = paragraph3.position;
13373
+ function lazyCommentOpener(paragraph2, lines) {
13374
+ const position = paragraph2.position;
14182
13375
  if (!position || position.start.offset === void 0) return void 0;
14183
13376
  const first = position.start.line;
14184
13377
  const prefix2 = (lines.text[first - 1] ?? "").slice(
@@ -14239,16 +13432,16 @@ function lazyCommentNode(comment2, container, lines) {
14239
13432
  const offset = lines.starts[line - 1];
14240
13433
  return lazy && offset !== void 0 ? { kind: "split", offset, text: "" } : void 0;
14241
13434
  }
14242
- function labelColon(definition3, source) {
14243
- const start = definition3.position?.start.offset;
14244
- const label = definition3.label;
13435
+ function labelColon(definition2, source) {
13436
+ const start = definition2.position?.start.offset;
13437
+ const label = definition2.label;
14245
13438
  if (start === void 0 || label === void 0) return void 0;
14246
13439
  const close2 = start + 2 + label.length;
14247
13440
  return source.slice(start, start + 2) === "[^" && source[close2] === "]" && source[close2 + 1] === ":" ? close2 + 1 : void 0;
14248
13441
  }
14249
- function linkLabelColon(definition3, source) {
14250
- const start = definition3.position?.start.offset;
14251
- const end = definition3.position?.end.offset;
13442
+ function linkLabelColon(definition2, source) {
13443
+ const start = definition2.position?.start.offset;
13444
+ const end = definition2.position?.end.offset;
14252
13445
  if (start === void 0 || end === void 0) return void 0;
14253
13446
  const open = source.indexOf("[", start);
14254
13447
  if (open === -1 || open >= end) return void 0;
@@ -14261,26 +13454,26 @@ function linkLabelColon(definition3, source) {
14261
13454
  }
14262
13455
  return void 0;
14263
13456
  }
14264
- function orderedDelimiter(list4, source) {
14265
- let at3 = list4.position?.start.offset;
13457
+ function orderedDelimiter(list3, source) {
13458
+ let at3 = list3.position?.start.offset;
14266
13459
  if (at3 === void 0) return void 0;
14267
13460
  while (at3 < source.length && /[0-9]/u.test(source[at3])) at3 += 1;
14268
13461
  return source[at3] === "." || source[at3] === ")" ? at3 : void 0;
14269
13462
  }
14270
13463
  function restOf(lines, line, prefixLength) {
14271
- const text4 = lines.text[line - 1];
14272
- if (text4 === void 0) return void 0;
14273
- const prefix2 = text4.slice(0, prefixLength);
13464
+ const text3 = lines.text[line - 1];
13465
+ if (text3 === void 0) return void 0;
13466
+ const prefix2 = text3.slice(0, prefixLength);
14274
13467
  if (prefix2.length < prefixLength || !CONTAINER_PREFIX.test(prefix2)) {
14275
13468
  return void 0;
14276
13469
  }
14277
- return text4.slice(prefixLength);
13470
+ return text3.slice(prefixLength);
14278
13471
  }
14279
13472
  function splitBefore(lines, line, prefixLength) {
14280
- const text4 = lines.text[line - 1];
13473
+ const text3 = lines.text[line - 1];
14281
13474
  const offset = lines.starts[line - 1];
14282
- if (text4 === void 0 || offset === void 0) return void 0;
14283
- const prefix2 = text4.slice(0, prefixLength);
13475
+ if (text3 === void 0 || offset === void 0) return void 0;
13476
+ const prefix2 = text3.slice(0, prefixLength);
14284
13477
  if (!CONTAINER_PREFIX.test(prefix2)) return void 0;
14285
13478
  return { kind: "split", offset, text: prefix2.trimEnd() };
14286
13479
  }
@@ -14299,12 +13492,12 @@ function applyEdits(source, lines, edits) {
14299
13492
  const sorted = [...edits].sort(
14300
13493
  (a, b) => a.offset - b.offset || order[a.kind] - order[b.kind]
14301
13494
  );
14302
- let text4 = "";
13495
+ let text3 = "";
14303
13496
  let cursor = 0;
14304
13497
  let line = 1;
14305
13498
  const append = (part) => {
14306
13499
  for (const char of part) if (char === "\n") line += 1;
14307
- text4 += part;
13500
+ text3 += part;
14308
13501
  };
14309
13502
  const insertions = [];
14310
13503
  const inline = [];
@@ -14313,7 +13506,7 @@ function applyEdits(source, lines, edits) {
14313
13506
  cursor = edit.offset;
14314
13507
  if (edit.kind === "unbox") {
14315
13508
  inline.push({
14316
- at: text4.length,
13509
+ at: text3.length,
14317
13510
  removed: edit.length,
14318
13511
  inserted: 0,
14319
13512
  line,
@@ -14322,7 +13515,7 @@ function applyEdits(source, lines, edits) {
14322
13515
  cursor += edit.length;
14323
13516
  } else if (edit.kind === "prefix") {
14324
13517
  inline.push({
14325
- at: text4.length,
13518
+ at: text3.length,
14326
13519
  removed: 0,
14327
13520
  inserted: edit.text.length,
14328
13521
  line
@@ -14335,7 +13528,7 @@ function applyEdits(source, lines, edits) {
14335
13528
  const blank = `${edit.text}
14336
13529
  `;
14337
13530
  insertions.push({
14338
- at: text4.length,
13531
+ at: text3.length,
14339
13532
  length: blank.length,
14340
13533
  before: lines.starts.indexOf(edit.offset) + 1
14341
13534
  });
@@ -14343,7 +13536,7 @@ function applyEdits(source, lines, edits) {
14343
13536
  }
14344
13537
  }
14345
13538
  append(source.slice(cursor));
14346
- return { text: text4, insertions, inline };
13539
+ return { text: text3, insertions, inline };
14347
13540
  }
14348
13541
  function mapBack(tree, edited, lines) {
14349
13542
  const { insertions, inline } = edited;
@@ -14371,11 +13564,11 @@ function mapBack(tree, edited, lines) {
14371
13564
  }
14372
13565
  if (p.offset >= insertion.at) {
14373
13566
  const line = end ? insertion.before - 1 : insertion.before;
14374
- const text4 = lines.text[line - 1] ?? "";
13567
+ const text3 = lines.text[line - 1] ?? "";
14375
13568
  const start = lines.starts[line - 1] ?? 0;
14376
13569
  p.line = line;
14377
- p.column = end ? text4.length + 1 : 1;
14378
- p.offset = end ? start + text4.length : start;
13570
+ p.column = end ? text3.length + 1 : 1;
13571
+ p.offset = end ? start + text3.length : start;
14379
13572
  return;
14380
13573
  }
14381
13574
  break;
@@ -14429,10 +13622,10 @@ function mapBack(tree, edited, lines) {
14429
13622
  tree.data.lineOffsets = remapped;
14430
13623
  }
14431
13624
  }
14432
- function lineOfOffset(text4, offset) {
13625
+ function lineOfOffset(text3, offset) {
14433
13626
  let line = 0;
14434
13627
  for (let at3 = 0; at3 < offset; at3 += 1) {
14435
- if (text4[at3] === "\n") line += 1;
13628
+ if (text3[at3] === "\n") line += 1;
14436
13629
  }
14437
13630
  return line;
14438
13631
  }
@@ -14616,15 +13809,15 @@ function commentParseTransform(tree, source, reparse) {
14616
13809
  const to = closed ? end - MARKER7.length : end;
14617
13810
  if (to <= from) return;
14618
13811
  const depth = depthOf.get(node2);
14619
- const map3 = mapLines(
13812
+ const map = mapLines(
14620
13813
  source,
14621
13814
  from,
14622
13815
  to,
14623
13816
  startLine,
14624
13817
  depth ? depth : void 0
14625
13818
  );
14626
- const fragment = reparse(map3.text);
14627
- for (const child of fragment.children) shiftByMap(child, map3, 0);
13819
+ const fragment = reparse(map.text);
13820
+ for (const child of fragment.children) shiftByMap(child, map, 0);
14628
13821
  const inline = !BLOCK_PARENTS.has(parent?.type ?? "root");
14629
13822
  const only = fragment.children[0];
14630
13823
  comment2.children = inline && fragment.children.length === 1 && only?.type === "paragraph" ? only.children : fragment.children;
@@ -14647,8 +13840,8 @@ function dedent(line, columns2) {
14647
13840
  return line.slice(index);
14648
13841
  }
14649
13842
  function footnoteCodeBlankLinesTransform(tree) {
14650
- visit(tree, "footnoteDefinition", (definition3) => {
14651
- visit(definition3, (node2) => {
13843
+ visit(tree, "footnoteDefinition", (definition2) => {
13844
+ visit(definition2, (node2) => {
14652
13845
  if (node2.type !== "code" && node2.type !== "math") return;
14653
13846
  const block = node2;
14654
13847
  if (!/\n|^[ \t]+$/u.test(block.value)) return;
@@ -14670,8 +13863,8 @@ function ensureLineOffsets(tree) {
14670
13863
  }
14671
13864
  function lineOffsetsFromMarkdown() {
14672
13865
  function record(token) {
14673
- const root2 = this.stack[0];
14674
- const data = root2.data ??= {};
13866
+ const root = this.stack[0];
13867
+ const data = root.data ??= {};
14675
13868
  const offsets = data.lineOffsets ??= {};
14676
13869
  const line = token.end.line;
14677
13870
  const consumed = token.end.column - 1;
@@ -14698,33 +13891,33 @@ function mathMidlineTransform(tree, source) {
14698
13891
  -1
14699
13892
  );
14700
13893
  if (host?.type !== "paragraph") continue;
14701
- const paragraph3 = host;
13894
+ const paragraph2 = host;
14702
13895
  const nested = block !== host;
14703
- const start = paragraph3.position?.start?.offset;
14704
- const end = paragraph3.position?.end?.offset;
14705
- const line = paragraph3.position?.start?.line;
13896
+ const start = paragraph2.position?.start?.offset;
13897
+ const end = paragraph2.position?.end?.offset;
13898
+ const line = paragraph2.position?.start?.line;
14706
13899
  const closeEnd = math3.position?.end?.offset;
14707
13900
  if (start === void 0 || end === void 0) continue;
14708
13901
  if (line === void 0 || closeEnd === void 0) continue;
14709
- const map3 = mapLines(source, start, end, line);
14710
- const lines = map3.text.split("\n");
14711
- const opener2 = lines.findIndex((text4) => text4.endsWith("$$"));
13902
+ const map = mapLines(source, start, end, line);
13903
+ const lines = map.text.split("\n");
13904
+ const opener2 = lines.findIndex((text3) => text3.endsWith("$$"));
14712
13905
  if (opener2 === -1) continue;
14713
- const openerStart = map3.starts[opener2] + lines[opener2].length - "$$".length;
14714
- const kept = phrasingBefore(paragraph3, openerStart, source);
13906
+ const openerStart = map.starts[opener2] + lines[opener2].length - "$$".length;
13907
+ const kept = phrasingBefore(paragraph2, openerStart, source);
14715
13908
  if (!kept) continue;
14716
- const content = (paragraph3.position?.start?.column ?? 1) - 1;
14717
- const body = lines.slice(opener2 + 1).map((text4, at3) => {
14718
- const from = map3.starts[opener2 + 1 + at3];
13909
+ const content = (paragraph2.position?.start?.column ?? 1) - 1;
13910
+ const body = lines.slice(opener2 + 1).map((text3, at3) => {
13911
+ const from = map.starts[opener2 + 1 + at3];
14719
13912
  const prefix2 = from - (source.lastIndexOf("\n", from - 1) + 1);
14720
13913
  let strip = 0;
14721
- while (strip < content - prefix2 && text4[strip] === " ") strip++;
14722
- return text4.slice(strip);
13914
+ while (strip < content - prefix2 && text3[strip] === " ") strip++;
13915
+ return text3.slice(strip);
14723
13916
  }).join("\n");
14724
13917
  setMathValue(math3, body);
14725
13918
  if (math3.position) {
14726
13919
  math3.position.start = {
14727
- line: map3.lines[opener2],
13920
+ line: map.lines[opener2],
14728
13921
  column: 1,
14729
13922
  offset: openerStart
14730
13923
  };
@@ -14741,14 +13934,14 @@ function mathMidlineTransform(tree, source) {
14741
13934
  if (!nested) parent.children.splice(index, 1);
14742
13935
  else {
14743
13936
  const inner = block.children;
14744
- inner.splice(inner.indexOf(paragraph3), 1);
13937
+ inner.splice(inner.indexOf(paragraph2), 1);
14745
13938
  }
14746
13939
  return;
14747
13940
  }
14748
- paragraph3.children = kept;
14749
- if (paragraph3.position) {
14750
- paragraph3.position.end = {
14751
- line: map3.lines[opener2],
13941
+ paragraph2.children = kept;
13942
+ if (paragraph2.position) {
13943
+ paragraph2.position.end = {
13944
+ line: map.lines[opener2],
14752
13945
  column: 1,
14753
13946
  offset: openerStart
14754
13947
  };
@@ -14757,9 +13950,9 @@ function mathMidlineTransform(tree, source) {
14757
13950
  }
14758
13951
  });
14759
13952
  }
14760
- function phrasingBefore(paragraph3, at3, source) {
13953
+ function phrasingBefore(paragraph2, at3, source) {
14761
13954
  const kept = [];
14762
- for (const child of paragraph3.children) {
13955
+ for (const child of paragraph2.children) {
14763
13956
  const start = child.position?.start?.offset;
14764
13957
  const end = child.position?.end?.offset;
14765
13958
  if (start === void 0 || end === void 0) return void 0;
@@ -14823,11 +14016,11 @@ function calloutTitleInterruptTransform(tree, source, reparse) {
14823
14016
  if (startLine === void 0 || endLine === void 0) return;
14824
14017
  if (startLine !== titleLine + 1 || endLine !== startLine) return;
14825
14018
  const nl = source.indexOf("\n", from);
14826
- const text4 = source.slice(from, nl === -1 ? void 0 : nl);
14827
- const ordered = ORDERED.exec(text4);
14019
+ const text3 = source.slice(from, nl === -1 ? void 0 : nl);
14020
+ const ordered = ORDERED.exec(text3);
14828
14021
  if (!ordered) return;
14829
14022
  if (ordered[1] === "1") return;
14830
- const parsed = reparse(text4).children[0];
14023
+ const parsed = reparse(text3).children[0];
14831
14024
  if (parsed?.type !== "list") return;
14832
14025
  for (const child of [parsed]) shift(child, from, startLine - 1);
14833
14026
  callout.children[index] = parsed;
@@ -14844,12 +14037,12 @@ function written(node2) {
14844
14037
  }
14845
14038
  return void 0;
14846
14039
  }
14847
- function locate11(source, text4, cursor, tolerant) {
14848
- const at3 = source.indexOf(text4, cursor);
14849
- if (at3 !== -1) return [at3, at3 + text4.length];
14040
+ function locate11(source, text3, cursor, tolerant) {
14041
+ const at3 = source.indexOf(text3, cursor);
14042
+ if (at3 !== -1) return [at3, at3 + text3.length];
14850
14043
  if (!tolerant) return void 0;
14851
14044
  const pattern = new RegExp(
14852
- text4.split("\n").map(
14045
+ text3.split("\n").map(
14853
14046
  (line) => [...line].map(
14854
14047
  (character) => /[!-/:-@[-`{-~]/u.test(character) ? `\\\\?${character.replace(/[.*+?^${}()|[\]\\]/u, "\\$&")}` : character
14855
14048
  ).join("")
@@ -14880,9 +14073,9 @@ function restoreInlinePositionsTransform(tree, source) {
14880
14073
  cursor = end;
14881
14074
  continue;
14882
14075
  }
14883
- const text4 = written(child);
14884
- if (text4 === void 0 || text4 === "") return;
14885
- const found = locate11(source, text4, cursor, child.type === "text");
14076
+ const text3 = written(child);
14077
+ if (text3 === void 0 || text3 === "") return;
14078
+ const found = locate11(source, text3, cursor, child.type === "text");
14886
14079
  if (found === void 0 || found[1] > to) return;
14887
14080
  spans.push(found);
14888
14081
  cursor = found[1];
@@ -14909,6 +14102,7 @@ function restoreInlinePositionsTransform(tree, source) {
14909
14102
  }
14910
14103
 
14911
14104
  // src/lib/mdast/attention-to-markdown.ts
14105
+ import { defaultHandlers as defaultHandlers2 } from "mdast-util-to-markdown";
14912
14106
  var parentOf = /* @__PURE__ */ new WeakMap();
14913
14107
  function recordParents(node2) {
14914
14108
  for (const child of node2.children ?? []) {
@@ -15016,8 +14210,8 @@ function attentionToMarkdown(options) {
15016
14210
  });
15017
14211
  };
15018
14212
  const wrap = (base) => {
15019
- const handle2 = ((...args) => base(...args));
15020
- const own5 = handle2;
14213
+ const handle = ((...args) => base(...args));
14214
+ const own5 = handle;
15021
14215
  own5.peek = base.peek;
15022
14216
  own5.attention = (node2, state) => {
15023
14217
  const result = base.attention(
@@ -15057,23 +14251,29 @@ function attentionToMarkdown(options) {
15057
14251
  }
15058
14252
  return result;
15059
14253
  };
15060
- return handle2;
14254
+ return handle;
15061
14255
  };
15062
- const root2 = ((...args) => {
15063
- recordParents(args[0]);
15064
- if (options.legacy) markAdjacent(args[0]);
15065
- return removeTagEnds(handle.root(...args));
14256
+ const root = ((...args) => {
14257
+ const restoreEmptyDeletes = markEmptyDeletes(args[0]);
14258
+ try {
14259
+ recordParents(args[0]);
14260
+ if (options.legacy) markAdjacent(args[0]);
14261
+ return removeTagEnds(defaultHandlers2.root(...args));
14262
+ } finally {
14263
+ restoreEmptyDeletes();
14264
+ }
15066
14265
  });
15067
14266
  return {
15068
14267
  handlers: {
15069
- root: root2,
15070
- emphasis: wrap(handle.emphasis),
15071
- strong: wrap(handle.strong)
14268
+ root,
14269
+ emphasis: wrap(defaultHandlers2.emphasis),
14270
+ strong: wrap(defaultHandlers2.strong)
15072
14271
  }
15073
14272
  };
15074
14273
  }
15075
14274
 
15076
14275
  // src/lib/mdast/autolink-literal-to-markdown.ts
14276
+ import { defaultHandlers as defaultHandlers3 } from "mdast-util-to-markdown";
15077
14277
  var MAILTO = "mailto:";
15078
14278
  var LOCAL = new Set(
15079
14279
  "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.!#$%&'*+/=?^_`{|}~-"
@@ -15123,11 +14323,11 @@ function autolinkLiteralToMarkdown(options = {}) {
15123
14323
  return {
15124
14324
  handlers: {
15125
14325
  link(node2, parent, state, info) {
15126
- const text4 = soleText(node2);
15127
- if (text4 !== void 0 && !node2.title && node2.url === MAILTO + text4 && !isCommonMarkEmail(text4) && isGfmLiteralEmail(text4)) {
15128
- return text4;
14326
+ const text3 = soleText(node2);
14327
+ if (text3 !== void 0 && !node2.title && node2.url === MAILTO + text3 && !isCommonMarkEmail(text3) && isGfmLiteralEmail(text3)) {
14328
+ return text3;
15129
14329
  }
15130
- const written2 = handle.link(
14330
+ const written2 = defaultHandlers3.link(
15131
14331
  node2,
15132
14332
  parent,
15133
14333
  state,
@@ -15174,6 +14374,7 @@ function htmlTailToMarkdown() {
15174
14374
  }
15175
14375
 
15176
14376
  // src/lib/mdast/link-reference-to-markdown.ts
14377
+ import { defaultHandlers as defaultHandlers4 } from "mdast-util-to-markdown";
15177
14378
  var BLANK3 = /^[ \t\n]+$/u;
15178
14379
  var LABEL4 = "\uE00F";
15179
14380
  function withSpelledLabel(node2, write) {
@@ -15196,14 +14397,14 @@ function linkReferenceToMarkdown(options = {}) {
15196
14397
  }
15197
14398
  const written2 = withSpelledLabel(
15198
14399
  node2,
15199
- (own5) => handle.linkReference(own5, parent, state, info)
14400
+ (own5) => defaultHandlers4.linkReference(own5, parent, state, info)
15200
14401
  );
15201
14402
  return balanceLabel(node2, state, written2, options.strict);
15202
14403
  },
15203
14404
  imageReference(node2, parent, state, info) {
15204
14405
  return withSpelledLabel(
15205
14406
  node2,
15206
- (own5) => handle.imageReference(own5, parent, state, info)
14407
+ (own5) => defaultHandlers4.imageReference(own5, parent, state, info)
15207
14408
  );
15208
14409
  }
15209
14410
  }
@@ -15232,7 +14433,7 @@ function frontmatterTailTransform(tree, source, reparse) {
15232
14433
  });
15233
14434
  const closeEnd = lineStarts[closeIndex] + 3;
15234
14435
  const rest = [tail, ...lines.slice(closeIndex + 1)].join("\n");
15235
- const map3 = {
14436
+ const map = {
15236
14437
  text: rest,
15237
14438
  starts: [
15238
14439
  closeEnd,
@@ -15244,7 +14445,7 @@ function frontmatterTailTransform(tree, source, reparse) {
15244
14445
  ]
15245
14446
  };
15246
14447
  const parsed = reparse(rest);
15247
- for (const child of parsed.children) shiftByMap(child, map3, 0);
14448
+ for (const child of parsed.children) shiftByMap(child, map, 0);
15248
14449
  const first = parsed.children[0];
15249
14450
  if (first?.position) {
15250
14451
  first.position.start = {
@@ -15291,9 +14492,9 @@ function frontmatterUnclosedTransform(tree, source, reparse) {
15291
14492
  mapped.push(index + 1);
15292
14493
  offset += lines[index].length + 1;
15293
14494
  }
15294
- const map3 = { text: rest, starts, lines: mapped };
14495
+ const map = { text: rest, starts, lines: mapped };
15295
14496
  const parsed = reparse(rest);
15296
- for (const child of parsed.children) shiftByMap(child, map3, 0);
14497
+ for (const child of parsed.children) shiftByMap(child, map, 0);
15297
14498
  tree.children = [head, ...parsed.children];
15298
14499
  }
15299
14500
 
@@ -15415,23 +14616,23 @@ function splitTails(parent, source, reparse) {
15415
14616
  }
15416
14617
  }
15417
14618
  function absorbLazyLine(children, index, source) {
15418
- const definition3 = children[index];
15419
- if (definition3?.type !== "footnoteDefinition" && definition3?.type !== "paragraph") {
14619
+ const definition2 = children[index];
14620
+ if (definition2?.type !== "footnoteDefinition" && definition2?.type !== "paragraph") {
15420
14621
  return;
15421
14622
  }
15422
14623
  const next = children[index + 1];
15423
14624
  if (next?.type !== "paragraph") return;
15424
- const end = definition3.position?.end?.offset;
14625
+ const end = definition2.position?.end?.offset;
15425
14626
  const start = next.position?.start?.offset;
15426
14627
  if (end === void 0 || start === void 0) return;
15427
14628
  if (source.slice(end, start) !== "\n") return;
15428
- const host = definition3.type === "paragraph" ? definition3 : definition3.children[definition3.children.length - 1];
14629
+ const host = definition2.type === "paragraph" ? definition2 : definition2.children[definition2.children.length - 1];
15429
14630
  if (host?.type !== "paragraph") return;
15430
14631
  host.children.push(
15431
14632
  span({ type: "text", value: "\n" }, source, end, start),
15432
14633
  ...next.children
15433
14634
  );
15434
- for (const node2 of /* @__PURE__ */ new Set([host, definition3])) {
14635
+ for (const node2 of /* @__PURE__ */ new Set([host, definition2])) {
15435
14636
  if (node2.position && next.position?.end) {
15436
14637
  node2.position.end = { ...next.position.end };
15437
14638
  }
@@ -15449,26 +14650,26 @@ function definitionContinuationTransform(tree, source, reparse) {
15449
14650
  if (!Array.isArray(parent.children)) return;
15450
14651
  for (let index = parent.children.length - 1; index > 0; index--) {
15451
14652
  const block = parent.children[index];
15452
- const definition3 = parent.children[index - 1];
15453
- if (block?.type !== "code" || definition3?.type !== "footnoteDefinition") {
14653
+ const definition2 = parent.children[index - 1];
14654
+ if (block?.type !== "code" || definition2?.type !== "footnoteDefinition") {
15454
14655
  continue;
15455
14656
  }
15456
14657
  const from = block.position?.start?.offset;
15457
14658
  const to = block.position?.end?.offset;
15458
14659
  const startLine = block.position?.start?.line;
15459
- const definitionEnd = definition3.position?.end?.offset;
14660
+ const definitionEnd = definition2.position?.end?.offset;
15460
14661
  if (from === void 0 || to === void 0) continue;
15461
14662
  if (startLine === void 0 || definitionEnd === void 0) continue;
15462
14663
  if (source.slice(definitionEnd, from) !== "\n\n") continue;
15463
14664
  if (!/^ {4}/u.test(source.slice(from, from + 4))) continue;
15464
- const map3 = dedent2(source, from, to, startLine);
15465
- const parsed = reparse(map3.text);
15466
- for (const child of parsed.children) shiftByMap(child, map3, 0);
15467
- definition3.children.push(
14665
+ const map = dedent2(source, from, to, startLine);
14666
+ const parsed = reparse(map.text);
14667
+ for (const child of parsed.children) shiftByMap(child, map, 0);
14668
+ definition2.children.push(
15468
14669
  ...parsed.children
15469
14670
  );
15470
- if (definition3.position && block.position) {
15471
- definition3.position.end = { ...block.position.end };
14671
+ if (definition2.position && block.position) {
14672
+ definition2.position.end = { ...block.position.end };
15472
14673
  }
15473
14674
  parent.children.splice(index, 1);
15474
14675
  }
@@ -15481,12 +14682,12 @@ function definitionLazyTransform(tree, source) {
15481
14682
  if (!Array.isArray(parent.children)) return;
15482
14683
  for (let index = parent.children.length - 1; index > 0; index--) {
15483
14684
  const block = parent.children[index];
15484
- const definition3 = parent.children[index - 1];
14685
+ const definition2 = parent.children[index - 1];
15485
14686
  if (block?.type !== "paragraph") continue;
15486
- if (definition3?.type !== "footnoteDefinition") continue;
15487
- const definitionEnd = definition3.position?.end?.offset;
14687
+ if (definition2?.type !== "footnoteDefinition") continue;
14688
+ const definitionEnd = definition2.position?.end?.offset;
15488
14689
  const from = block.position?.start?.offset;
15489
- const definitionStart = definition3.position?.start?.offset;
14690
+ const definitionStart = definition2.position?.start?.offset;
15490
14691
  if (definitionEnd === void 0 || from === void 0) continue;
15491
14692
  if (definitionStart === void 0) continue;
15492
14693
  if (source.slice(definitionEnd, from) !== "\n") continue;
@@ -15497,19 +14698,19 @@ function definitionLazyTransform(tree, source) {
15497
14698
  definitionEnd === definitionStart ? definitionEnd : (source.indexOf("\n", definitionStart) + 1 || definitionEnd + 1) - 1
15498
14699
  );
15499
14700
  if (BARE_COLON.test(firstLine)) continue;
15500
- const tail = definition3.children[definition3.children.length - 1];
14701
+ const tail = definition2.children[definition2.children.length - 1];
15501
14702
  const host = tail?.type === "list" ? tail.children[tail.children.length - 1] : void 0;
15502
14703
  if (host) {
15503
14704
  host.children.push(block);
15504
- for (const node3 of [host, tail, definition3]) {
14705
+ for (const node3 of [host, tail, definition2]) {
15505
14706
  if (node3.position && block.position) {
15506
14707
  node3.position.end = { ...block.position.end };
15507
14708
  }
15508
14709
  }
15509
14710
  } else {
15510
- definition3.children.push(block);
15511
- if (definition3.position && block.position) {
15512
- definition3.position.end = { ...block.position.end };
14711
+ definition2.children.push(block);
14712
+ if (definition2.position && block.position) {
14713
+ definition2.position.end = { ...block.position.end };
15513
14714
  }
15514
14715
  }
15515
14716
  parent.children.splice(index, 1);
@@ -15518,7 +14719,7 @@ function definitionLazyTransform(tree, source) {
15518
14719
  }
15519
14720
  function dedent2(source, start, end, startLine) {
15520
14721
  const raw = source.slice(start, end).split("\n");
15521
- const text4 = [];
14722
+ const text3 = [];
15522
14723
  const starts = [];
15523
14724
  const lines = [];
15524
14725
  let offset = start;
@@ -15527,13 +14728,14 @@ function dedent2(source, start, end, startLine) {
15527
14728
  const indent2 = CONTINUATION_INDENT2.exec(line)?.[0] ?? "";
15528
14729
  starts.push(offset + indent2.length);
15529
14730
  lines.push(startLine + index);
15530
- text4.push(line.slice(indent2.length));
14731
+ text3.push(line.slice(indent2.length));
15531
14732
  offset += line.length + 1;
15532
14733
  }
15533
- return { text: text4.join("\n"), starts, lines };
14734
+ return { text: text3.join("\n"), starts, lines };
15534
14735
  }
15535
14736
 
15536
14737
  // src/lib/mdast/task-char-to-markdown.ts
14738
+ import { defaultHandlers as defaultHandlers5 } from "mdast-util-to-markdown";
15537
14739
  function taskCharToMarkdown(options = {}) {
15538
14740
  return {
15539
14741
  unsafe: [{ atBreak: true, character: "-", after: "[:|-]" }],
@@ -15554,14 +14756,14 @@ function taskCharToMarkdown(options = {}) {
15554
14756
  const head = node2.children[0];
15555
14757
  const isTask = taskChar !== null;
15556
14758
  if (!isTask) {
15557
- return handle.listItem(node2, parent, state, info);
14759
+ return defaultHandlers5.listItem(node2, parent, state, info);
15558
14760
  }
15559
14761
  const checkbox = `[${taskChar}] `;
15560
14762
  const tracker = state.createTracker(info);
15561
14763
  tracker.move(checkbox);
15562
14764
  const savedChecked = node2.checked;
15563
14765
  delete node2.checked;
15564
- let value2 = handle.listItem(node2, parent, state, {
14766
+ let value2 = defaultHandlers5.listItem(node2, parent, state, {
15565
14767
  ...info,
15566
14768
  ...tracker.current()
15567
14769
  });
@@ -15579,6 +14781,7 @@ function taskCharToMarkdown(options = {}) {
15579
14781
  }
15580
14782
 
15581
14783
  // src/lib/mdast/text-to-markdown.ts
14784
+ import { defaultHandlers as defaultHandlers6 } from "mdast-util-to-markdown";
15582
14785
  function textToMarkdown(tags2, highlights2 = false, legacy = false) {
15583
14786
  return {
15584
14787
  handlers: {
@@ -15590,7 +14793,7 @@ function textToMarkdown(tags2, highlights2 = false, legacy = false) {
15590
14793
  // or a character reference, is escaped too.
15591
14794
  text(node2, parent, state, info) {
15592
14795
  let written2 = escapeHashRuns(
15593
- handle.text(node2, parent, state, info),
14796
+ defaultHandlers6.text(node2, parent, state, info),
15594
14797
  tags2
15595
14798
  ).replace(/(?<!\\)((?:\\\\)*)\\(\s+)$/u, "$1\\\\$2");
15596
14799
  const siblingsOf = parent?.children ?? [];
@@ -15663,8 +14866,8 @@ function guardBlankLines(written2, afterBreak, after) {
15663
14866
  }
15664
14867
  if (!/^\s+$/u.test(line) || /^[ \t]+$/u.test(line)) return line;
15665
14868
  const at3 = line.search(/[^ \t]/u);
15666
- const code2 = line.codePointAt(at3);
15667
- return `${line.slice(0, at3)}&#x${code2.toString(16).toUpperCase()};${line.slice(at3 + String.fromCodePoint(code2).length)}`;
14869
+ const code = line.codePointAt(at3);
14870
+ return `${line.slice(0, at3)}&#x${code.toString(16).toUpperCase()};${line.slice(at3 + String.fromCodePoint(code).length)}`;
15668
14871
  }).join("\n");
15669
14872
  }
15670
14873
  function guardAmpersands(written2) {
@@ -15757,127 +14960,127 @@ function tokenizeMathFenced(effects, ok3, nok) {
15757
14960
  const initialSize = tail && tail[1].type === "linePrefix" ? tail[2].sliceSerialize(tail[1], true).length : 0;
15758
14961
  let sizeOpen = 0;
15759
14962
  return start;
15760
- function start(code2) {
14963
+ function start(code) {
15761
14964
  effects.enter("mathFlow");
15762
14965
  effects.enter("mathFlowFence");
15763
14966
  effects.enter("mathFlowFenceSequence");
15764
- return sequenceOpen(code2);
14967
+ return sequenceOpen(code);
15765
14968
  }
15766
- function sequenceOpen(code2) {
15767
- if (code2 === 36) {
15768
- effects.consume(code2);
14969
+ function sequenceOpen(code) {
14970
+ if (code === 36) {
14971
+ effects.consume(code);
15769
14972
  sizeOpen++;
15770
14973
  return sequenceOpen;
15771
14974
  }
15772
14975
  if (sizeOpen < 2) {
15773
- return nok(code2);
14976
+ return nok(code);
15774
14977
  }
15775
14978
  effects.exit("mathFlowFenceSequence");
15776
- return factorySpace(effects, metaBefore, "whitespace")(code2);
14979
+ return factorySpace(effects, metaBefore, "whitespace")(code);
15777
14980
  }
15778
- function metaBefore(code2) {
15779
- if (code2 === null || markdownLineEnding(code2)) {
15780
- return metaAfter(code2);
14981
+ function metaBefore(code) {
14982
+ if (code === null || markdownLineEnding(code)) {
14983
+ return metaAfter(code);
15781
14984
  }
15782
14985
  effects.enter("mathFlowFenceMeta");
15783
14986
  effects.enter("chunkString", {
15784
14987
  contentType: "string"
15785
14988
  });
15786
- return meta(code2);
14989
+ return meta(code);
15787
14990
  }
15788
- function meta(code2) {
15789
- if (code2 === null || markdownLineEnding(code2)) {
14991
+ function meta(code) {
14992
+ if (code === null || markdownLineEnding(code)) {
15790
14993
  effects.exit("chunkString");
15791
14994
  effects.exit("mathFlowFenceMeta");
15792
- return metaAfter(code2);
14995
+ return metaAfter(code);
15793
14996
  }
15794
- if (code2 === 36) {
15795
- return nok(code2);
14997
+ if (code === 36) {
14998
+ return nok(code);
15796
14999
  }
15797
- effects.consume(code2);
15000
+ effects.consume(code);
15798
15001
  return meta;
15799
15002
  }
15800
- function metaAfter(code2) {
15003
+ function metaAfter(code) {
15801
15004
  effects.exit("mathFlowFence");
15802
15005
  if (self.interrupt) {
15803
- return ok3(code2);
15006
+ return ok3(code);
15804
15007
  }
15805
- return effects.attempt(nonLazyContinuation2, beforeNonLazyContinuation, after)(code2);
15008
+ return effects.attempt(nonLazyContinuation2, beforeNonLazyContinuation, after)(code);
15806
15009
  }
15807
- function beforeNonLazyContinuation(code2) {
15010
+ function beforeNonLazyContinuation(code) {
15808
15011
  return effects.attempt({
15809
15012
  tokenize: tokenizeClosingFence,
15810
15013
  partial: true
15811
- }, after, contentStart)(code2);
15014
+ }, after, contentStart)(code);
15812
15015
  }
15813
- function contentStart(code2) {
15814
- return (initialSize ? factorySpace(effects, beforeContentChunk, "linePrefix", initialSize + 1) : beforeContentChunk)(code2);
15016
+ function contentStart(code) {
15017
+ return (initialSize ? factorySpace(effects, beforeContentChunk, "linePrefix", initialSize + 1) : beforeContentChunk)(code);
15815
15018
  }
15816
- function beforeContentChunk(code2) {
15817
- if (code2 === null) {
15818
- return after(code2);
15019
+ function beforeContentChunk(code) {
15020
+ if (code === null) {
15021
+ return after(code);
15819
15022
  }
15820
- if (markdownLineEnding(code2)) {
15821
- return effects.attempt(nonLazyContinuation2, beforeNonLazyContinuation, after)(code2);
15023
+ if (markdownLineEnding(code)) {
15024
+ return effects.attempt(nonLazyContinuation2, beforeNonLazyContinuation, after)(code);
15822
15025
  }
15823
15026
  effects.enter("mathFlowValue");
15824
- return contentChunk(code2);
15027
+ return contentChunk(code);
15825
15028
  }
15826
- function contentChunk(code2) {
15827
- if (code2 === null || markdownLineEnding(code2)) {
15029
+ function contentChunk(code) {
15030
+ if (code === null || markdownLineEnding(code)) {
15828
15031
  effects.exit("mathFlowValue");
15829
- return beforeContentChunk(code2);
15032
+ return beforeContentChunk(code);
15830
15033
  }
15831
- effects.consume(code2);
15034
+ effects.consume(code);
15832
15035
  return contentChunk;
15833
15036
  }
15834
- function after(code2) {
15037
+ function after(code) {
15835
15038
  effects.exit("mathFlow");
15836
- return ok3(code2);
15039
+ return ok3(code);
15837
15040
  }
15838
15041
  function tokenizeClosingFence(effects2, ok4, nok2) {
15839
15042
  let size = 0;
15840
15043
  return factorySpace(effects2, beforeSequenceClose, "linePrefix", self.parser.constructs.disable.null.includes("codeIndented") ? void 0 : 4);
15841
- function beforeSequenceClose(code2) {
15044
+ function beforeSequenceClose(code) {
15842
15045
  effects2.enter("mathFlowFence");
15843
15046
  effects2.enter("mathFlowFenceSequence");
15844
- return sequenceClose(code2);
15047
+ return sequenceClose(code);
15845
15048
  }
15846
- function sequenceClose(code2) {
15847
- if (code2 === 36) {
15049
+ function sequenceClose(code) {
15050
+ if (code === 36) {
15848
15051
  size++;
15849
- effects2.consume(code2);
15052
+ effects2.consume(code);
15850
15053
  return sequenceClose;
15851
15054
  }
15852
15055
  if (size < sizeOpen) {
15853
- return nok2(code2);
15056
+ return nok2(code);
15854
15057
  }
15855
15058
  effects2.exit("mathFlowFenceSequence");
15856
- return factorySpace(effects2, afterSequenceClose, "whitespace")(code2);
15059
+ return factorySpace(effects2, afterSequenceClose, "whitespace")(code);
15857
15060
  }
15858
- function afterSequenceClose(code2) {
15859
- if (code2 === null || markdownLineEnding(code2)) {
15061
+ function afterSequenceClose(code) {
15062
+ if (code === null || markdownLineEnding(code)) {
15860
15063
  effects2.exit("mathFlowFence");
15861
- return ok4(code2);
15064
+ return ok4(code);
15862
15065
  }
15863
- return nok2(code2);
15066
+ return nok2(code);
15864
15067
  }
15865
15068
  }
15866
15069
  }
15867
15070
  function tokenizeNonLazyContinuation2(effects, ok3, nok) {
15868
15071
  const self = this;
15869
15072
  return start;
15870
- function start(code2) {
15871
- if (code2 === null) {
15872
- return ok3(code2);
15073
+ function start(code) {
15074
+ if (code === null) {
15075
+ return ok3(code);
15873
15076
  }
15874
15077
  effects.enter("lineEnding");
15875
- effects.consume(code2);
15078
+ effects.consume(code);
15876
15079
  effects.exit("lineEnding");
15877
15080
  return lineStart;
15878
15081
  }
15879
- function lineStart(code2) {
15880
- return self.parser.lazy[self.now().line] ? nok(code2) : ok3(code2);
15082
+ function lineStart(code) {
15083
+ return self.parser.lazy[self.now().line] ? nok(code) : ok3(code);
15881
15084
  }
15882
15085
  }
15883
15086
 
@@ -15900,68 +15103,68 @@ function mathText(options) {
15900
15103
  let size;
15901
15104
  let token;
15902
15105
  return start;
15903
- function start(code2) {
15106
+ function start(code) {
15904
15107
  effects.enter("mathText");
15905
15108
  effects.enter("mathTextSequence");
15906
- return sequenceOpen(code2);
15109
+ return sequenceOpen(code);
15907
15110
  }
15908
- function sequenceOpen(code2) {
15909
- if (code2 === 36) {
15910
- effects.consume(code2);
15111
+ function sequenceOpen(code) {
15112
+ if (code === 36) {
15113
+ effects.consume(code);
15911
15114
  sizeOpen++;
15912
15115
  return sequenceOpen;
15913
15116
  }
15914
15117
  if (sizeOpen < 2 && !single) {
15915
- return nok(code2);
15118
+ return nok(code);
15916
15119
  }
15917
15120
  effects.exit("mathTextSequence");
15918
- return between(code2);
15121
+ return between(code);
15919
15122
  }
15920
- function between(code2) {
15921
- if (code2 === null) {
15922
- return nok(code2);
15123
+ function between(code) {
15124
+ if (code === null) {
15125
+ return nok(code);
15923
15126
  }
15924
- if (code2 === 36) {
15127
+ if (code === 36) {
15925
15128
  token = effects.enter("mathTextSequence");
15926
15129
  size = 0;
15927
- return sequenceClose(code2);
15130
+ return sequenceClose(code);
15928
15131
  }
15929
- if (code2 === 32) {
15132
+ if (code === 32) {
15930
15133
  effects.enter("space");
15931
- effects.consume(code2);
15134
+ effects.consume(code);
15932
15135
  effects.exit("space");
15933
15136
  return between;
15934
15137
  }
15935
- if (markdownLineEnding(code2)) {
15138
+ if (markdownLineEnding(code)) {
15936
15139
  effects.enter("lineEnding");
15937
- effects.consume(code2);
15140
+ effects.consume(code);
15938
15141
  effects.exit("lineEnding");
15939
15142
  return between;
15940
15143
  }
15941
15144
  effects.enter("mathTextData");
15942
- return data(code2);
15145
+ return data(code);
15943
15146
  }
15944
- function data(code2) {
15945
- if (code2 === null || code2 === 32 || code2 === 36 || markdownLineEnding(code2)) {
15147
+ function data(code) {
15148
+ if (code === null || code === 32 || code === 36 || markdownLineEnding(code)) {
15946
15149
  effects.exit("mathTextData");
15947
- return between(code2);
15150
+ return between(code);
15948
15151
  }
15949
- effects.consume(code2);
15152
+ effects.consume(code);
15950
15153
  return data;
15951
15154
  }
15952
- function sequenceClose(code2) {
15953
- if (code2 === 36) {
15954
- effects.consume(code2);
15155
+ function sequenceClose(code) {
15156
+ if (code === 36) {
15157
+ effects.consume(code);
15955
15158
  size++;
15956
15159
  return sequenceClose;
15957
15160
  }
15958
15161
  if (size === sizeOpen) {
15959
15162
  effects.exit("mathTextSequence");
15960
15163
  effects.exit("mathText");
15961
- return ok3(code2);
15164
+ return ok3(code);
15962
15165
  }
15963
15166
  token.type = "mathTextData";
15964
- return data(code2);
15167
+ return data(code);
15965
15168
  }
15966
15169
  }
15967
15170
  }
@@ -16002,8 +15205,8 @@ function resolveMathText(events) {
16002
15205
  }
16003
15206
  return events;
16004
15207
  }
16005
- function previous(code2) {
16006
- return code2 !== 36 || this.events[this.events.length - 1][1].type === "characterEscape";
15208
+ function previous(code) {
15209
+ return code !== 36 || this.events[this.events.length - 1][1].type === "characterEscape";
16007
15210
  }
16008
15211
 
16009
15212
  // node_modules/micromark-extension-math/lib/syntax.js
@@ -16021,11 +15224,11 @@ function math2(options) {
16021
15224
  // src/lib/syntax/math-text.ts
16022
15225
  var DOLLAR2 = codes.dollarSign;
16023
15226
  var BACKSLASH3 = codes.backslash;
16024
- function isDigit(code2) {
16025
- return code2 !== null && code2 >= codes.digit0 && code2 <= codes.digit9;
15227
+ function isDigit(code) {
15228
+ return code !== null && code >= codes.digit0 && code <= codes.digit9;
16026
15229
  }
16027
- function isLineEnding4(code2) {
16028
- return code2 === codes.lineFeed || code2 === codes.carriageReturn || code2 === codes.carriageReturnLineFeed;
15230
+ function isLineEnding4(code) {
15231
+ return code === codes.lineFeed || code === codes.carriageReturn || code === codes.carriageReturnLineFeed;
16029
15232
  }
16030
15233
  function mathTextSyntax() {
16031
15234
  return {
@@ -16035,15 +15238,15 @@ function mathTextSyntax() {
16035
15238
  previous: previousMathText
16036
15239
  };
16037
15240
  }
16038
- function previousMathText(code2) {
16039
- if (code2 !== DOLLAR2) return true;
15241
+ function previousMathText(code) {
15242
+ if (code !== DOLLAR2) return true;
16040
15243
  if (!hasUpstreamMathText(this)) return true;
16041
15244
  return this.events[this.events.length - 1]?.[1].type === types.characterEscape;
16042
15245
  }
16043
15246
  function hasUpstreamMathText(context) {
16044
15247
  const registered = context.parser.constructs.text?.[DOLLAR2];
16045
- const list4 = Array.isArray(registered) ? registered : [registered];
16046
- return list4.some((construct) => construct?.name === "mathText");
15248
+ const list3 = Array.isArray(registered) ? registered : [registered];
15249
+ return list3.some((construct) => construct?.name === "mathText");
16047
15250
  }
16048
15251
  function tokenizeMathText(effects, ok3, nok) {
16049
15252
  let sizeOpen = 0;
@@ -16051,87 +15254,87 @@ function tokenizeMathText(effects, ok3, nok) {
16051
15254
  let token;
16052
15255
  let afterSpace = false;
16053
15256
  return start;
16054
- function start(code2) {
16055
- if (code2 !== DOLLAR2) return nok(code2);
15257
+ function start(code) {
15258
+ if (code !== DOLLAR2) return nok(code);
16056
15259
  effects.enter("mathText");
16057
15260
  effects.enter("mathTextSequence");
16058
- return sequenceOpen(code2);
15261
+ return sequenceOpen(code);
16059
15262
  }
16060
- function sequenceOpen(code2) {
16061
- if (code2 === DOLLAR2 && sizeOpen < 2) {
16062
- effects.consume(code2);
15263
+ function sequenceOpen(code) {
15264
+ if (code === DOLLAR2 && sizeOpen < 2) {
15265
+ effects.consume(code);
16063
15266
  sizeOpen++;
16064
15267
  return sequenceOpen;
16065
15268
  }
16066
- if (sizeOpen === 1 && (isDigit(code2) || code2 === null || code2 === codes.space || code2 === codes.horizontalTab)) {
16067
- return nok(code2);
15269
+ if (sizeOpen === 1 && (isDigit(code) || code === null || code === codes.space || code === codes.horizontalTab)) {
15270
+ return nok(code);
16068
15271
  }
16069
15272
  effects.exit("mathTextSequence");
16070
- return between(code2);
15273
+ return between(code);
16071
15274
  }
16072
- function between(code2) {
16073
- if (code2 === null) return nok(code2);
16074
- if (code2 === DOLLAR2) {
15275
+ function between(code) {
15276
+ if (code === null) return nok(code);
15277
+ if (code === DOLLAR2) {
16075
15278
  if (sizeOpen === 1 && afterSpace) {
16076
15279
  afterSpace = false;
16077
15280
  effects.enter("mathTextData");
16078
- effects.consume(code2);
15281
+ effects.consume(code);
16079
15282
  return data;
16080
15283
  }
16081
15284
  token = effects.enter("mathTextSequence");
16082
15285
  sizeClose = 0;
16083
- return sequenceClose(code2);
15286
+ return sequenceClose(code);
16084
15287
  }
16085
- if (code2 === codes.space) {
15288
+ if (code === codes.space) {
16086
15289
  effects.enter("space");
16087
- effects.consume(code2);
15290
+ effects.consume(code);
16088
15291
  effects.exit("space");
16089
15292
  afterSpace = true;
16090
15293
  return between;
16091
15294
  }
16092
- if (isLineEnding4(code2)) {
15295
+ if (isLineEnding4(code)) {
16093
15296
  effects.enter(types.lineEnding);
16094
- effects.consume(code2);
15297
+ effects.consume(code);
16095
15298
  effects.exit(types.lineEnding);
16096
15299
  return between;
16097
15300
  }
16098
15301
  afterSpace = false;
16099
15302
  effects.enter("mathTextData");
16100
- return data(code2);
15303
+ return data(code);
16101
15304
  }
16102
- function data(code2) {
16103
- if (code2 === BACKSLASH3) {
16104
- effects.consume(code2);
15305
+ function data(code) {
15306
+ if (code === BACKSLASH3) {
15307
+ effects.consume(code);
16105
15308
  return dataEscaped;
16106
15309
  }
16107
- if (code2 === null || code2 === codes.space || code2 === DOLLAR2 || isLineEnding4(code2)) {
15310
+ if (code === null || code === codes.space || code === DOLLAR2 || isLineEnding4(code)) {
16108
15311
  effects.exit("mathTextData");
16109
- return between(code2);
15312
+ return between(code);
16110
15313
  }
16111
- effects.consume(code2);
15314
+ effects.consume(code);
16112
15315
  return data;
16113
15316
  }
16114
- function dataEscaped(code2) {
16115
- if (code2 === null || isLineEnding4(code2)) {
15317
+ function dataEscaped(code) {
15318
+ if (code === null || isLineEnding4(code)) {
16116
15319
  effects.exit("mathTextData");
16117
- return between(code2);
15320
+ return between(code);
16118
15321
  }
16119
- effects.consume(code2);
15322
+ effects.consume(code);
16120
15323
  return data;
16121
15324
  }
16122
- function sequenceClose(code2) {
16123
- if (code2 === DOLLAR2 && sizeClose < sizeOpen) {
16124
- effects.consume(code2);
15325
+ function sequenceClose(code) {
15326
+ if (code === DOLLAR2 && sizeClose < sizeOpen) {
15327
+ effects.consume(code);
16125
15328
  sizeClose++;
16126
15329
  return sequenceClose;
16127
15330
  }
16128
15331
  if (sizeClose === sizeOpen) {
16129
15332
  effects.exit("mathTextSequence");
16130
15333
  effects.exit("mathText");
16131
- return ok3(code2);
15334
+ return ok3(code);
16132
15335
  }
16133
15336
  token.type = "mathTextData";
16134
- return data(code2);
15337
+ return data(code);
16135
15338
  }
16136
15339
  }
16137
15340
  function resolveMathText2(events) {
@@ -16176,6 +15379,30 @@ function resolveMathText2(events) {
16176
15379
  function ok2() {
16177
15380
  }
16178
15381
 
15382
+ // node_modules/longest-streak/index.js
15383
+ function longestStreak(value2, substring) {
15384
+ const source = String(value2);
15385
+ let index = source.indexOf(substring);
15386
+ let expected = index;
15387
+ let count = 0;
15388
+ let max = 0;
15389
+ if (typeof substring !== "string") {
15390
+ throw new TypeError("Expected substring");
15391
+ }
15392
+ while (index !== -1) {
15393
+ if (index === expected) {
15394
+ if (++count > max) {
15395
+ max = count;
15396
+ }
15397
+ } else {
15398
+ count = 1;
15399
+ }
15400
+ expected = index + substring.length;
15401
+ index = source.indexOf(substring, expected);
15402
+ }
15403
+ return max;
15404
+ }
15405
+
16179
15406
  // node_modules/mdast-util-math/lib/index.js
16180
15407
  function mathFromMarkdown() {
16181
15408
  return {
@@ -16194,7 +15421,7 @@ function mathFromMarkdown() {
16194
15421
  }
16195
15422
  };
16196
15423
  function enterMathFlow(token) {
16197
- const code2 = {
15424
+ const code = {
16198
15425
  type: "element",
16199
15426
  tagName: "code",
16200
15427
  properties: { className: ["language-math", "math-display"] },
@@ -16205,7 +15432,7 @@ function mathFromMarkdown() {
16205
15432
  type: "math",
16206
15433
  meta: null,
16207
15434
  value: "",
16208
- data: { hName: "pre", hChildren: [code2] }
15435
+ data: { hName: "pre", hChildren: [code] }
16209
15436
  },
16210
15437
  token
16211
15438
  );
@@ -16230,13 +15457,13 @@ function mathFromMarkdown() {
16230
15457
  ok2(node2.type === "math");
16231
15458
  this.exit(token);
16232
15459
  node2.value = data;
16233
- const code2 = (
15460
+ const code = (
16234
15461
  /** @type {HastElement} */
16235
15462
  node2.data.hChildren[0]
16236
15463
  );
16237
- ok2(code2.type === "element");
16238
- ok2(code2.tagName === "code");
16239
- code2.children.push({ type: "text", value: data });
15464
+ ok2(code.type === "element");
15465
+ ok2(code.tagName === "code");
15466
+ code.children.push({ type: "text", value: data });
16240
15467
  this.data.mathFlowInside = void 0;
16241
15468
  }
16242
15469
  function enterMathText(token) {
@@ -16418,13 +15645,13 @@ function frontmatter2(options) {
16418
15645
  let index = -1;
16419
15646
  while (++index < matters.length) {
16420
15647
  const matter2 = matters[index];
16421
- const code2 = fence2(matter2, "open").charCodeAt(0);
15648
+ const code = fence2(matter2, "open").charCodeAt(0);
16422
15649
  const construct = createConstruct(matter2);
16423
- const existing = flow[code2];
15650
+ const existing = flow[code];
16424
15651
  if (Array.isArray(existing)) {
16425
15652
  existing.push(construct);
16426
15653
  } else {
16427
- flow[code2] = [construct];
15654
+ flow[code] = [construct];
16428
15655
  }
16429
15656
  }
16430
15657
  return {
@@ -16462,7 +15689,7 @@ function createConstruct(matter2) {
16462
15689
  function tokenizeFrontmatter(effects, ok3, nok) {
16463
15690
  const self = this;
16464
15691
  return start;
16465
- function start(code2) {
15692
+ function start(code) {
16466
15693
  const position = self.now();
16467
15694
  if (
16468
15695
  // Indent not allowed.
@@ -16471,119 +15698,119 @@ function createConstruct(matter2) {
16471
15698
  ) {
16472
15699
  buffer = fence2(matter2, "open");
16473
15700
  bufferIndex = 0;
16474
- if (code2 === buffer.charCodeAt(bufferIndex)) {
15701
+ if (code === buffer.charCodeAt(bufferIndex)) {
16475
15702
  effects.enter(frontmatterType);
16476
15703
  effects.enter(fenceType);
16477
15704
  effects.enter(sequenceType);
16478
- return openSequence(code2);
15705
+ return openSequence(code);
16479
15706
  }
16480
15707
  }
16481
- return nok(code2);
15708
+ return nok(code);
16482
15709
  }
16483
- function openSequence(code2) {
15710
+ function openSequence(code) {
16484
15711
  if (bufferIndex === buffer.length) {
16485
15712
  effects.exit(sequenceType);
16486
- if (markdownSpace(code2)) {
15713
+ if (markdownSpace(code)) {
16487
15714
  effects.enter("whitespace");
16488
- return openSequenceWhitespace(code2);
15715
+ return openSequenceWhitespace(code);
16489
15716
  }
16490
- return openAfter(code2);
15717
+ return openAfter(code);
16491
15718
  }
16492
- if (code2 === buffer.charCodeAt(bufferIndex++)) {
16493
- effects.consume(code2);
15719
+ if (code === buffer.charCodeAt(bufferIndex++)) {
15720
+ effects.consume(code);
16494
15721
  return openSequence;
16495
15722
  }
16496
- return nok(code2);
15723
+ return nok(code);
16497
15724
  }
16498
- function openSequenceWhitespace(code2) {
16499
- if (markdownSpace(code2)) {
16500
- effects.consume(code2);
15725
+ function openSequenceWhitespace(code) {
15726
+ if (markdownSpace(code)) {
15727
+ effects.consume(code);
16501
15728
  return openSequenceWhitespace;
16502
15729
  }
16503
15730
  effects.exit("whitespace");
16504
- return openAfter(code2);
15731
+ return openAfter(code);
16505
15732
  }
16506
- function openAfter(code2) {
16507
- if (markdownLineEnding(code2)) {
15733
+ function openAfter(code) {
15734
+ if (markdownLineEnding(code)) {
16508
15735
  effects.exit(fenceType);
16509
15736
  effects.enter("lineEnding");
16510
- effects.consume(code2);
15737
+ effects.consume(code);
16511
15738
  effects.exit("lineEnding");
16512
15739
  buffer = fence2(matter2, "close");
16513
15740
  bufferIndex = 0;
16514
15741
  return effects.attempt(closingFenceConstruct, after, contentStart);
16515
15742
  }
16516
- return nok(code2);
15743
+ return nok(code);
16517
15744
  }
16518
- function contentStart(code2) {
16519
- if (code2 === null || markdownLineEnding(code2)) {
16520
- return contentEnd(code2);
15745
+ function contentStart(code) {
15746
+ if (code === null || markdownLineEnding(code)) {
15747
+ return contentEnd(code);
16521
15748
  }
16522
15749
  effects.enter(valueType);
16523
- return contentInside(code2);
15750
+ return contentInside(code);
16524
15751
  }
16525
- function contentInside(code2) {
16526
- if (code2 === null || markdownLineEnding(code2)) {
15752
+ function contentInside(code) {
15753
+ if (code === null || markdownLineEnding(code)) {
16527
15754
  effects.exit(valueType);
16528
- return contentEnd(code2);
15755
+ return contentEnd(code);
16529
15756
  }
16530
- effects.consume(code2);
15757
+ effects.consume(code);
16531
15758
  return contentInside;
16532
15759
  }
16533
- function contentEnd(code2) {
16534
- if (code2 === null) {
16535
- return nok(code2);
15760
+ function contentEnd(code) {
15761
+ if (code === null) {
15762
+ return nok(code);
16536
15763
  }
16537
15764
  effects.enter("lineEnding");
16538
- effects.consume(code2);
15765
+ effects.consume(code);
16539
15766
  effects.exit("lineEnding");
16540
15767
  return effects.attempt(closingFenceConstruct, after, contentStart);
16541
15768
  }
16542
- function after(code2) {
15769
+ function after(code) {
16543
15770
  effects.exit(frontmatterType);
16544
- return ok3(code2);
15771
+ return ok3(code);
16545
15772
  }
16546
15773
  }
16547
15774
  function tokenizeClosingFence(effects, ok3, nok) {
16548
15775
  let bufferIndex2 = 0;
16549
15776
  return closeStart;
16550
- function closeStart(code2) {
16551
- if (code2 === buffer.charCodeAt(bufferIndex2)) {
15777
+ function closeStart(code) {
15778
+ if (code === buffer.charCodeAt(bufferIndex2)) {
16552
15779
  effects.enter(fenceType);
16553
15780
  effects.enter(sequenceType);
16554
- return closeSequence(code2);
15781
+ return closeSequence(code);
16555
15782
  }
16556
- return nok(code2);
15783
+ return nok(code);
16557
15784
  }
16558
- function closeSequence(code2) {
15785
+ function closeSequence(code) {
16559
15786
  if (bufferIndex2 === buffer.length) {
16560
15787
  effects.exit(sequenceType);
16561
- if (markdownSpace(code2)) {
15788
+ if (markdownSpace(code)) {
16562
15789
  effects.enter("whitespace");
16563
- return closeSequenceWhitespace(code2);
15790
+ return closeSequenceWhitespace(code);
16564
15791
  }
16565
- return closeAfter(code2);
15792
+ return closeAfter(code);
16566
15793
  }
16567
- if (code2 === buffer.charCodeAt(bufferIndex2++)) {
16568
- effects.consume(code2);
15794
+ if (code === buffer.charCodeAt(bufferIndex2++)) {
15795
+ effects.consume(code);
16569
15796
  return closeSequence;
16570
15797
  }
16571
- return nok(code2);
15798
+ return nok(code);
16572
15799
  }
16573
- function closeSequenceWhitespace(code2) {
16574
- if (markdownSpace(code2)) {
16575
- effects.consume(code2);
15800
+ function closeSequenceWhitespace(code) {
15801
+ if (markdownSpace(code)) {
15802
+ effects.consume(code);
16576
15803
  return closeSequenceWhitespace;
16577
15804
  }
16578
15805
  effects.exit("whitespace");
16579
- return closeAfter(code2);
15806
+ return closeAfter(code);
16580
15807
  }
16581
- function closeAfter(code2) {
16582
- if (code2 === null || markdownLineEnding(code2)) {
15808
+ function closeAfter(code) {
15809
+ if (code === null || markdownLineEnding(code)) {
16583
15810
  effects.exit(fenceType);
16584
- return ok3(code2);
15811
+ return ok3(code);
16585
15812
  }
16586
- return nok(code2);
15813
+ return nok(code);
16587
15814
  }
16588
15815
  }
16589
15816
  }
@@ -16657,8 +15884,8 @@ function frontmatterToMarkdown(options) {
16657
15884
  function handler(matter2) {
16658
15885
  const open = fence3(matter2, "open");
16659
15886
  const close2 = fence3(matter2, "close");
16660
- return handle2;
16661
- function handle2(node2) {
15887
+ return handle;
15888
+ function handle(node2) {
16662
15889
  return open + (node2.value ? "\n" + node2.value : "") + "\n" + close2;
16663
15890
  }
16664
15891
  }
@@ -16799,12 +16026,12 @@ function foldAngleAutolinks(tree, earlier) {
16799
16026
  const kids = node2.children;
16800
16027
  if (!Array.isArray(kids)) return;
16801
16028
  for (let index = 1; index < kids.length - 1; index++) {
16802
- const link4 = kids[index];
16029
+ const link3 = kids[index];
16803
16030
  const before2 = kids[index - 1];
16804
16031
  const after = kids[index + 1];
16805
- if (link4?.type !== "link" || // Only a link the re-run made: GFM's own, from the parse, keeps its brackets as text
16032
+ if (link3?.type !== "link" || // Only a link the re-run made: GFM's own, from the parse, keeps its brackets as text
16806
16033
  // where stock does (`<foo\+@bar.example.com>`, spec `autolinks/606`).
16807
- earlier.has(link4) || before2?.type !== "text" || after?.type !== "text" || !before2.value.endsWith("<") || !after.value.startsWith(">") || link4.position !== void 0) {
16034
+ earlier.has(link3) || before2?.type !== "text" || after?.type !== "text" || !before2.value.endsWith("<") || !after.value.startsWith(">") || link3.position !== void 0) {
16808
16035
  continue;
16809
16036
  }
16810
16037
  before2.value = before2.value.slice(0, -1);
@@ -16879,6 +16106,7 @@ function remarkObsidian(userOpts) {
16879
16106
  data.toMarkdownExtensions.push(
16880
16107
  attentionToMarkdown({ legacy: preset === "legacy" })
16881
16108
  );
16109
+ data.toMarkdownExtensions.push(emptyDeleteToMarkdown());
16882
16110
  data.toMarkdownExtensions.push({
16883
16111
  unsafe: [{ character: "<", after: "<", inConstruct: "phrasing" }]
16884
16112
  });
@@ -16950,7 +16178,7 @@ function remarkObsidian(userOpts) {
16950
16178
  obsidianReadingTransform(
16951
16179
  fragment,
16952
16180
  markdown,
16953
- (text4) => self.parse(text4),
16181
+ (text3) => self.parse(text3),
16954
16182
  reading
16955
16183
  );
16956
16184
  return fragment;