@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.
@@ -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";
@@ -20921,72 +20922,319 @@ function push(list, items) {
20921
20922
  return items
20922
20923
  }
20923
20924
 
20925
+ ;// ./node_modules/micromark-util-subtokenize/lib/splice-buffer.js
20926
+ /**
20927
+ * Some of the internal operations of micromark do lots of editing
20928
+ * operations on very large arrays. This runs into problems with two
20929
+ * properties of most circa-2020 JavaScript interpreters:
20930
+ *
20931
+ * - Array-length modifications at the high end of an array (push/pop) are
20932
+ * expected to be common and are implemented in (amortized) time
20933
+ * proportional to the number of elements added or removed, whereas
20934
+ * other operations (shift/unshift and splice) are much less efficient.
20935
+ * - Function arguments are passed on the stack, so adding tens of thousands
20936
+ * of elements to an array with `arr.push(...newElements)` will frequently
20937
+ * cause stack overflows. (see <https://stackoverflow.com/questions/22123769/rangeerror-maximum-call-stack-size-exceeded-why>)
20938
+ *
20939
+ * SpliceBuffers are an implementation of gap buffers, which are a
20940
+ * generalization of the "queue made of two stacks" idea. The splice buffer
20941
+ * maintains a cursor, and moving the cursor has cost proportional to the
20942
+ * distance the cursor moves, but inserting, deleting, or splicing in
20943
+ * new information at the cursor is as efficient as the push/pop operation.
20944
+ * This allows for an efficient sequence of splices (or pushes, pops, shifts,
20945
+ * or unshifts) as long such edits happen at the same part of the array or
20946
+ * generally sweep through the array from the beginning to the end.
20947
+ *
20948
+ * The interface for splice buffers also supports large numbers of inputs by
20949
+ * passing a single array argument rather passing multiple arguments on the
20950
+ * function call stack.
20951
+ *
20952
+ * @template T
20953
+ * Item type.
20954
+ */
20955
+ class SpliceBuffer {
20956
+ /**
20957
+ * @param {ReadonlyArray<T> | null | undefined} [initial]
20958
+ * Initial items (optional).
20959
+ * @returns
20960
+ * Splice buffer.
20961
+ */
20962
+ constructor(initial) {
20963
+ /** @type {Array<T>} */
20964
+ this.left = initial ? [...initial] : [];
20965
+ /** @type {Array<T>} */
20966
+ this.right = [];
20967
+ }
20968
+
20969
+ /**
20970
+ * Array access;
20971
+ * does not move the cursor.
20972
+ *
20973
+ * @param {number} index
20974
+ * Index.
20975
+ * @return {T}
20976
+ * Item.
20977
+ */
20978
+ get(index) {
20979
+ if (index < 0 || index >= this.left.length + this.right.length) {
20980
+ throw new RangeError('Cannot access index `' + index + '` in a splice buffer of size `' + (this.left.length + this.right.length) + '`');
20981
+ }
20982
+ if (index < this.left.length) return this.left[index];
20983
+ return this.right[this.right.length - index + this.left.length - 1];
20984
+ }
20985
+
20986
+ /**
20987
+ * The length of the splice buffer, one greater than the largest index in the
20988
+ * array.
20989
+ */
20990
+ get length() {
20991
+ return this.left.length + this.right.length;
20992
+ }
20993
+
20994
+ /**
20995
+ * Remove and return `list[0]`;
20996
+ * moves the cursor to `0`.
20997
+ *
20998
+ * @returns {T | undefined}
20999
+ * Item, optional.
21000
+ */
21001
+ shift() {
21002
+ this.setCursor(0);
21003
+ return this.right.pop();
21004
+ }
21005
+
21006
+ /**
21007
+ * Slice the buffer to get an array;
21008
+ * does not move the cursor.
21009
+ *
21010
+ * @param {number} start
21011
+ * Start.
21012
+ * @param {number | null | undefined} [end]
21013
+ * End (optional).
21014
+ * @returns {Array<T>}
21015
+ * Array of items.
21016
+ */
21017
+ slice(start, end) {
21018
+ /** @type {number} */
21019
+ const stop = end === null || end === undefined ? Number.POSITIVE_INFINITY : end;
21020
+ if (stop < this.left.length) {
21021
+ return this.left.slice(start, stop);
21022
+ }
21023
+ if (start > this.left.length) {
21024
+ return this.right.slice(this.right.length - stop + this.left.length, this.right.length - start + this.left.length).reverse();
21025
+ }
21026
+ return this.left.slice(start).concat(this.right.slice(this.right.length - stop + this.left.length).reverse());
21027
+ }
21028
+
21029
+ /**
21030
+ * Mimics the behavior of Array.prototype.splice() except for the change of
21031
+ * interface necessary to avoid segfaults when patching in very large arrays.
21032
+ *
21033
+ * This operation moves cursor is moved to `start` and results in the cursor
21034
+ * placed after any inserted items.
21035
+ *
21036
+ * @param {number} start
21037
+ * Start;
21038
+ * zero-based index at which to start changing the array;
21039
+ * negative numbers count backwards from the end of the array and values
21040
+ * that are out-of bounds are clamped to the appropriate end of the array.
21041
+ * @param {number | null | undefined} [deleteCount=0]
21042
+ * Delete count (default: `0`);
21043
+ * maximum number of elements to delete, starting from start.
21044
+ * @param {Array<T> | null | undefined} [items=[]]
21045
+ * Items to include in place of the deleted items (default: `[]`).
21046
+ * @return {Array<T>}
21047
+ * Any removed items.
21048
+ */
21049
+ splice(start, deleteCount, items) {
21050
+ /** @type {number} */
21051
+ const count = deleteCount || 0;
21052
+ this.setCursor(Math.trunc(start));
21053
+ const removed = this.right.splice(this.right.length - count, Number.POSITIVE_INFINITY);
21054
+ if (items) chunkedPush(this.left, items);
21055
+ return removed.reverse();
21056
+ }
21057
+
21058
+ /**
21059
+ * Remove and return the highest-numbered item in the array, so
21060
+ * `list[list.length - 1]`;
21061
+ * Moves the cursor to `length`.
21062
+ *
21063
+ * @returns {T | undefined}
21064
+ * Item, optional.
21065
+ */
21066
+ pop() {
21067
+ this.setCursor(Number.POSITIVE_INFINITY);
21068
+ return this.left.pop();
21069
+ }
21070
+
21071
+ /**
21072
+ * Inserts a single item to the high-numbered side of the array;
21073
+ * moves the cursor to `length`.
21074
+ *
21075
+ * @param {T} item
21076
+ * Item.
21077
+ * @returns {undefined}
21078
+ * Nothing.
21079
+ */
21080
+ push(item) {
21081
+ this.setCursor(Number.POSITIVE_INFINITY);
21082
+ this.left.push(item);
21083
+ }
21084
+
21085
+ /**
21086
+ * Inserts many items to the high-numbered side of the array.
21087
+ * Moves the cursor to `length`.
21088
+ *
21089
+ * @param {Array<T>} items
21090
+ * Items.
21091
+ * @returns {undefined}
21092
+ * Nothing.
21093
+ */
21094
+ pushMany(items) {
21095
+ this.setCursor(Number.POSITIVE_INFINITY);
21096
+ chunkedPush(this.left, items);
21097
+ }
21098
+
21099
+ /**
21100
+ * Inserts a single item to the low-numbered side of the array;
21101
+ * Moves the cursor to `0`.
21102
+ *
21103
+ * @param {T} item
21104
+ * Item.
21105
+ * @returns {undefined}
21106
+ * Nothing.
21107
+ */
21108
+ unshift(item) {
21109
+ this.setCursor(0);
21110
+ this.right.push(item);
21111
+ }
21112
+
21113
+ /**
21114
+ * Inserts many items to the low-numbered side of the array;
21115
+ * moves the cursor to `0`.
21116
+ *
21117
+ * @param {Array<T>} items
21118
+ * Items.
21119
+ * @returns {undefined}
21120
+ * Nothing.
21121
+ */
21122
+ unshiftMany(items) {
21123
+ this.setCursor(0);
21124
+ chunkedPush(this.right, items.reverse());
21125
+ }
21126
+
21127
+ /**
21128
+ * Move the cursor to a specific position in the array. Requires
21129
+ * time proportional to the distance moved.
21130
+ *
21131
+ * If `n < 0`, the cursor will end up at the beginning.
21132
+ * If `n > length`, the cursor will end up at the end.
21133
+ *
21134
+ * @param {number} n
21135
+ * Position.
21136
+ * @return {undefined}
21137
+ * Nothing.
21138
+ */
21139
+ setCursor(n) {
21140
+ if (n === this.left.length || n > this.left.length && this.right.length === 0 || n < 0 && this.left.length === 0) return;
21141
+ if (n < this.left.length) {
21142
+ // Move cursor to the this.left
21143
+ const removed = this.left.splice(n, Number.POSITIVE_INFINITY);
21144
+ chunkedPush(this.right, removed.reverse());
21145
+ } else {
21146
+ // Move cursor to the this.right
21147
+ const removed = this.right.splice(this.left.length + this.right.length - n, Number.POSITIVE_INFINITY);
21148
+ chunkedPush(this.left, removed.reverse());
21149
+ }
21150
+ }
21151
+ }
21152
+
21153
+ /**
21154
+ * Avoid stack overflow by pushing items onto the stack in segments
21155
+ *
21156
+ * @template T
21157
+ * Item type.
21158
+ * @param {Array<T>} list
21159
+ * List to inject into.
21160
+ * @param {ReadonlyArray<T>} right
21161
+ * Items to inject.
21162
+ * @return {undefined}
21163
+ * Nothing.
21164
+ */
21165
+ function chunkedPush(list, right) {
21166
+ /** @type {number} */
21167
+ let chunkStart = 0;
21168
+ if (right.length < 10000) {
21169
+ list.push(...right);
21170
+ } else {
21171
+ while (chunkStart < right.length) {
21172
+ list.push(...right.slice(chunkStart, chunkStart + 10000));
21173
+ chunkStart += 10000;
21174
+ }
21175
+ }
21176
+ }
20924
21177
  ;// ./node_modules/micromark-util-subtokenize/index.js
