@readme/markdown 14.14.2 → 15.0.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/main.node.js CHANGED
@@ -275,7 +275,7 @@ function visit(tree, test, visitor, reverse) {
275
275
 
276
276
  /***/ }),
277
277
 
278
- /***/ 9762:
278
+ /***/ 7644:
279
279
  /***/ ((__unused_webpack_module, exports) => {
280
280
 
281
281
  "use strict";
@@ -349,7 +349,7 @@ exports["default"] = canonical;
349
349
 
350
350
  /***/ }),
351
351
 
352
- /***/ 7900:
352
+ /***/ 4350:
353
353
  /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
354
354
 
355
355
  "use strict";
@@ -358,15 +358,15 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
358
358
  return (mod && mod.__esModule) ? mod : { "default": mod };
359
359
  };
360
360
  Object.defineProperty(exports, "__esModule", ({ value: true }));
361
- const canonical_1 = __importDefault(__webpack_require__(9762));
362
- const modes_1 = __webpack_require__(1412);
363
- const uppercase_1 = __importDefault(__webpack_require__(8892));
361
+ const canonical_1 = __importDefault(__webpack_require__(7644));
362
+ const modes_1 = __webpack_require__(1130);
363
+ const uppercase_1 = __importDefault(__webpack_require__(3622));
364
364
  exports["default"] = { uppercase: uppercase_1.default, canonical: canonical_1.default, modes: modes_1.modes, getMode: modes_1.getMode };
365
365
 
366
366
 
367
367
  /***/ }),
368
368
 