20925
21178
  /**
20926
- * @typedef {import('micromark-util-types').Chunk} Chunk
20927
- * @typedef {import('micromark-util-types').Event} Event
20928
- * @typedef {import('micromark-util-types').Token} Token
21179
+ * @import {Chunk, Event, Token} from 'micromark-util-types'
20929
21180
  */
20930
21181
 
20931
21182
 
21183
+
21184
+
21185
+ // Hidden API exposed for testing.
21186
+
21187
+
20932
21188
  /**
20933
21189
  * Tokenize subcontent.
20934
21190
  *
20935
- * @param {Array<Event>} events
21191
+ * @param {Array<Event>} eventsArray
20936
21192
  * List of events.
20937
21193
  * @returns {boolean}
20938
21194
  * Whether subtokens were found.
20939
- */ // eslint-disable-next-line complexity
20940
- function subtokenize(events) {
21195
+ */
21196
+ // eslint-disable-next-line complexity
21197
+ function subtokenize(eventsArray) {
20941
21198
  /** @type {Record<string, number>} */
20942
- const jumps = {}
20943
- let index = -1
21199
+ const jumps = {};
21200
+ let index = -1;
20944
21201
  /** @type {Event} */
20945
- let event
21202
+ let event;
20946
21203
  /** @type {number | undefined} */
20947
- let lineIndex
21204
+ let lineIndex;
20948
21205
  /** @type {number} */
20949
- let otherIndex
21206
+ let otherIndex;
20950
21207
  /** @type {Event} */
20951
- let otherEvent
21208
+ let otherEvent;
20952
21209
  /** @type {Array<Event>} */
20953
- let parameters
21210
+ let parameters;
20954
21211
  /** @type {Array<Event>} */
20955
- let subevents
21212
+ let subevents;
20956
21213
  /** @type {boolean | undefined} */
20957
- let more
21214
+ let more;
21215
+ const events = new SpliceBuffer(eventsArray);
20958
21216
  while (++index < events.length) {
20959
21217
  while (index in jumps) {
20960
- index = jumps[index]
21218
+ index = jumps[index];
20961
21219
  }
20962
- event = events[index]
21220
+ event = events.get(index);
20963
21221
 
20964
21222
  // Add a hook for the GFM tasklist extension, which needs to know if text
20965
21223
  // is in the first content of a list item.
20966
- if (
20967
- index &&
20968
- event[1].type === 'chunkFlow' &&
20969
- events[index - 1][1].type === 'listItemPrefix'
20970
- ) {
20971
- subevents = event[1]._tokenizer.events
20972
- otherIndex = 0
20973
- if (
20974
- otherIndex < subevents.length &&
20975
- subevents[otherIndex][1].type === 'lineEndingBlank'
20976
- ) {
20977
- otherIndex += 2
21224
+ if (index && event[1].type === "chunkFlow" && events.get(index - 1)[1].type === "listItemPrefix") {
21225
+ subevents = event[1]._tokenizer.events;
21226
+ otherIndex = 0;
21227
+ if (otherIndex < subevents.length && subevents[otherIndex][1].type === "lineEndingBlank") {
21228
+ otherIndex += 2;
20978
21229
  }
20979
- if (
20980
- otherIndex < subevents.length &&
20981
- subevents[otherIndex][1].type === 'content'
20982
- ) {
21230
+ if (otherIndex < subevents.length && subevents[otherIndex][1].type === "content") {
20983
21231
  while (++otherIndex < subevents.length) {
20984
- if (subevents[otherIndex][1].type === 'content') {
20985
- break
21232
+ if (subevents[otherIndex][1].type === "content") {
21233
+ break;
20986
21234
  }
20987
- if (subevents[otherIndex][1].type === 'chunkText') {
20988
- subevents[otherIndex][1]._isInFirstContentOfListItem = true
20989
- otherIndex++
21235
+ if (subevents[otherIndex][1].type === "chunkText") {
21236
+ subevents[otherIndex][1]._isInFirstContentOfListItem = true;
21237
+ otherIndex++;
20990
21238
  }
20991
21239
  }
20992
21240
  }
@@ -20995,158 +21243,160 @@ function subtokenize(events) {
20995
21243
  // Enter.
20996
21244
  if (event[0] === 'enter') {
20997
21245
  if (event[1].contentType) {
20998
- Object.assign(jumps, subcontent(events, index))
20999
- index = jumps[index]
21000
- more = true
21246
+ Object.assign(jumps, subcontent(events, index));
21247
+ index = jumps[index];
21248
+ more = true;
21001
21249
  }
21002
21250
  }
21003
21251
  // Exit.
21004
21252
  else if (event[1]._container) {
21005
- otherIndex = index
21006
- lineIndex = undefined
21253
+ otherIndex = index;
21254
+ lineIndex = undefined;
21007
21255
  while (otherIndex--) {
21008
- otherEvent = events[otherIndex]
21009
- if (
21010
- otherEvent[1].type === 'lineEnding' ||
21011
- otherEvent[1].type === 'lineEndingBlank'
21012
- ) {
21256
+ otherEvent = events.get(otherIndex);
21257
+ if (otherEvent[1].type === "lineEnding" || otherEvent[1].type === "lineEndingBlank") {
21013
21258
  if (otherEvent[0] === 'enter') {
21014
21259
  if (lineIndex) {
21015
- events[lineIndex][1].type = 'lineEndingBlank'
21260
+ events.get(lineIndex)[1].type = "lineEndingBlank";
21016
21261
  }
21017
- otherEvent[1].type = 'lineEnding'
21018
- lineIndex = otherIndex
21262
+ otherEvent[1].type = "lineEnding";
21263
+ lineIndex = otherIndex;
21019
21264
  }
21265
+ } else if (otherEvent[1].type === "linePrefix") {
21266
+ // Move past.
21020
21267
  } else {
21021
- break
21268
+ break;
21022
21269
  }
21023
21270
  }
21024
21271
  if (lineIndex) {
21025
21272
  // Fix position.
21026
- event[1].end = Object.assign({}, events[lineIndex][1].start)
21273
+ event[1].end = {
21274
+ ...events.get(lineIndex)[1].start
21275
+ };
21027
21276
 
21028
21277
  // Switch container exit w/ line endings.
21029
- parameters = events.slice(lineIndex, index)
21030
- parameters.unshift(event)
21031
- splice(events, lineIndex, index - lineIndex + 1, parameters)
21278
+ parameters = events.slice(lineIndex, index);
21279
+ parameters.unshift(event);
21280
+ events.splice(lineIndex, index - lineIndex + 1, parameters);
21032
21281
  }
21033
21282
  }
21034
21283
  }
21035
- return !more
21284
+
21285
+ // The changes to the `events` buffer must be copied back into the eventsArray
21286
+ splice(eventsArray, 0, Number.POSITIVE_INFINITY, events.slice(0));
21287
+ return !more;
21036
21288
  }
21037
21289
 
21038
21290
  /**
21039
21291
  * Tokenize embedded tokens.
21040
21292
  *
21041
- * @param {Array<Event>} events
21293
+ * @param {SpliceBuffer<Event>} events
21294
+ * Events.
21042
21295
  * @param {number} eventIndex
21296
+ * Index.
21043
21297
  * @returns {Record<string, number>}
21298
+ * Gaps.
21044
21299
  */
21045
21300
  function subcontent(events, eventIndex) {
21046
- const token = events[eventIndex][1]
21047
- const context = events[eventIndex][2]
21048
- let startPosition = eventIndex - 1
21301
+ const token = events.get(eventIndex)[1];
21302
+ const context = events.get(eventIndex)[2];
21303
+ let startPosition = eventIndex - 1;
21049
21304
  /** @type {Array<number>} */
21050
- const startPositions = []
21051
- const tokenizer =
21052
- token._tokenizer || context.parser[token.contentType](token.start)
21053
- const childEvents = tokenizer.events
21305
+ const startPositions = [];
21306
+ const tokenizer = token._tokenizer || context.parser[token.contentType](token.start);
21307
+ const childEvents = tokenizer.events;
21054
21308
  /** @type {Array<[number, number]>} */
21055
- const jumps = []
21309
+ const jumps = [];
21056
21310
  /** @type {Record<string, number>} */
21057
- const gaps = {}
21311
+ const gaps = {};
21058
21312
  /** @type {Array<Chunk>} */
21059
- let stream
21313
+ let stream;
21060
21314
  /** @type {Token | undefined} */
21061
- let previous
21062
- let index = -1
21315
+ let previous;
21316
+ let index = -1;
21063
21317
  /** @type {Token | undefined} */
21064
- let current = token
21065
- let adjust = 0
21066
- let start = 0
21067
- const breaks = [start]
21318
+ let current = token;
21319
+ let adjust = 0;
21320
+ let start = 0;
21321
+ const breaks = [start];
21068
21322
 
21069
21323
  // Loop forward through the linked tokens to pass them in order to the
21070
21324
  // subtokenizer.
21071
21325
  while (current) {
21072
21326
  // Find the position of the event for this token.
21073
- while (events[++startPosition][1] !== current) {
21327
+ while (events.get(++startPosition)[1] !== current) {
21074
21328
  // Empty.
21075
21329
  }
21076
- startPositions.push(startPosition)
21330
+ startPositions.push(startPosition);
21077
21331
  if (!current._tokenizer) {
21078
- stream = context.sliceStream(current)
21332
+ stream = context.sliceStream(current);
21079
21333
  if (!current.next) {
21080
- stream.push(null)
21334
+ stream.push(null);
21081
21335
  }
21082
21336
  if (previous) {
21083
- tokenizer.defineSkip(current.start)
21337
+ tokenizer.defineSkip(current.start);
21084
21338
  }
21085
21339
  if (current._isInFirstContentOfListItem) {
21086
- tokenizer._gfmTasklistFirstContentOfListItem = true
21340
+ tokenizer._gfmTasklistFirstContentOfListItem = true;
21087
21341
  }
21088
- tokenizer.write(stream)
21342
+ tokenizer.write(stream);
21089
21343
  if (current._isInFirstContentOfListItem) {
21090
- tokenizer._gfmTasklistFirstContentOfListItem = undefined
21344
+ tokenizer._gfmTasklistFirstContentOfListItem = undefined;
21091
21345
  }
21092
21346
  }
21093
21347
 
21094
21348
  // Unravel the next token.
21095
- previous = current
21096
- current = current.next
21349
+ previous = current;
21350
+ current = current.next;
21097
21351
  }
21098
21352
 
21099
21353
  // Now, loop back through all events (and linked tokens), to figure out which
21100
21354
  // parts belong where.
21101
- current = token
21355
+ current = token;
21102
21356
  while (++index < childEvents.length) {
21103
21357
  if (
21104
- // Find a void token that includes a break.
21105
- childEvents[index][0] === 'exit' &&
21106
- childEvents[index - 1][0] === 'enter' &&
21107
- childEvents[index][1].type === childEvents[index - 1][1].type &&
21108
- childEvents[index][1].start.line !== childEvents[index][1].end.line
21109
- ) {
21110
- start = index + 1
21111
- breaks.push(start)
21358
+ // Find a void token that includes a break.
21359
+ 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) {
21360
+ start = index + 1;
21361
+ breaks.push(start);
21112
21362
  // Help GC.
21113
- current._tokenizer = undefined
21114
- current.previous = undefined
21115
- current = current.next
21363
+ current._tokenizer = undefined;
21364
+ current.previous = undefined;
21365
+ current = current.next;
21116
21366
  }
21117
21367
  }
21118
21368
 
21119
21369
  // Help GC.
21120
- tokenizer.events = []
21370
+ tokenizer.events = [];
21121
21371
 
21122
21372
  // If there’s one more token (which is the cases for lines that end in an
21123
21373
  // EOF), that’s perfect: the last point we found starts it.
21124
21374
  // If there isn’t then make sure any remaining content is added to it.
21125
21375
  if (current) {
21126
21376
  // Help GC.
21127
- current._tokenizer = undefined
21128
- current.previous = undefined
21377
+ current._tokenizer = undefined;
21378
+ current.previous = undefined;
21129
21379
  } else {
21130
- breaks.pop()
21380
+ breaks.pop();
21131
21381
  }
21132
21382
 
21133
21383
  // Now splice the events from the subtokenizer into the current events,
21134
21384
  // moving back to front so that splice indices aren’t affected.
21135
- index = breaks.length
21385
+ index = breaks.length;
21136
21386
  while (index--) {
21137
- const slice = childEvents.slice(breaks[index], breaks[index + 1])
21138
- const start = startPositions.pop()
21139
- jumps.unshift([start, start + slice.length - 1])
21140
- splice(events, start, 2, slice)
21387
+ const slice = childEvents.slice(breaks[index], breaks[index + 1]);
21388
+ const start = startPositions.pop();
21389
+ jumps.push([start, start + slice.length - 1]);
21390
+ events.splice(start, 2, slice);
21141
21391
  }
21142
- index = -1
21392
+ jumps.reverse();
21393
+ index = -1;
21143
21394
  while (++index < jumps.length) {
21144
- gaps[adjust + jumps[index][0]] = adjust + jumps[index][1]
21145
- adjust += jumps[index][1] - jumps[index][0] - 1
21395
+ gaps[adjust + jumps[index][0]] = adjust + jumps[index][1];
21396
+ adjust += jumps[index][1] - jumps[index][0] - 1;
21146
21397
  }
21147
- return gaps
21398
+ return gaps;
21148
21399
  }
21149
-
21150
21400
  ;// ./node_modules/micromark/lib/postprocess.js
21151
21401
  /**
21152
21402
  * @typedef {import('micromark-util-types').Event} Event
@@ -86560,16 +86810,16 @@ const Code = (props) => {
86560
86810
  };
86561
86811
  /* harmony default export */ const components_Code = (Code);
86562
86812
 
86563
- // EXTERNAL MODULE: ./node_modules/@readme/syntax-highlighter/dist-utils/index.js
86564
- var dist_utils = __webpack_require__(7900);
86565
- var dist_utils_default = /*#__PURE__*/__webpack_require__.n(dist_utils);
86813
+ // EXTERNAL MODULE: ./node_modules/@readme/syntax-highlighter/dist-utils/utils/index.js
86814
+ var utils = __webpack_require__(4350);
86815
+ var utils_default = /*#__PURE__*/__webpack_require__.n(utils);
86566
86816
  ;// ./components/CodeTabs/index.tsx
86567
86817
 
86568
86818
 
86569
86819
 
86570
86820
 
86571
86821
  let mermaid;
86572
- const { uppercase } = (dist_utils_default());
86822
+ const { uppercase } = (utils_default());
86573
86823
  // Module-level queue that batches mermaid nodes across all CodeTabs instances into a
86574
86824
  // single mermaid.run() call. This is necessary because mermaid generates SVG element IDs
86575
86825
  // using Date.now(), which collides when multiple diagrams render in the same millisecond.
@@ -94607,11 +94857,6 @@ const looseHtmlEntityConstruct = {
94607
94857
  name: 'looseHtmlEntity',
94608
94858
  tokenize: tokenizeLooseHtmlEntity,
94609
94859
  };
94610
- function resolveEntity(name) {
94611
- const input = `&${name};`;
94612
- const decoded = decode_decodeHTMLStrict(input);
94613
- return decoded !== input ? decoded : undefined;
94614
- }
94615
94860
  function tokenizeLooseHtmlEntity(effects, ok, nok) {
94616
94861
  let length = 0;
94617
94862
  const start = (code) => {
@@ -94678,28 +94923,9 @@ function tokenizeLooseHtmlEntity(effects, ok, nok) {
94678
94923
  }
94679
94924
  function exitLooseHtmlEntity(token) {
94680
94925
  const raw = this.sliceSerialize(token);
94681
- const entityChars = raw.slice(1);
94682
- if (entityChars.startsWith('#')) {
94683
- const decoded = resolveEntity(entityChars);
94684
- if (decoded) {
94685
- this.enter({ type: 'text', value: decoded }, token);
94686
- this.exit(token);
94687
- return;
94688
- }
94689
- }
94690
- else {
94691
- for (let len = entityChars.length; len >= 2; len -= 1) {
94692
- const candidate = entityChars.slice(0, len);
94693
- const decoded = resolveEntity(candidate);
94694
- if (decoded) {
94695
- const remainder = entityChars.slice(len);
94696
- this.enter({ type: 'text', value: decoded + remainder }, token);
94697
- this.exit(token);
94698
- return;
94699
- }
94700
- }
94701
- }
94702
- this.enter({ type: 'text', value: raw }, token);
94926
+ // `decodeHTML` follows the HTML spec's legacy rules, where only a small
94927
+ // whitelist of names may omit the semicolon, so `&partner_key` stays intact.
94928
+ this.enter({ type: 'text', value: esm_decode_decodeHTML(raw) }, token);
94703
94929
  this.exit(token);
94704
94930
  }
94705
94931
  function looseHtmlEntity() {
@@ -94719,10 +94945,11 @@ function looseHtmlEntityFromMarkdown() {
94719
94945
  /**
94720
94946
  * Micromark extension for HTML entities without semicolons.
94721
94947
  *
94722
- * Handles named entities (e.g. `&nbsp`, `&amp`, `&copy`), decimal numeric
94723
- * references (e.g. `&#160`, `&#169`), and hex numeric references (e.g. `&#xa0`,
94724
- * `&#xA0`). Entities that already include the semicolon are left for the
94725
- * standard parser to handle.
94948
+ * Handles the named entities the HTML spec lets authors write without a
94949
+ * semicolon (e.g. `&nbsp`, `&amp`, `&copy`), decimal numeric references (e.g.
94950
+ * `&#160`, `&#169`), and hex numeric references (e.g. `&#xa0`, `&#xA0`).
94951
+ * Entities that already include the semicolon are left for the standard parser
94952
+ * to handle.
94726
94953
  */
94727
94954
 
94728
94955
 
@@ -113463,7 +113690,9 @@ class MdxSyntaxError extends SyntaxError {
113463
113690
  * as `\r<br>`. Treating both characters as hard breaks doubles the spacing.
113464
113691
  */
113465
113692
  const hardBreaks = () => tree => {
113466
- findAndReplace(tree, [/\r?\n/g, () => ({ type: 'break' })]);
113693
+ // Skip `html-block`: its opaque payload is rendered verbatim, so turning its newlines
113694
+ // into `break` nodes is unnecessary and costly on large blocks.
113695
+ findAndReplace(tree, [/\r?\n/g, () => ({ type: 'break' })], { ignore: ['html-block'] });
113467
113696
  };
113468
113697
  /* harmony default export */ const hard_breaks = (hardBreaks);
113469
113698
 
@@ -122512,6 +122741,10 @@ const NESTED_ATTR_EXPRESSION_RE = /[\w-]+\s*=\s*\{/;
122512
122741
  // Name shape mirrors `componentTagPattern`; the lookbehind skips the inner tag
122513
122742
  // of a legacy `<<VARIABLE>>`.
122514
122743
  const NESTED_COMPONENT_TAG_RE = /(?<!<)<([A-Z][A-Za-z0-9_]*)[\s/>]/g;
122744
+ // Whole blank lines at a component body's edges. `\n` sits inside each group so a
122745
+ // match can only ever span complete lines, never part of a content line.
122746
+ const LEADING_BLANK_LINES_RE = /^(?:[ \t]*\n)+/;
122747
+ const TRAILING_BLANK_LINES_RE = /(?:\n[ \t]*)+$/;
122515
122748
  // Excludes tags with dedicated transformers (`Table`, `HTMLBlock`, inline
122516
122749
  // components), which expect their wrapper to stay raw.
122517
122750
  const hasNestedGenericComponentTag = (content) => [...content.matchAll(NESTED_COMPONENT_TAG_RE)].some(match => !GENERIC_MDX_COMPONENT_EXCLUDED_TAGS.has(match[1]));
@@ -122545,13 +122778,21 @@ function safeDeindent(text) {
122545
122778
  })
122546
122779
  .join('\n');
122547
122780
  }
122781
+ /**
122782
+ * Drop the blank lines at a component body's edges, keeping the first content line's
122783
+ * indent: `.trim()` stripped that line alone, so a uniformly indented body reparsed
122784
+ * lopsided and every list item after the first nested. The trailing pattern
122785
+ * takes the last content line's newline but leaves its spaces, which are code content
122786
+ * when a fence runs into the end tag.
122787
+ */
122788
+ const trimBlankEdges = (text) => text.replace(LEADING_BLANK_LINES_RE, '').replace(TRAILING_BLANK_LINES_RE, '');
122548
122789
  /**
122549
122790
  * Parse component-body markdown into mdast children. Dedenting shifts columns and
122550
122791
  * stales the top-level `terminateHtmlFlowBlocks` decisions, so that one preprocessor
122551
122792
  * re-runs here; other column-anchored fixups (compact headings, tables) do not.
122552
122793
  */
122553
122794
  const parseMdChildren = (value, safeMode) => {
122554
- const reparseSource = terminateHtmlFlowBlocks(safeDeindent(value).trim());
122795
+ const reparseSource = terminateHtmlFlowBlocks(trimBlankEdges(safeDeindent(value)));
122555
122796
  const parsed = getInlineMdProcessor({ safeMode }).parse(reparseSource);
122556
122797
  // Promote nested wrappers bottom-up so an outer wrapper sees markdown buried in a
122557
122798
  // child claimed whole (e.g. `<li>` in `<ol>`) before its containsMarkdownConstruct check (RM-17560).
@@ -122716,7 +122957,8 @@ function promoteComponentBlocks(tree, safeMode, source) {
122716
122957
  // Case 2: Self-contained block (closing tag in content)
122717
122958
  const closingTagIndex = isPlainLowercaseHtml ? plainClosingTagIndex : contentAfterTag.lastIndexOf(closingTagStr);
122718
122959
  if (closingTagIndex >= 0) {
122719
- // Untrimmed so parseMdChildren can dedent before trimming.
122960
+ // Left as authored: parseMdChildren needs the original columns to dedent by, and
122961
+ // it clears the blank edges itself.
122720
122962
  const componentInnerContent = contentAfterTag.substring(0, closingTagIndex);
122721
122963
  const contentAfterClose = contentAfterTag.substring(closingTagIndex + closingTagStr.length).trim();
122722
122964
  let parsedChildren = [];
@@ -126500,9 +126742,9 @@ const resolveDeferredAttributeExpressionProps = () => (tree, file) => {
126500
126742
  properties[name] = name === 'style' && style_object_to_css_isPlainObject(result) ? styleObjectToCssText(result) : result;
126501
126743
  }
126502
126744
  catch {
126503
- // Evaluation failed — fall back to the raw expression source so the attribute
126504
- // renders as readable text rather than disappearing.
126505
- properties[name] = source;
126745
+ // Evaluation failed — keep the literal `{...}`, matching how `evaluateExpressions` falls
126746
+ // back in body text. Variable references like `{user.name}` stay resolvable at render time.
126747
+ properties[name] = `{${source}}`;
126506
126748
  }
126507
126749
  });
126508
126750
  delete node.data.deferredExpressions;
@@ -127319,6 +127561,24 @@ const Contexts = ({ children, terms = [], variables = { user: {}, defaults: [] }
127319
127561
  };
127320
127562
  /* harmony default export */ const contexts = (Contexts);
127321
127563
 
127564
+ ;// ./utils/user.ts
127565
+ const User = (variables) => {
127566
+ const { user = {}, defaults = [] } = variables || {};
127567
+ return new Proxy(user, {
127568
+ get(target, attribute) {
127569
+ if (typeof attribute === 'symbol') {
127570
+ return '';
127571
+ }
127572
+ if (attribute in target) {
127573
+ return target[attribute];
127574
+ }
127575
+ const def = defaults.find((d) => d.name === attribute);
127576
+ return def ? def.default : attribute.toUpperCase();
127577
+ },
127578
+ });
127579
+ };
127580
+ /* harmony default export */ const user = (User);
127581
+
127322
127582
  ;// ./lib/utils/makeUseMdxComponents.ts
127323
127583
 
127324
127584
 
@@ -127349,6 +127609,35 @@ const makeUseMDXComponents = (more = {}) => {
127349
127609
  };
127350
127610
  /* harmony default export */ const makeUseMdxComponents = (makeUseMDXComponents);
127351
127611
 
127612
+ ;// ./lib/utils/mdxish/mdxish-variables.ts
127613
+
127614
+ // The `$` guard skips template-literal interpolation: `${user.name}` embeds `{user.name}`, and
127615
+ // substituting it would leave a mangled `` `Hi $Name` `` behind. Those belong to an expression,
127616
+ // which either evaluated already or is meant to stay literal.
127617
+ const MDX_VARIABLE_REGEX = new RegExp(`(?<!\\$)${variable_dist.MDX_VARIABLE_REGEXP}`, 'gu');
127618
+ // Bracket notation names the same variable as dot notation, so normalize it before substituting.
127619
+ // Escaped and `$`-prefixed forms are left alone so a reference that stays literal keeps its source.
127620
+ // A closing escape needs no lookahead: requiring a literal `]}` already rules out `]\}`.
127621
+ const BRACKET_NOTATION_REGEX = /(?<![$\\])\{user\[['"](\w+)['"]\]\}/gu;
127622
+ /**
127623
+ * Resolve `{user.*}` in a JSX attribute value against the same `user` binding the rmdx engine gets,
127624
+ * so both engines agree. Body text differs on empty values: `Variable` falls back to the default.
127625
+ *
127626
+ * Legacy `<<...>>` is valid inside a quoted attribute but deliberately left literal — attributes are
127627
+ * an MDX surface, and `{user.*}` is the syntax authors use there.
127628
+ */
127629
+ function resolveAttributeVariables(value, user) {
127630
+ if (!value.includes('{user'))
127631
+ return value;
127632
+ return value
127633
+ .replace(BRACKET_NOTATION_REGEX, '{user.$1}')
127634
+ .replace(MDX_VARIABLE_REGEX, (source, escapePrefix, name, escapeSuffix) => {
127635
+ if (escapePrefix || escapeSuffix)
127636
+ return source;
127637
+ return user[name];
127638
+ });
127639
+ }
127640
+
127352
127641
  ;// ./lib/utils/mdxish/mdxish-render-utils.tsx
127353
127642
 
127354
127643
 
@@ -127357,6 +127646,8 @@ const makeUseMDXComponents = (more = {}) => {
127357
127646
 
127358
127647
 
127359
127648
 
127649
+
127650
+
127360
127651
  /** Flatten CustomComponents into a component map for rehype-react */
127361
127652
  function exportComponentsForRehype(components) {
127362
127653
  const exported = Object.entries(components).reduce((memo, [tag, mod]) => {
@@ -127384,6 +127675,28 @@ function exportComponentsForRehype(components) {
127384
127675
  result.variable = (variable_dist_default());
127385
127676
  return result;
127386
127677
  }
127678
+ /**
127679
+ * Code rides on a `value` prop, and `variablesCodeResolver` owns it at parse time where it
127680
+ * deliberately leaves mermaid alone; resolving it again here would override that.
127681
+ */
127682
+ const CODE_TAG_NAMES = new Set(['code']);
127683
+ /** Raw markup injected with `dangerouslySetInnerHTML` by HTMLBlock and Embed — never interpolate. */
127684
+ const RAW_HTML_PROP_NAMES = new Set(['html']);
127685
+ /**
127686
+ * Resolve `{user.*}` in string-valued props. Body text is handled by the `Variable` component, but
127687
+ * attributes are plain strings, so they are substituted here — at render time, so that a
127688
+ * server-parsed (user-agnostic) tree resolves against the current reader's variables.
127689
+ */
127690
+ function resolveVariablesInProps(props, user, tagName) {
127691
+ const isCodeTag = Boolean(tagName && CODE_TAG_NAMES.has(tagName));
127692
+ const resolvedEntries = Object.entries(props).map(([key, value]) => {
127693
+ const isDocumentContent = RAW_HTML_PROP_NAMES.has(key) || (isCodeTag && key === 'value');
127694
+ if (typeof value !== 'string' || isDocumentContent)
127695
+ return [key, value];
127696
+ return [key, resolveAttributeVariables(value, user)];
127697
+ });
127698
+ return Object.fromEntries(resolvedEntries);
127699
+ }
127387
127700
  /**
127388
127701
  * Custom React.createElement wrapper that recovers real JS prop values for
127389
127702
  * custom components. rehype-react v6 uses hast-to-hyperscript, which stringifies
@@ -127395,7 +127708,7 @@ function exportComponentsForRehype(components) {
127395
127708
  * Only arrays win over `rest`, overwriting other shapes would undo correct
127396
127709
  * React conversions like `style="color:red"` → `{ color: 'red' }`.
127397
127710
  */
127398
- function createElementPreservingHastProps(type, props, ...children) {
127711
+ const makeCreateElementPreservingHastProps = (user) => function createElementPreservingHastProps(type, props, ...children) {
127399
127712
  if (props?.node?.properties) {
127400
127713
  const { node, ...rest } = props;
127401
127714
  const mergedProps = { ...rest };
@@ -127405,15 +127718,16 @@ function createElementPreservingHastProps(type, props, ...children) {
127405
127718
  });
127406
127719
  // Strip undefined so positional args don't shadow node.properties.children
127407
127720
  const definedChildren = children.filter(c => c !== undefined);
127408
- return external_react_default().createElement(type, mergedProps, ...definedChildren);
127721
+ const withVariables = resolveVariablesInProps(mergedProps, user, node.tagName);
127722
+ return external_react_default().createElement(type, withVariables, ...definedChildren);
127409
127723
  }
127410
- return external_react_default().createElement(type, props, ...children);
127411
- }
127724
+ return external_react_default().createElement(type, props && resolveVariablesInProps(props, user), ...children);
127725
+ };
127412
127726
  /** Create a rehype-react processor */
127413
- function createRehypeReactProcessor(components) {
127727
+ function createRehypeReactProcessor(components, variables) {
127414
127728
  // @ts-expect-error - rehype-react types are incompatible with React.Fragment return type
127415
127729
  return lib_unified().use((rehype_react_default()), {
127416
- createElement: createElementPreservingHastProps,
127730
+ createElement: makeCreateElementPreservingHastProps(user(variables)),
127417
127731
  Fragment: (external_react_default()).Fragment,
127418
127732
  components,
127419
127733
  passNode: true,
@@ -127428,7 +127742,7 @@ function createTocComponent(tocHast) {
127428
127742
  components: { p: (external_react_default()).Fragment },
127429
127743
  });
127430
127744
  const tocReactElement = tocProcessor.stringify(tocHast);
127431
- const TocComponent = () => tocReactElement ? (external_react_default().createElement(components_TableOfContents, null, tocReactElement)) : null;
127745
+ const TocComponent = () => tocReactElement ? external_react_default().createElement(components_TableOfContents, null, tocReactElement) : null;
127432
127746
  TocComponent.displayName = 'Toc';
127433
127747
  return TocComponent;
127434
127748
  }
@@ -127477,7 +127791,7 @@ const renderMdxish = (tree, opts = {}) => {
127477
127791
  Object.entries(localScope).forEach(([name, value]) => {
127478
127792
  componentsForRehype[name] = value;
127479
127793
  });
127480
- const processor = createRehypeReactProcessor(componentsForRehype);
127794
+ const processor = createRehypeReactProcessor(componentsForRehype, variables);
127481
127795
  const content = processor.stringify(tree);
127482
127796
  const tocHast = headings.length > 0 ? tocToHast(headings, variables) : null;
127483
127797
  return buildRMDXModule(content, headings, tocHast, { ...contextOpts, variables });
@@ -127533,24 +127847,6 @@ function runSync(code, options) {
127533
127847
  // EXTERNAL MODULE: ./node_modules/react/jsx-runtime.js
127534
127848
  var jsx_runtime = __webpack_require__(4848);
127535
127849
  var jsx_runtime_namespaceObject = /*#__PURE__*/__webpack_require__.t(jsx_runtime, 2);
127536
- ;// ./utils/user.ts
127537
- const User = (variables) => {
127538
- const { user = {}, defaults = [] } = variables || {};
127539
- return new Proxy(user, {
127540
- get(target, attribute) {
127541
- if (typeof attribute === 'symbol') {
127542
- return '';
127543
- }
127544
- if (attribute in target) {
127545
- return target[attribute];
127546
- }
127547
- const def = defaults.find((d) => d.name === attribute);
127548
- return def ? def.default : attribute.toUpperCase();
127549
- },
127550
- });
127551
- };
127552
- /* harmony default export */ const user = (User);
127553
-
127554
127850
  ;// ./lib/run.tsx
127555
127851
 
127556
127852