369
- /***/ 1412:
369
+ /***/ 1130:
370
370
  /***/ ((__unused_webpack_module, exports) => {
371
371
 
372
372
  "use strict";
@@ -425,6 +425,7 @@ exports.modes = {
425
425
  node: 'javascript',
426
426
  macruby: 'ruby',
427
427
  markdown: 'gfm',
428
+ md: 'gfm',
428
429
  ml: ['mllike', 'text/x-ocaml'],
429
430
  mssql: ['sql', 'text/x-mssql'],
430
431
  mysql: ['sql', 'text/x-mysql'],
@@ -479,7 +480,7 @@ function getMode(lang) {
479
480
 
480
481
  /***/ }),
481
482
 
482
- /***/ 8892:
483
+ /***/ 3622:
483
484
  /***/ ((__unused_webpack_module, exports) => {
484
485
 
485
486
  "use strict";
@@ -19303,7 +19304,7 @@ __webpack_require__.d(__webpack_exports__, {
19303
19304
  stripComments: () => (/* reexport */ lib_stripComments),
19304
19305
  tags: () => (/* reexport */ lib_tags),
19305
19306
  tailwindCompiler: () => (/* reexport */ tailwindCompiler),
19306
- utils: () => (/* binding */ utils)
19307
+ utils: () => (/* binding */ index_utils)
19307
19308
  });
19308
19309
 
19309
19310
  // NAMESPACE OBJECT: ./components/index.ts
@@ -19625,16 +19626,16 @@ const Code = (props) => {
19625
19626
  };
19626
19627
  /* harmony default export */ const components_Code = (Code);
19627
19628
 
19628
- // EXTERNAL MODULE: ./node_modules/@readme/syntax-highlighter/dist-utils/index.js
19629
- var dist_utils = __webpack_require__(7900);
19630
- var dist_utils_default = /*#__PURE__*/__webpack_require__.n(dist_utils);
19629
+ // EXTERNAL MODULE: ./node_modules/@readme/syntax-highlighter/dist-utils/utils/index.js
19630
+ var utils = __webpack_require__(4350);
19631
+ var utils_default = /*#__PURE__*/__webpack_require__.n(utils);
19631
19632
  ;// ./components/CodeTabs/index.tsx
19632
19633
 
19633
19634
 
19634
19635
 
19635
19636
 
19636
19637
  let mermaid;
19637
- const { uppercase } = (dist_utils_default());
19638
+ const { uppercase } = (utils_default());
19638
19639
  // Module-level queue that batches mermaid nodes across all CodeTabs instances into a
19639
19640
  // single mermaid.run() call. This is necessary because mermaid generates SVG element IDs
19640
19641
  // using Date.now(), which collides when multiple diagrams render in the same millisecond.
@@ -27249,72 +27250,319 @@ function push(list, items) {
27249
27250
  return items
27250
27251
  }
27251
27252
 
27253
+ ;// ./node_modules/micromark-util-subtokenize/lib/splice-buffer.js
27254
+ /**
27255
+ * Some of the internal operations of micromark do lots of editing
27256
+ * operations on very large arrays. This runs into problems with two
27257
+ * properties of most circa-2020 JavaScript interpreters:
27258
+ *
27259
+ * - Array-length modifications at the high end of an array (push/pop) are
27260
+ * expected to be common and are implemented in (amortized) time
27261
+ * proportional to the number of elements added or removed, whereas
27262
+ * other operations (shift/unshift and splice) are much less efficient.
27263
+ * - Function arguments are passed on the stack, so adding tens of thousands
27264
+ * of elements to an array with `arr.push(...newElements)` will frequently
27265
+ * cause stack overflows. (see <https://stackoverflow.com/questions/22123769/rangeerror-maximum-call-stack-size-exceeded-why>)
27266
+ *
27267
+ * SpliceBuffers are an implementation of gap buffers, which are a
27268
+ * generalization of the "queue made of two stacks" idea. The splice buffer
27269
+ * maintains a cursor, and moving the cursor has cost proportional to the
27270
+ * distance the cursor moves, but inserting, deleting, or splicing in
27271
+ * new information at the cursor is as efficient as the push/pop operation.
27272
+ * This allows for an efficient sequence of splices (or pushes, pops, shifts,
27273
+ * or unshifts) as long such edits happen at the same part of the array or
27274
+ * generally sweep through the array from the beginning to the end.
27275
+ *
27276
+ * The interface for splice buffers also supports large numbers of inputs by
27277
+ * passing a single array argument rather passing multiple arguments on the
27278
+ * function call stack.
27279
+ *
27280
+ * @template T
27281
+ * Item type.
27282
+ */
27283
+ class SpliceBuffer {
27284
+ /**
27285
+ * @param {ReadonlyArray<T> | null | undefined} [initial]
27286
+ * Initial items (optional).
27287
+ * @returns
27288
+ * Splice buffer.
27289
+ */
27290
+ constructor(initial) {
27291
+ /** @type {Array<T>} */
27292
+ this.left = initial ? [...initial] : [];
27293
+ /** @type {Array<T>} */
27294
+ this.right = [];
27295
+ }
27296
+
27297
+ /**
27298
+ * Array access;
27299
+ * does not move the cursor.
27300
+ *
27301
+ * @param {number} index
27302
+ * Index.
27303
+ * @return {T}
27304
+ * Item.
27305
+ */
27306
+ get(index) {
27307
+ if (index < 0 || index >= this.left.length + this.right.length) {
27308
+ throw new RangeError('Cannot access index `' + index + '` in a splice buffer of size `' + (this.left.length + this.right.length) + '`');
27309
+ }
27310
+ if (index < this.left.length) return this.left[index];
27311
+ return this.right[this.right.length - index + this.left.length - 1];
27312
+ }
27313
+
27314
+ /**
27315
+ * The length of the splice buffer, one greater than the largest index in the
27316
+ * array.
27317
+ */
27318
+ get length() {
27319
+ return this.left.length + this.right.length;
27320
+ }
27321
+
27322
+ /**
27323
+ * Remove and return `list[0]`;
27324
+ * moves the cursor to `0`.
27325
+ *
27326
+ * @returns {T | undefined}
27327
+ * Item, optional.
27328
+ */
27329
+ shift() {
27330
+ this.setCursor(0);
27331
+ return this.right.pop();
27332
+ }
27333
+
27334
+ /**
27335
+ * Slice the buffer to get an array;
27336
+ * does not move the cursor.
27337
+ *
27338
+ * @param {number} start
27339
+ * Start.
27340
+ * @param {number | null | undefined} [end]
27341
+ * End (optional).
27342
+ * @returns {Array<T>}
27343
+ * Array of items.
27344
+ */
27345
+ slice(start, end) {
27346
+ /** @type {number} */
27347
+ const stop = end === null || end === undefined ? Number.POSITIVE_INFINITY : end;
27348
+ if (stop < this.left.length) {
27349
+ return this.left.slice(start, stop);
27350
+ }
27351
+ if (start > this.left.length) {
27352
+ return this.right.slice(this.right.length - stop + this.left.length, this.right.length - start + this.left.length).reverse();
27353
+ }
27354
+ return this.left.slice(start).concat(this.right.slice(this.right.length - stop + this.left.length).reverse());
27355
+ }
27356
+
27357
+ /**
27358
+ * Mimics the behavior of Array.prototype.splice() except for the change of
27359
+ * interface necessary to avoid segfaults when patching in very large arrays.
27360
+ *
27361
+ * This operation moves cursor is moved to `start` and results in the cursor
27362
+ * placed after any inserted items.
27363
+ *
27364
+ * @param {number} start
27365
+ * Start;
27366
+ * zero-based index at which to start changing the array;
27367
+ * negative numbers count backwards from the end of the array and values
27368
+ * that are out-of bounds are clamped to the appropriate end of the array.
27369
+ * @param {number | null | undefined} [deleteCount=0]
27370
+ * Delete count (default: `0`);
27371
+ * maximum number of elements to delete, starting from start.
27372
+ * @param {Array<T> | null | undefined} [items=[]]
27373
+ * Items to include in place of the deleted items (default: `[]`).
27374
+ * @return {Array<T>}
27375
+ * Any removed items.
27376
+ */
27377
+ splice(start, deleteCount, items) {
27378
+ /** @type {number} */
27379
+ const count = deleteCount || 0;
27380
+ this.setCursor(Math.trunc(start));
27381
+ const removed = this.right.splice(this.right.length - count, Number.POSITIVE_INFINITY);
27382
+ if (items) chunkedPush(this.left, items);
27383
+ return removed.reverse();
27384
+ }
27385
+
27386
+ /**
27387
+ * Remove and return the highest-numbered item in the array, so
27388
+ * `list[list.length - 1]`;
27389
+ * Moves the cursor to `length`.
27390
+ *
27391
+ * @returns {T | undefined}
27392
+ * Item, optional.
27393
+ */
27394
+ pop() {
27395
+ this.setCursor(Number.POSITIVE_INFINITY);
27396
+ return this.left.pop();
27397
+ }
27398
+
27399
+ /**
27400
+ * Inserts a single item to the high-numbered side of the array;
27401
+ * moves the cursor to `length`.
27402
+ *
27403
+ * @param {T} item
27404
+ * Item.
27405
+ * @returns {undefined}
27406
+ * Nothing.
27407
+ */
27408
+ push(item) {
27409
+ this.setCursor(Number.POSITIVE_INFINITY);
27410
+ this.left.push(item);
27411
+ }
27412
+
27413
+ /**
27414
+ * Inserts many items to the high-numbered side of the array.
27415
+ * Moves the cursor to `length`.
27416
+ *
27417
+ * @param {Array<T>} items
27418
+ * Items.
27419
+ * @returns {undefined}
27420
+ * Nothing.
27421
+ */
27422
+ pushMany(items) {
27423
+ this.setCursor(Number.POSITIVE_INFINITY);
27424
+ chunkedPush(this.left, items);
27425
+ }
27426
+
27427
+ /**
27428
+ * Inserts a single item to the low-numbered side of the array;
27429
+ * Moves the cursor to `0`.
27430
+ *
27431
+ * @param {T} item
27432
+ * Item.
27433
+ * @returns {undefined}
27434
+ * Nothing.
27435
+ */
27436
+ unshift(item) {
27437
+ this.setCursor(0);
27438
+ this.right.push(item);
27439
+ }
27440
+
27441
+ /**
27442
+ * Inserts many items to the low-numbered side of the array;
27443
+ * moves the cursor to `0`.
27444
+ *
27445
+ * @param {Array<T>} items
27446
+ * Items.
27447
+ * @returns {undefined}
27448
+ * Nothing.
27449
+ */
27450
+ unshiftMany(items) {
27451
+ this.setCursor(0);
27452
+ chunkedPush(this.right, items.reverse());
27453
+ }
27454
+
27455
+ /**
27456
+ * Move the cursor to a specific position in the array. Requires
27457
+ * time proportional to the distance moved.
27458
+ *
27459
+ * If `n < 0`, the cursor will end up at the beginning.
27460
+ * If `n > length`, the cursor will end up at the end.
27461
+ *
27462
+ * @param {number} n
27463
+ * Position.
27464
+ * @return {undefined}
27465
+ * Nothing.
27466
+ */
27467
+ setCursor(n) {
27468
+ if (n === this.left.length || n > this.left.length && this.right.length === 0 || n < 0 && this.left.length === 0) return;
27469
+ if (n < this.left.length) {
27470
+ // Move cursor to the this.left
27471
+ const removed = this.left.splice(n, Number.POSITIVE_INFINITY);
27472
+ chunkedPush(this.right, removed.reverse());
27473
+ } else {
27474
+ // Move cursor to the this.right
27475
+ const removed = this.right.splice(this.left.length + this.right.length - n, Number.POSITIVE_INFINITY);
27476
+ chunkedPush(this.left, removed.reverse());
27477
+ }
27478
+ }
27479
+ }
27480
+
27481
+ /**
27482
+ * Avoid stack overflow by pushing items onto the stack in segments
27483
+ *
27484
+ * @template T
27485
+ * Item type.
27486
+ * @param {Array<T>} list
27487
+ * List to inject into.
27488
+ * @param {ReadonlyArray<T>} right
27489
+ * Items to inject.
27490
+ * @return {undefined}
27491
+ * Nothing.
27492
+ */
27493
+ function chunkedPush(list, right) {
27494
+ /** @type {number} */
27495
+ let chunkStart = 0;
27496
+ if (right.length < 10000) {
27497
+ list.push(...right);
27498
+ } else {
27499
+ while (chunkStart < right.length) {
27500
+ list.push(...right.slice(chunkStart, chunkStart + 10000));
27501
+ chunkStart += 10000;
27502
+ }
27503
+ }
27504
+ }
27252
27505
  ;// ./node_modules/micromark-util-subtokenize/index.js
27253
27506
  /**
27254
- * @typedef {import('micromark-util-types').Chunk} Chunk
27255
- * @typedef {import('micromark-util-types').Event} Event
27256
- * @typedef {import('micromark-util-types').Token} Token
27507
+ * @import {Chunk, Event, Token} from 'micromark-util-types'
27257
27508
  */
27258
27509
 
27259
27510
 
27511
+
27512
+
27513
+ // Hidden API exposed for testing.
27514
+
27515
+
27260
27516
  /**
27261
27517
  * Tokenize subcontent.
27262
27518
  *
27263
- * @param {Array<Event>} events
27519
+ * @param {Array<Event>} eventsArray
27264
27520
  * List of events.
27265
27521
  * @returns {boolean}
27266
27522
  * Whether subtokens were found.
27267
- */ // eslint-disable-next-line complexity
27268
- function subtokenize(events) {
27523
+ */
27524
+ // eslint-disable-next-line complexity
27525
+ function subtokenize(eventsArray) {
27269
27526
  /** @type {Record<string, number>} */
27270
- const jumps = {}
27271
- let index = -1
27527
+ const jumps = {};
27528
+ let index = -1;
27272
27529
  /** @type {Event} */
27273
- let event
27530
+ let event;
27274
27531
  /** @type {number | undefined} */
27275
- let lineIndex
27532
+ let lineIndex;
27276
27533
  /** @type {number} */
27277
- let otherIndex
27534
+ let otherIndex;
27278
27535
  /** @type {Event} */
27279
- let otherEvent
27536
+ let otherEvent;
27280
27537
  /** @type {Array<Event>} */
27281
- let parameters
27538
+ let parameters;
27282
27539
  /** @type {Array<Event>} */
27283
- let subevents
27540
+ let subevents;
27284
27541
  /** @type {boolean | undefined} */
27285
- let more
27542
+ let more;
27543
+ const events = new SpliceBuffer(eventsArray);
27286
27544
  while (++index < events.length) {
27287
27545
  while (index in jumps) {
27288
- index = jumps[index]
27546
+ index = jumps[index];
27289
27547
  }
27290
- event = events[index]
27548
+ event = events.get(index);
27291
27549
 
27292
27550
  // Add a hook for the GFM tasklist extension, which needs to know if text
27293
27551
  // is in the first content of a list item.
27294
- if (
27295
- index &&
27296
- event[1].type === 'chunkFlow' &&
27297
- events[index - 1][1].type === 'listItemPrefix'
27298
- ) {
27299
- subevents = event[1]._tokenizer.events
27300
- otherIndex = 0
27301
- if (
27302
- otherIndex < subevents.length &&
27303
- subevents[otherIndex][1].type === 'lineEndingBlank'
27304
- ) {
27305
- otherIndex += 2
27552
+ if (index && event[1].type === "chunkFlow" && events.get(index - 1)[1].type === "listItemPrefix") {
27553
+ subevents = event[1]._tokenizer.events;
27554
+ otherIndex = 0;
27555
+ if (otherIndex < subevents.length && subevents[otherIndex][1].type === "lineEndingBlank") {
27556
+ otherIndex += 2;
27306
27557
  }
27307
- if (
27308
- otherIndex < subevents.length &&
27309
- subevents[otherIndex][1].type === 'content'
27310
- ) {
27558
+ if (otherIndex < subevents.length && subevents[otherIndex][1].type === "content") {
27311
27559
  while (++otherIndex < subevents.length) {
27312
- if (subevents[otherIndex][1].type === 'content') {
27313
- break
27560
+ if (subevents[otherIndex][1].type === "content") {
27561
+ break;
27314
27562
  }
27315
- if (subevents[otherIndex][1].type === 'chunkText') {
27316
- subevents[otherIndex][1]._isInFirstContentOfListItem = true
27317
- otherIndex++
27563
+ if (subevents[otherIndex][1].type === "chunkText") {
27564
+ subevents[otherIndex][1]._isInFirstContentOfListItem = true;
27565
+ otherIndex++;
27318
27566
  }
27319
27567
  }
27320
27568
  }
@@ -27323,158 +27571,160 @@ function subtokenize(events) {
27323
27571
  // Enter.
27324
27572
  if (event[0] === 'enter') {
27325
27573
  if (event[1].contentType) {
27326
- Object.assign(jumps, subcontent(events, index))
27327
- index = jumps[index]
27328
- more = true
27574
+ Object.assign(jumps, subcontent(events, index));
27575
+ index = jumps[index];
27576
+ more = true;
27329
27577
  }
27330
27578
  }
27331
27579
  // Exit.
27332
27580
  else if (event[1]._container) {
27333
- otherIndex = index
27334
- lineIndex = undefined
27581
+ otherIndex = index;
27582
+ lineIndex = undefined;
27335
27583
  while (otherIndex--) {
27336
- otherEvent = events[otherIndex]
27337
- if (
27338
- otherEvent[1].type === 'lineEnding' ||
27339
- otherEvent[1].type === 'lineEndingBlank'
27340
- ) {
27584
+ otherEvent = events.get(otherIndex);
27585
+ if (otherEvent[1].type === "lineEnding" || otherEvent[1].type === "lineEndingBlank") {
27341
27586
  if (otherEvent[0] === 'enter') {
27342
27587
  if (lineIndex) {
27343
- events[lineIndex][1].type = 'lineEndingBlank'
27588
+ events.get(lineIndex)[1].type = "lineEndingBlank";
27344
27589
  }
27345
- otherEvent[1].type = 'lineEnding'
27346
- lineIndex = otherIndex
27590
+ otherEvent[1].type = "lineEnding";
27591
+ lineIndex = otherIndex;
27347
27592
  }
27593
+ } else if (otherEvent[1].type === "linePrefix") {
27594
+ // Move past.
27348
27595
  } else {
27349
- break
27596
+ break;
27350
27597
  }
27351
27598
  }
27352
27599
  if (lineIndex) {
27353
27600
  // Fix position.
27354
- event[1].end = Object.assign({}, events[lineIndex][1].start)
27601
+ event[1].end = {
27602
+ ...events.get(lineIndex)[1].start
27603
+ };
27355
27604
 
27356
27605
  // Switch container exit w/ line endings.
27357
- parameters = events.slice(lineIndex, index)
27358
- parameters.unshift(event)
27359
- splice(events, lineIndex, index - lineIndex + 1, parameters)
27606
+ parameters = events.slice(lineIndex, index);
27607
+ parameters.unshift(event);
27608
+ events.splice(lineIndex, index - lineIndex + 1, parameters);
27360
27609
  }
27361
27610
  }
27362
27611
  }
27363
- return !more
27612
+
27613
+ // The changes to the `events` buffer must be copied back into the eventsArray
27614
+ splice(eventsArray, 0, Number.POSITIVE_INFINITY, events.slice(0));
27615
+ return !more;
27364
27616
  }
27365
27617
 
27366
27618
  /**
27367
27619
  * Tokenize embedded tokens.
27368
27620
  *
27369
- * @param {Array<Event>} events
27621
+ * @param {SpliceBuffer<Event>} events
27622
+ * Events.
27370
27623
  * @param {number} eventIndex
27624
+ * Index.
27371
27625
  * @returns {Record<string, number>}
27626
+ * Gaps.
27372
27627
  */
27373
27628
  function subcontent(events, eventIndex) {
27374
- const token = events[eventIndex][1]
27375
- const context = events[eventIndex][2]
27376
- let startPosition = eventIndex - 1
27629
+ const token = events.get(eventIndex)[1];
27630
+ const context = events.get(eventIndex)[2];
27631
+ let startPosition = eventIndex - 1;
27377
27632
  /** @type {Array<number>} */
27378
- const startPositions = []
27379
- const tokenizer =
27380
- token._tokenizer || context.parser[token.contentType](token.start)
27381
- const childEvents = tokenizer.events
27633
+ const startPositions = [];
27634
+ const tokenizer = token._tokenizer || context.parser[token.contentType](token.start);
27635
+ const childEvents = tokenizer.events;
27382
27636
  /** @type {Array<[number, number]>} */
27383
- const jumps = []
27637
+ const jumps = [];
27384
27638
  /** @type {Record<string, number>} */
27385
- const gaps = {}
27639
+ const gaps = {};
27386
27640
  /** @type {Array<Chunk>} */
27387
- let stream
27641
+ let stream;
27388
27642
  /** @type {Token | undefined} */
27389
- let previous
27390
- let index = -1
27643
+ let previous;
27644
+ let index = -1;
27391
27645
  /** @type {Token | undefined} */
27392
- let current = token
27393
- let adjust = 0
27394
- let start = 0
27395
- const breaks = [start]
27646
+ let current = token;
27647
+ let adjust = 0;
27648
+ let start = 0;
27649
+ const breaks = [start];
27396
27650
 
27397
27651
  // Loop forward through the linked tokens to pass them in order to the
27398
27652
  // subtokenizer.
27399
27653
  while (current) {
27400
27654
  // Find the position of the event for this token.
27401
- while (events[++startPosition][1] !== current) {
27655
+ while (events.get(++startPosition)[1] !== current) {
27402
27656
  // Empty.
27403
27657
  }
27404
- startPositions.push(startPosition)
27658
+ startPositions.push(startPosition);
27405
27659
  if (!current._tokenizer) {
27406
- stream = context.sliceStream(current)
27660
+ stream = context.sliceStream(current);
27407
27661
  if (!current.next) {
27408
- stream.push(null)
27662
+ stream.push(null);
27409
27663
  }
27410
27664
  if (previous) {
27411
- tokenizer.defineSkip(current.start)
27665
+ tokenizer.defineSkip(current.start);
27412
27666
  }
27413
27667
  if (current._isInFirstContentOfListItem) {
27414
- tokenizer._gfmTasklistFirstContentOfListItem = true
27668
+ tokenizer._gfmTasklistFirstContentOfListItem = true;
27415
27669
  }
27416
- tokenizer.write(stream)
27670
+ tokenizer.write(stream);
27417
27671
  if (current._isInFirstContentOfListItem) {
27418
- tokenizer._gfmTasklistFirstContentOfListItem = undefined
27672
+ tokenizer._gfmTasklistFirstContentOfListItem = undefined;
27419
27673
  }
27420
27674
  }
27421
27675
 
27422
27676
  // Unravel the next token.
27423
- previous = current
27424
- current = current.next
27677
+ previous = current;
27678
+ current = current.next;
27425
27679
  }
27426
27680
 
27427
27681
  // Now, loop back through all events (and linked tokens), to figure out which
27428
27682
  // parts belong where.
27429
- current = token
27683
+ current = token;
27430
27684
  while (++index < childEvents.length) {
27431
27685
  if (
27432
- // Find a void token that includes a break.
27433
- childEvents[index][0] === 'exit' &&
27434
- childEvents[index - 1][0] === 'enter' &&
27435
- childEvents[index][1].type === childEvents[index - 1][1].type &&
27436
- childEvents[index][1].start.line !== childEvents[index][1].end.line
27437
- ) {
27438
- start = index + 1
27439
- breaks.push(start)
27686
+ // Find a void token that includes a break.
27687
+ childEvents[index][0] === 'exit' && childEvents[index - 1][0] === 'enter' && childEvents[index][1].type === childEvents[index - 1][1].type && childEvents[index][1].start.line !== childEvents[index][1].end.line) {
27688
+ start = index + 1;
27689
+ breaks.push(start);
27440
27690
  // Help GC.
27441
- current._tokenizer = undefined
27442
- current.previous = undefined
27443
- current = current.next
27691
+ current._tokenizer = undefined;
27692
+ current.previous = undefined;
27693
+ current = current.next;
27444
27694
  }
27445
27695
  }
27446
27696
 
27447
27697
  // Help GC.
27448
- tokenizer.events = []
27698
+ tokenizer.events = [];
27449
27699
 
27450
27700
  // If there’s one more token (which is the cases for lines that end in an
27451
27701
  // EOF), that’s perfect: the last point we found starts it.
27452
27702
  // If there isn’t then make sure any remaining content is added to it.
27453
27703
  if (current) {
27454
27704
  // Help GC.
27455
- current._tokenizer = undefined
27456
- current.previous = undefined
27705
+ current._tokenizer = undefined;
27706
+ current.previous = undefined;
27457
27707
  } else {
27458
- breaks.pop()
27708
+ breaks.pop();
27459
27709
  }
27460
27710
 
27461
27711
  // Now splice the events from the subtokenizer into the current events,
27462
27712
  // moving back to front so that splice indices aren’t affected.
27463
- index = breaks.length
27713
+ index = breaks.length;
27464
27714
  while (index--) {
27465
- const slice = childEvents.slice(breaks[index], breaks[index + 1])
27466
- const start = startPositions.pop()
27467
- jumps.unshift([start, start + slice.length - 1])
27468
- splice(events, start, 2, slice)
27715
+ const slice = childEvents.slice(breaks[index], breaks[index + 1]);
27716
+ const start = startPositions.pop();
27717
+ jumps.push([start, start + slice.length - 1]);
27718
+ events.splice(start, 2, slice);
27469
27719
  }
27470
- index = -1
27720
+ jumps.reverse();
27721
+ index = -1;
27471
27722
  while (++index < jumps.length) {
27472
- gaps[adjust + jumps[index][0]] = adjust + jumps[index][1]
27473
- adjust += jumps[index][1] - jumps[index][0] - 1
27723
+ gaps[adjust + jumps[index][0]] = adjust + jumps[index][1];
27724
+ adjust += jumps[index][1] - jumps[index][0] - 1;
27474
27725
  }
27475
- return gaps
27726
+ return gaps;
27476
27727
  }
27477
-
27478
27728
  ;// ./node_modules/micromark/lib/postprocess.js
27479
27729
  /**
27480
27730
  * @typedef {import('micromark-util-types').Event} Event
@@ -94657,11 +94907,6 @@ const looseHtmlEntityConstruct = {
94657
94907
  name: 'looseHtmlEntity',
94658
94908
  tokenize: tokenizeLooseHtmlEntity,
94659
94909
  };
94660
- function resolveEntity(name) {
94661
- const input = `&${name};`;
94662
- const decoded = decode_decodeHTMLStrict(input);
94663
- return decoded !== input ? decoded : undefined;
94664
- }
94665
94910
  function tokenizeLooseHtmlEntity(effects, ok, nok) {
94666
94911
  let length = 0;
94667
94912
  const start = (code) => {
@@ -94728,28 +94973,9 @@ function tokenizeLooseHtmlEntity(effects, ok, nok) {
94728
94973
  }
94729
94974
  function exitLooseHtmlEntity(token) {
94730
94975
  const raw = this.sliceSerialize(token);
94731
- const entityChars = raw.slice(1);
94732
- if (entityChars.startsWith('#')) {
94733
- const decoded = resolveEntity(entityChars);
94734
- if (decoded) {
94735
- this.enter({ type: 'text', value: decoded }, token);
94736
- this.exit(token);
94737
- return;
94738
- }
94739
- }
94740
- else {
94741
- for (let len = entityChars.length; len >= 2; len -= 1) {
94742
- const candidate = entityChars.slice(0, len);
94743
- const decoded = resolveEntity(candidate);
94744
- if (decoded) {
94745
- const remainder = entityChars.slice(len);
94746
- this.enter({ type: 'text', value: decoded + remainder }, token);
94747
- this.exit(token);
94748
- return;
94749
- }
94750
- }
94751
- }
94752
- this.enter({ type: 'text', value: raw }, token);
94976
+ // `decodeHTML` follows the HTML spec's legacy rules, where only a small
94977
+ // whitelist of names may omit the semicolon, so `&partner_key` stays intact.
94978
+ this.enter({ type: 'text', value: esm_decode_decodeHTML(raw) }, token);
94753
94979
  this.exit(token);
94754
94980
  }
94755
94981
  function looseHtmlEntity() {
@@ -94769,10 +94995,11 @@ function looseHtmlEntityFromMarkdown() {
94769
94995
  /**
94770
94996
  * Micromark extension for HTML entities without semicolons.
94771
94997
  *
94772
- * Handles named entities (e.g. `&nbsp`, `&amp`, `&copy`), decimal numeric
94773
- * references (e.g. `&#160`, `&#169`), and hex numeric references (e.g. `&#xa0`,
94774
- * `&#xA0`). Entities that already include the semicolon are left for the
94775
- * standard parser to handle.
94998
+ * Handles the named entities the HTML spec lets authors write without a
94999
+ * semicolon (e.g. `&nbsp`, `&amp`, `&copy`), decimal numeric references (e.g.
95000
+ * `&#160`, `&#169`), and hex numeric references (e.g. `&#xa0`, `&#xA0`).
95001
+ * Entities that already include the semicolon are left for the standard parser
95002
+ * to handle.
94776
95003
  */
94777
95004
 
94778
95005
 
@@ -113513,7 +113740,9 @@ class MdxSyntaxError extends SyntaxError {
113513
113740
  * as `\r<br>`. Treating both characters as hard breaks doubles the spacing.
113514
113741
  */
113515
113742
  const hardBreaks = () => tree => {
113516
- findAndReplace(tree, [/\r?\n/g, () => ({ type: 'break' })]);
113743
+ // Skip `html-block`: its opaque payload is rendered verbatim, so turning its newlines
113744
+ // into `break` nodes is unnecessary and costly on large blocks.
113745
+ findAndReplace(tree, [/\r?\n/g, () => ({ type: 'break' })], { ignore: ['html-block'] });
113517
113746
  };
113518
113747
  /* harmony default export */ const hard_breaks = (hardBreaks);
113519
113748
 
@@ -123982,6 +124211,10 @@ const NESTED_ATTR_EXPRESSION_RE = /[\w-]+\s*=\s*\{/;
123982
124211
  // Name shape mirrors `componentTagPattern`; the lookbehind skips the inner tag
123983
124212
  // of a legacy `<<VARIABLE>>`.
123984
124213
  const NESTED_COMPONENT_TAG_RE = /(?<!<)<([A-Z][A-Za-z0-9_]*)[\s/>]/g;
124214
+ // Whole blank lines at a component body's edges. `\n` sits inside each group so a
124215
+ // match can only ever span complete lines, never part of a content line.
124216
+ const LEADING_BLANK_LINES_RE = /^(?:[ \t]*\n)+/;
124217
+ const TRAILING_BLANK_LINES_RE = /(?:\n[ \t]*)+$/;
123985
124218
  // Excludes tags with dedicated transformers (`Table`, `HTMLBlock`, inline
123986
124219
  // components), which expect their wrapper to stay raw.
123987
124220
  const hasNestedGenericComponentTag = (content) => [...content.matchAll(NESTED_COMPONENT_TAG_RE)].some(match => !GENERIC_MDX_COMPONENT_EXCLUDED_TAGS.has(match[1]));
@@ -124015,13 +124248,21 @@ function safeDeindent(text) {
124015
124248
  })
124016
124249
  .join('\n');
124017
124250
  }
124251
+ /**
124252
+ * Drop the blank lines at a component body's edges, keeping the first content line's
124253
+ * indent: `.trim()` stripped that line alone, so a uniformly indented body reparsed
124254
+ * lopsided and every list item after the first nested. The trailing pattern
124255
+ * takes the last content line's newline but leaves its spaces, which are code content
124256
+ * when a fence runs into the end tag.
124257
+ */
124258
+ const trimBlankEdges = (text) => text.replace(LEADING_BLANK_LINES_RE, '').replace(TRAILING_BLANK_LINES_RE, '');
124018
124259
  /**
124019
124260
  * Parse component-body markdown into mdast children. Dedenting shifts columns and
124020
124261
  * stales the top-level `terminateHtmlFlowBlocks` decisions, so that one preprocessor
124021
124262
  * re-runs here; other column-anchored fixups (compact headings, tables) do not.
124022
124263
  */
124023
124264
  const parseMdChildren = (value, safeMode) => {
124024
- const reparseSource = terminateHtmlFlowBlocks(safeDeindent(value).trim());
124265
+ const reparseSource = terminateHtmlFlowBlocks(trimBlankEdges(safeDeindent(value)));
124025
124266
  const parsed = getInlineMdProcessor({ safeMode }).parse(reparseSource);
124026
124267
  // Promote nested wrappers bottom-up so an outer wrapper sees markdown buried in a
124027
124268
  // child claimed whole (e.g. `<li>` in `<ol>`) before its containsMarkdownConstruct check (RM-17560).
@@ -124186,7 +124427,8 @@ function promoteComponentBlocks(tree, safeMode, source) {
124186
124427
  // Case 2: Self-contained block (closing tag in content)
124187
124428
  const closingTagIndex = isPlainLowercaseHtml ? plainClosingTagIndex : contentAfterTag.lastIndexOf(closingTagStr);
124188
124429
  if (closingTagIndex >= 0) {
124189
- // Untrimmed so parseMdChildren can dedent before trimming.
124430
+ // Left as authored: parseMdChildren needs the original columns to dedent by, and
124431
+ // it clears the blank edges itself.
124190
124432
  const componentInnerContent = contentAfterTag.substring(0, closingTagIndex);
124191
124433
  const contentAfterClose = contentAfterTag.substring(closingTagIndex + closingTagStr.length).trim();
124192
124434
  let parsedChildren = [];
@@ -126552,9 +126794,9 @@ const resolveDeferredAttributeExpressionProps = () => (tree, file) => {
126552
126794
  properties[name] = name === 'style' && style_object_to_css_isPlainObject(result) ? styleObjectToCssText(result) : result;
126553
126795
  }
126554
126796
  catch {
126555
- // Evaluation failed — fall back to the raw expression source so the attribute
126556
- // renders as readable text rather than disappearing.
126557
- properties[name] = source;
126797
+ // Evaluation failed — keep the literal `{...}`, matching how `evaluateExpressions` falls
126798
+ // back in body text. Variable references like `{user.name}` stay resolvable at render time.
126799
+ properties[name] = `{${source}}`;
126558
126800
  }
126559
126801
  });
126560
126802
  delete node.data.deferredExpressions;
@@ -127460,6 +127702,24 @@ const Contexts = ({ children, terms = [], variables = { user: {}, defaults: [] }
127460
127702
  };
127461
127703
  /* harmony default export */ const contexts = (Contexts);
127462
127704
 
127705
+ ;// ./utils/user.ts
127706
+ const User = (variables) => {
127707
+ const { user = {}, defaults = [] } = variables || {};
127708
+ return new Proxy(user, {
127709
+ get(target, attribute) {
127710
+ if (typeof attribute === 'symbol') {
127711
+ return '';
127712
+ }
127713
+ if (attribute in target) {
127714
+ return target[attribute];
127715
+ }
127716
+ const def = defaults.find((d) => d.name === attribute);
127717
+ return def ? def.default : attribute.toUpperCase();
127718
+ },
127719
+ });
127720
+ };
127721
+ /* harmony default export */ const user = (User);
127722
+
127463
127723
  ;// ./lib/utils/makeUseMdxComponents.ts
127464
127724
 
127465
127725
 
@@ -127490,6 +127750,35 @@ const makeUseMDXComponents = (more = {}) => {
127490
127750
  };
127491
127751
  /* harmony default export */ const makeUseMdxComponents = (makeUseMDXComponents);
127492
127752
 
127753
+ ;// ./lib/utils/mdxish/mdxish-variables.ts
127754
+
127755
+ // The `$` guard skips template-literal interpolation: `${user.name}` embeds `{user.name}`, and
127756
+ // substituting it would leave a mangled `` `Hi $Name` `` behind. Those belong to an expression,
127757
+ // which either evaluated already or is meant to stay literal.
127758
+ const MDX_VARIABLE_REGEX = new RegExp(`(?<!\\$)${variable_dist.MDX_VARIABLE_REGEXP}`, 'gu');
127759
+ // Bracket notation names the same variable as dot notation, so normalize it before substituting.
127760
+ // Escaped and `$`-prefixed forms are left alone so a reference that stays literal keeps its source.
127761
+ // A closing escape needs no lookahead: requiring a literal `]}` already rules out `]\}`.
127762
+ const BRACKET_NOTATION_REGEX = /(?<![$\\])\{user\[['"](\w+)['"]\]\}/gu;
127763
+ /**
127764
+ * Resolve `{user.*}` in a JSX attribute value against the same `user` binding the rmdx engine gets,
127765
+ * so both engines agree. Body text differs on empty values: `Variable` falls back to the default.
127766
+ *
127767
+ * Legacy `<<...>>` is valid inside a quoted attribute but deliberately left literal — attributes are
127768
+ * an MDX surface, and `{user.*}` is the syntax authors use there.
127769
+ */
127770
+ function resolveAttributeVariables(value, user) {
127771
+ if (!value.includes('{user'))
127772
+ return value;
127773
+ return value
127774
+ .replace(BRACKET_NOTATION_REGEX, '{user.$1}')
127775
+ .replace(MDX_VARIABLE_REGEX, (source, escapePrefix, name, escapeSuffix) => {
127776
+ if (escapePrefix || escapeSuffix)
127777
+ return source;
127778
+ return user[name];
127779
+ });
127780
+ }
127781
+
127493
127782
  ;// ./lib/utils/mdxish/mdxish-render-utils.tsx
127494
127783
 
127495
127784
 
@@ -127498,6 +127787,8 @@ const makeUseMDXComponents = (more = {}) => {
127498
127787
 
127499
127788
 
127500
127789
 
127790
+
127791
+
127501
127792
  /** Flatten CustomComponents into a component map for rehype-react */
127502
127793
  function exportComponentsForRehype(components) {
127503
127794
  const exported = Object.entries(components).reduce((memo, [tag, mod]) => {
@@ -127525,6 +127816,28 @@ function exportComponentsForRehype(components) {
127525
127816
  result.variable = (variable_dist_default());
127526
127817
  return result;
127527
127818
  }
127819
+ /**
127820
+ * Code rides on a `value` prop, and `variablesCodeResolver` owns it at parse time where it
127821
+ * deliberately leaves mermaid alone; resolving it again here would override that.
127822
+ */
127823
+ const CODE_TAG_NAMES = new Set(['code']);
127824
+ /** Raw markup injected with `dangerouslySetInnerHTML` by HTMLBlock and Embed — never interpolate. */
127825
+ const RAW_HTML_PROP_NAMES = new Set(['html']);
127826
+ /**
127827
+ * Resolve `{user.*}` in string-valued props. Body text is handled by the `Variable` component, but
127828
+ * attributes are plain strings, so they are substituted here — at render time, so that a
127829
+ * server-parsed (user-agnostic) tree resolves against the current reader's variables.
127830
+ */
127831
+ function resolveVariablesInProps(props, user, tagName) {
127832
+ const isCodeTag = Boolean(tagName && CODE_TAG_NAMES.has(tagName));
127833
+ const resolvedEntries = Object.entries(props).map(([key, value]) => {
127834
+ const isDocumentContent = RAW_HTML_PROP_NAMES.has(key) || (isCodeTag && key === 'value');
127835
+ if (typeof value !== 'string' || isDocumentContent)
127836
+ return [key, value];
127837
+ return [key, resolveAttributeVariables(value, user)];
127838
+ });
127839
+ return Object.fromEntries(resolvedEntries);
127840
+ }
127528
127841
  /**
127529
127842
  * Custom React.createElement wrapper that recovers real JS prop values for
127530
127843
  * custom components. rehype-react v6 uses hast-to-hyperscript, which stringifies
@@ -127536,7 +127849,7 @@ function exportComponentsForRehype(components) {
127536
127849
  * Only arrays win over `rest`, overwriting other shapes would undo correct
127537
127850
  * React conversions like `style="color:red"` → `{ color: 'red' }`.
127538
127851
  */
127539
- function createElementPreservingHastProps(type, props, ...children) {
127852
+ const makeCreateElementPreservingHastProps = (user) => function createElementPreservingHastProps(type, props, ...children) {
127540
127853
  if (props?.node?.properties) {
127541
127854
  const { node, ...rest } = props;
127542
127855
  const mergedProps = { ...rest };
@@ -127546,15 +127859,16 @@ function createElementPreservingHastProps(type, props, ...children) {
127546
127859
  });
127547
127860
  // Strip undefined so positional args don't shadow node.properties.children
127548
127861
  const definedChildren = children.filter(c => c !== undefined);
127549
- return external_react_default().createElement(type, mergedProps, ...definedChildren);
127862
+ const withVariables = resolveVariablesInProps(mergedProps, user, node.tagName);
127863
+ return external_react_default().createElement(type, withVariables, ...definedChildren);
127550
127864
  }
127551
- return external_react_default().createElement(type, props, ...children);
127552
- }
127865
+ return external_react_default().createElement(type, props && resolveVariablesInProps(props, user), ...children);
127866
+ };
127553
127867
  /** Create a rehype-react processor */
127554
- function createRehypeReactProcessor(components) {
127868
+ function createRehypeReactProcessor(components, variables) {
127555
127869
  // @ts-expect-error - rehype-react types are incompatible with React.Fragment return type
127556
127870
  return unified().use((rehype_react_default()), {
127557
- createElement: createElementPreservingHastProps,
127871
+ createElement: makeCreateElementPreservingHastProps(user(variables)),
127558
127872
  Fragment: (external_react_default()).Fragment,
127559
127873
  components,
127560
127874
  passNode: true,
@@ -127569,7 +127883,7 @@ function createTocComponent(tocHast) {
127569
127883
  components: { p: (external_react_default()).Fragment },
127570
127884
  });
127571
127885
  const tocReactElement = tocProcessor.stringify(tocHast);
127572
- const TocComponent = () => tocReactElement ? (external_react_default().createElement(components_TableOfContents, null, tocReactElement)) : null;
127886
+ const TocComponent = () => tocReactElement ? external_react_default().createElement(components_TableOfContents, null, tocReactElement) : null;
127573
127887
  TocComponent.displayName = 'Toc';
127574
127888
  return TocComponent;
127575
127889
  }
@@ -127618,7 +127932,7 @@ const renderMdxish = (tree, opts = {}) => {
127618
127932
  Object.entries(localScope).forEach(([name, value]) => {
127619
127933
  componentsForRehype[name] = value;
127620
127934
  });
127621
- const processor = createRehypeReactProcessor(componentsForRehype);
127935
+ const processor = createRehypeReactProcessor(componentsForRehype, variables);
127622
127936
  const content = processor.stringify(tree);
127623
127937
  const tocHast = headings.length > 0 ? tocToHast(headings, variables) : null;
127624
127938
  return buildRMDXModule(content, headings, tocHast, { ...contextOpts, variables });
@@ -127674,24 +127988,6 @@ function runSync(code, options) {
127674
127988
  // EXTERNAL MODULE: ./node_modules/react/jsx-runtime.js
127675
127989
  var jsx_runtime = __webpack_require__(4848);
127676
127990
  var jsx_runtime_namespaceObject = /*#__PURE__*/__webpack_require__.t(jsx_runtime, 2);
127677
- ;// ./utils/user.ts
127678
- const User = (variables) => {
127679
- const { user = {}, defaults = [] } = variables || {};
127680
- return new Proxy(user, {
127681
- get(target, attribute) {
127682
- if (typeof attribute === 'symbol') {
127683
- return '';
127684
- }
127685
- if (attribute in target) {
127686
- return target[attribute];
127687
- }
127688
- const def = defaults.find((d) => d.name === attribute);
127689
- return def ? def.default : attribute.toUpperCase();
127690
- },
127691
- });
127692
- };
127693
- /* harmony default export */ const user = (User);
127694
-
127695
127991
  ;// ./lib/run.tsx
127696
127992
 
127697
127993
 
@@ -127936,7 +128232,7 @@ async function stripComments(doc, { mdx, mdxish } = {}) {
127936
128232
 
127937
128233
 
127938
128234
 
127939
- const utils = {
128235
+ const index_utils = {
127940
128236
  get options() {
127941
128237
  return { ...options };
127942
128238
  },