@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/368.node.js +1 -393
- package/dist/368.node.js.map +1 -1
- package/dist/lib/micromark/loose-html-entities/index.d.ts +5 -4
- package/dist/lib/utils/mdxish/mdxish-render-utils.d.ts +1 -1
- package/dist/lib/utils/mdxish/mdxish-variables.d.ts +8 -0
- package/dist/main.js +489 -193
- package/dist/main.node.js +482 -186
- package/dist/main.node.js.map +1 -1
- package/dist/render-fixture.node.js +480 -184
- package/dist/render-fixture.node.js.map +1 -1
- package/package.json +4 -2
package/dist/main.js
CHANGED
|
@@ -285,7 +285,7 @@ function visit(tree, test, visitor, reverse) {
|
|
|
285
285
|
|
|
286
286
|
/***/ }),
|
|
287
287
|
|
|
288
|
-
/***/
|
|
288
|
+
/***/ 7644:
|
|
289
289
|
/***/ ((__unused_webpack_module, exports) => {
|
|
290
290
|
|
|
291
291
|
"use strict";
|
|
@@ -359,7 +359,7 @@ exports["default"] = canonical;
|
|
|
359
359
|
|
|
360
360
|
/***/ }),
|
|
361
361
|
|
|
362
|
-
/***/
|
|
362
|
+
/***/ 4350:
|
|
363
363
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
364
364
|
|
|
365
365
|
"use strict";
|
|
@@ -368,15 +368,15 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
368
368
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
369
369
|
};
|
|
370
370
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
371
|
-
const canonical_1 = __importDefault(__webpack_require__(
|
|
372
|
-
const modes_1 = __webpack_require__(
|
|
373
|
-
const uppercase_1 = __importDefault(__webpack_require__(
|
|
371
|
+
const canonical_1 = __importDefault(__webpack_require__(7644));
|
|
372
|
+
const modes_1 = __webpack_require__(1130);
|
|
373
|
+
const uppercase_1 = __importDefault(__webpack_require__(3622));
|
|
374
374
|
exports["default"] = { uppercase: uppercase_1.default, canonical: canonical_1.default, modes: modes_1.modes, getMode: modes_1.getMode };
|
|
375
375
|
|
|
376
376
|
|
|
377
377
|
/***/ }),
|
|
378
378
|
|
|
379
|
-
/***/
|
|
379
|
+
/***/ 1130:
|
|
380
380
|
/***/ ((__unused_webpack_module, exports) => {
|
|
381
381
|
|
|
382
382
|
"use strict";
|
|
@@ -435,6 +435,7 @@ exports.modes = {
|
|
|
435
435
|
node: 'javascript',
|
|
436
436
|
macruby: 'ruby',
|
|
437
437
|
markdown: 'gfm',
|
|
438
|
+
md: 'gfm',
|
|
438
439
|
ml: ['mllike', 'text/x-ocaml'],
|
|
439
440
|
mssql: ['sql', 'text/x-mssql'],
|
|
440
441
|
mysql: ['sql', 'text/x-mysql'],
|
|
@@ -489,7 +490,7 @@ function getMode(lang) {
|
|
|
489
490
|
|
|
490
491
|
/***/ }),
|
|
491
492
|
|
|
492
|
-
/***/
|
|
493
|
+
/***/ 3622:
|
|
493
494
|
/***/ ((__unused_webpack_module, exports) => {
|
|
494
495
|
|
|
495
496
|
"use strict";
|
|
@@ -1517,7 +1518,7 @@ module.exports = function (key) {
|
|
|
1517
1518
|
|
|
1518
1519
|
/***/ }),
|
|
1519
1520
|
|
|
1520
|
-
/***/
|
|
1521
|
+
/***/ 4228:
|
|
1521
1522
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
1522
1523
|
|
|
1523
1524
|
var isObject = __webpack_require__(3305);
|
|
@@ -2213,7 +2214,7 @@ var meta = module.exports = {
|
|
|
2213
2214
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
2214
2215
|
|
|
2215
2216
|
// 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties])
|
|
2216
|
-
var anObject = __webpack_require__(
|
|
2217
|
+
var anObject = __webpack_require__(4228);
|
|
2217
2218
|
var dPs = __webpack_require__(1626);
|
|
2218
2219
|
var enumBugKeys = __webpack_require__(6140);
|
|
2219
2220
|
var IE_PROTO = __webpack_require__(766)('IE_PROTO');
|
|
@@ -2260,7 +2261,7 @@ module.exports = Object.create || function create(O, Properties) {
|
|
|
2260
2261
|
/***/ 7967:
|
|
2261
2262
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
2262
2263
|
|
|
2263
|
-
var anObject = __webpack_require__(
|
|
2264
|
+
var anObject = __webpack_require__(4228);
|
|
2264
2265
|
var IE8_DOM_DEFINE = __webpack_require__(2956);
|
|
2265
2266
|
var toPrimitive = __webpack_require__(3048);
|
|
2266
2267
|
var dP = Object.defineProperty;
|
|
@@ -2284,7 +2285,7 @@ exports.f = __webpack_require__(1763) ? Object.defineProperty : function defineP
|
|
|
2284
2285
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
2285
2286
|
|
|
2286
2287
|
var dP = __webpack_require__(7967);
|
|
2287
|
-
var anObject = __webpack_require__(
|
|
2288
|
+
var anObject = __webpack_require__(4228);
|
|
2288
2289
|
var getKeys = __webpack_require__(1311);
|
|
2289
2290
|
|
|
2290
2291
|
module.exports = __webpack_require__(1763) ? Object.defineProperties : function defineProperties(O, Properties) {
|
|
@@ -2460,7 +2461,7 @@ module.exports = function (KEY, exec) {
|
|
|
2460
2461
|
// all object keys, includes non-enumerable and symbols
|
|
2461
2462
|
var gOPN = __webpack_require__(9415);
|
|
2462
2463
|
var gOPS = __webpack_require__(1060);
|
|
2463
|
-
var anObject = __webpack_require__(
|
|
2464
|
+
var anObject = __webpack_require__(4228);
|
|
2464
2465
|
var Reflect = (__webpack_require__(7526).Reflect);
|
|
2465
2466
|
module.exports = Reflect && Reflect.ownKeys || function ownKeys(it) {
|
|
2466
2467
|
var keys = gOPN.f(anObject(it));
|
|
@@ -2530,7 +2531,7 @@ var TPL = ('' + $toString).split(TO_STRING);
|
|
|
2530
2531
|
// Works with __proto__ only. Old v8 can't work with null proto objects.
|
|
2531
2532
|
/* eslint-disable no-proto */
|
|
2532
2533
|
var isObject = __webpack_require__(3305);
|
|
2533
|
-
var anObject = __webpack_require__(
|
|
2534
|
+
var anObject = __webpack_require__(4228);
|
|
2534
2535
|
var check = function (O, proto) {
|
|
2535
2536
|
anObject(O);
|
|
2536
2537
|
if (!isObject(proto) && proto !== null) throw TypeError(proto + ": can't set as prototype!");
|
|
@@ -3133,7 +3134,7 @@ var wksExt = __webpack_require__(7960);
|
|
|
3133
3134
|
var wksDefine = __webpack_require__(5392);
|
|
3134
3135
|
var enumKeys = __webpack_require__(5969);
|
|
3135
3136
|
var isArray = __webpack_require__(7981);
|
|
3136
|
-
var anObject = __webpack_require__(
|
|
3137
|
+
var anObject = __webpack_require__(4228);
|
|
3137
3138
|
var isObject = __webpack_require__(3305);
|
|
3138
3139
|
var toObject = __webpack_require__(8270);
|
|
3139
3140
|
var toIObject = __webpack_require__(7221);
|
|
@@ -11619,7 +11620,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
11619
11620
|
stripComments: () => (/* reexport */ lib_stripComments),
|
|
11620
11621
|
tags: () => (/* reexport */ lib_tags),
|
|
11621
11622
|
tailwindCompiler: () => (/* reexport */ tailwindCompiler),
|
|
11622
|
-
utils: () => (/* binding */
|
|
11623
|
+
utils: () => (/* binding */ index_utils)
|
|
11623
11624
|
});
|
|
11624
11625
|
|
|
11625
11626
|
// NAMESPACE OBJECT: ./components/index.ts
|
|
@@ -11941,16 +11942,16 @@ const Code = (props) => {
|
|
|
11941
11942
|
};
|
|
11942
11943
|
/* harmony default export */ const components_Code = (Code);
|
|
11943
11944
|
|
|
11944
|
-
// EXTERNAL MODULE: ./node_modules/@readme/syntax-highlighter/dist-utils/index.js
|
|
11945
|
-
var
|
|
11946
|
-
var
|
|
11945
|
+
// EXTERNAL MODULE: ./node_modules/@readme/syntax-highlighter/dist-utils/utils/index.js
|
|
11946
|
+
var utils = __webpack_require__(4350);
|
|
11947
|
+
var utils_default = /*#__PURE__*/__webpack_require__.n(utils);
|
|
11947
11948
|
;// ./components/CodeTabs/index.tsx
|
|
11948
11949
|
|
|
11949
11950
|
|
|
11950
11951
|
|
|
11951
11952
|
|
|
11952
11953
|
let mermaid;
|
|
11953
|
-
const { uppercase } = (
|
|
11954
|
+
const { uppercase } = (utils_default());
|
|
11954
11955
|
// Module-level queue that batches mermaid nodes across all CodeTabs instances into a
|
|
11955
11956
|
// single mermaid.run() call. This is necessary because mermaid generates SVG element IDs
|
|
11956
11957
|
// using Date.now(), which collides when multiple diagrams render in the same millisecond.
|
|
@@ -14676,72 +14677,319 @@ function push(list, items) {
|
|
|
14676
14677
|
return items
|
|
14677
14678
|
}
|
|
14678
14679
|
|
|
14680
|
+
;// ./node_modules/micromark-util-subtokenize/lib/splice-buffer.js
|
|
14681
|
+
/**
|
|
14682
|
+
* Some of the internal operations of micromark do lots of editing
|
|
14683
|
+
* operations on very large arrays. This runs into problems with two
|
|
14684
|
+
* properties of most circa-2020 JavaScript interpreters:
|
|
14685
|
+
*
|
|
14686
|
+
* - Array-length modifications at the high end of an array (push/pop) are
|
|
14687
|
+
* expected to be common and are implemented in (amortized) time
|
|
14688
|
+
* proportional to the number of elements added or removed, whereas
|
|
14689
|
+
* other operations (shift/unshift and splice) are much less efficient.
|
|
14690
|
+
* - Function arguments are passed on the stack, so adding tens of thousands
|
|
14691
|
+
* of elements to an array with `arr.push(...newElements)` will frequently
|
|
14692
|
+
* cause stack overflows. (see <https://stackoverflow.com/questions/22123769/rangeerror-maximum-call-stack-size-exceeded-why>)
|
|
14693
|
+
*
|
|
14694
|
+
* SpliceBuffers are an implementation of gap buffers, which are a
|
|
14695
|
+
* generalization of the "queue made of two stacks" idea. The splice buffer
|
|
14696
|
+
* maintains a cursor, and moving the cursor has cost proportional to the
|
|
14697
|
+
* distance the cursor moves, but inserting, deleting, or splicing in
|
|
14698
|
+
* new information at the cursor is as efficient as the push/pop operation.
|
|
14699
|
+
* This allows for an efficient sequence of splices (or pushes, pops, shifts,
|
|
14700
|
+
* or unshifts) as long such edits happen at the same part of the array or
|
|
14701
|
+
* generally sweep through the array from the beginning to the end.
|
|
14702
|
+
*
|
|
14703
|
+
* The interface for splice buffers also supports large numbers of inputs by
|
|
14704
|
+
* passing a single array argument rather passing multiple arguments on the
|
|
14705
|
+
* function call stack.
|
|
14706
|
+
*
|
|
14707
|
+
* @template T
|
|
14708
|
+
* Item type.
|
|
14709
|
+
*/
|
|
14710
|
+
class SpliceBuffer {
|
|
14711
|
+
/**
|
|
14712
|
+
* @param {ReadonlyArray<T> | null | undefined} [initial]
|
|
14713
|
+
* Initial items (optional).
|
|
14714
|
+
* @returns
|
|
14715
|
+
* Splice buffer.
|
|
14716
|
+
*/
|
|
14717
|
+
constructor(initial) {
|
|
14718
|
+
/** @type {Array<T>} */
|
|
14719
|
+
this.left = initial ? [...initial] : [];
|
|
14720
|
+
/** @type {Array<T>} */
|
|
14721
|
+
this.right = [];
|
|
14722
|
+
}
|
|
14723
|
+
|
|
14724
|
+
/**
|
|
14725
|
+
* Array access;
|
|
14726
|
+
* does not move the cursor.
|
|
14727
|
+
*
|
|
14728
|
+
* @param {number} index
|
|
14729
|
+
* Index.
|
|
14730
|
+
* @return {T}
|
|
14731
|
+
* Item.
|
|
14732
|
+
*/
|
|
14733
|
+
get(index) {
|
|
14734
|
+
if (index < 0 || index >= this.left.length + this.right.length) {
|
|
14735
|
+
throw new RangeError('Cannot access index `' + index + '` in a splice buffer of size `' + (this.left.length + this.right.length) + '`');
|
|
14736
|
+
}
|
|
14737
|
+
if (index < this.left.length) return this.left[index];
|
|
14738
|
+
return this.right[this.right.length - index + this.left.length - 1];
|
|
14739
|
+
}
|
|
14740
|
+
|
|
14741
|
+
/**
|
|
14742
|
+
* The length of the splice buffer, one greater than the largest index in the
|
|
14743
|
+
* array.
|
|
14744
|
+
*/
|
|
14745
|
+
get length() {
|
|
14746
|
+
return this.left.length + this.right.length;
|
|
14747
|
+
}
|
|
14748
|
+
|
|
14749
|
+
/**
|
|
14750
|
+
* Remove and return `list[0]`;
|
|
14751
|
+
* moves the cursor to `0`.
|
|
14752
|
+
*
|
|
14753
|
+
* @returns {T | undefined}
|
|
14754
|
+
* Item, optional.
|
|
14755
|
+
*/
|
|
14756
|
+
shift() {
|
|
14757
|
+
this.setCursor(0);
|
|
14758
|
+
return this.right.pop();
|
|
14759
|
+
}
|
|
14760
|
+
|
|
14761
|
+
/**
|
|
14762
|
+
* Slice the buffer to get an array;
|
|
14763
|
+
* does not move the cursor.
|
|
14764
|
+
*
|
|
14765
|
+
* @param {number} start
|
|
14766
|
+
* Start.
|
|
14767
|
+
* @param {number | null | undefined} [end]
|
|
14768
|
+
* End (optional).
|
|
14769
|
+
* @returns {Array<T>}
|
|
14770
|
+
* Array of items.
|
|
14771
|
+
*/
|
|
14772
|
+
slice(start, end) {
|
|
14773
|
+
/** @type {number} */
|
|
14774
|
+
const stop = end === null || end === undefined ? Number.POSITIVE_INFINITY : end;
|
|
14775
|
+
if (stop < this.left.length) {
|
|
14776
|
+
return this.left.slice(start, stop);
|
|
14777
|
+
}
|
|
14778
|
+
if (start > this.left.length) {
|
|
14779
|
+
return this.right.slice(this.right.length - stop + this.left.length, this.right.length - start + this.left.length).reverse();
|
|
14780
|
+
}
|
|
14781
|
+
return this.left.slice(start).concat(this.right.slice(this.right.length - stop + this.left.length).reverse());
|
|
14782
|
+
}
|
|
14783
|
+
|
|
14784
|
+
/**
|
|
14785
|
+
* Mimics the behavior of Array.prototype.splice() except for the change of
|
|
14786
|
+
* interface necessary to avoid segfaults when patching in very large arrays.
|
|
14787
|
+
*
|
|
14788
|
+
* This operation moves cursor is moved to `start` and results in the cursor
|
|
14789
|
+
* placed after any inserted items.
|
|
14790
|
+
*
|
|
14791
|
+
* @param {number} start
|
|
14792
|
+
* Start;
|
|
14793
|
+
* zero-based index at which to start changing the array;
|
|
14794
|
+
* negative numbers count backwards from the end of the array and values
|
|
14795
|
+
* that are out-of bounds are clamped to the appropriate end of the array.
|
|
14796
|
+
* @param {number | null | undefined} [deleteCount=0]
|
|
14797
|
+
* Delete count (default: `0`);
|
|
14798
|
+
* maximum number of elements to delete, starting from start.
|
|
14799
|
+
* @param {Array<T> | null | undefined} [items=[]]
|
|
14800
|
+
* Items to include in place of the deleted items (default: `[]`).
|
|
14801
|
+
* @return {Array<T>}
|
|
14802
|
+
* Any removed items.
|
|
14803
|
+
*/
|
|
14804
|
+
splice(start, deleteCount, items) {
|
|
14805
|
+
/** @type {number} */
|
|
14806
|
+
const count = deleteCount || 0;
|
|
14807
|
+
this.setCursor(Math.trunc(start));
|
|
14808
|
+
const removed = this.right.splice(this.right.length - count, Number.POSITIVE_INFINITY);
|
|
14809
|
+
if (items) chunkedPush(this.left, items);
|
|
14810
|
+
return removed.reverse();
|
|
14811
|
+
}
|
|
14812
|
+
|
|
14813
|
+
/**
|
|
14814
|
+
* Remove and return the highest-numbered item in the array, so
|
|
14815
|
+
* `list[list.length - 1]`;
|
|
14816
|
+
* Moves the cursor to `length`.
|
|
14817
|
+
*
|
|
14818
|
+
* @returns {T | undefined}
|
|
14819
|
+
* Item, optional.
|
|
14820
|
+
*/
|
|
14821
|
+
pop() {
|
|
14822
|
+
this.setCursor(Number.POSITIVE_INFINITY);
|
|
14823
|
+
return this.left.pop();
|
|
14824
|
+
}
|
|
14825
|
+
|
|
14826
|
+
/**
|
|
14827
|
+
* Inserts a single item to the high-numbered side of the array;
|
|
14828
|
+
* moves the cursor to `length`.
|
|
14829
|
+
*
|
|
14830
|
+
* @param {T} item
|
|
14831
|
+
* Item.
|
|
14832
|
+
* @returns {undefined}
|
|
14833
|
+
* Nothing.
|
|
14834
|
+
*/
|
|
14835
|
+
push(item) {
|
|
14836
|
+
this.setCursor(Number.POSITIVE_INFINITY);
|
|
14837
|
+
this.left.push(item);
|
|
14838
|
+
}
|
|
14839
|
+
|
|
14840
|
+
/**
|
|
14841
|
+
* Inserts many items to the high-numbered side of the array.
|
|
14842
|
+
* Moves the cursor to `length`.
|
|
14843
|
+
*
|
|
14844
|
+
* @param {Array<T>} items
|
|
14845
|
+
* Items.
|
|
14846
|
+
* @returns {undefined}
|
|
14847
|
+
* Nothing.
|
|
14848
|
+
*/
|
|
14849
|
+
pushMany(items) {
|
|
14850
|
+
this.setCursor(Number.POSITIVE_INFINITY);
|
|
14851
|
+
chunkedPush(this.left, items);
|
|
14852
|
+
}
|
|
14853
|
+
|
|
14854
|
+
/**
|
|
14855
|
+
* Inserts a single item to the low-numbered side of the array;
|
|
14856
|
+
* Moves the cursor to `0`.
|
|
14857
|
+
*
|
|
14858
|
+
* @param {T} item
|
|
14859
|
+
* Item.
|
|
14860
|
+
* @returns {undefined}
|
|
14861
|
+
* Nothing.
|
|
14862
|
+
*/
|
|
14863
|
+
unshift(item) {
|
|
14864
|
+
this.setCursor(0);
|
|
14865
|
+
this.right.push(item);
|
|
14866
|
+
}
|
|
14867
|
+
|
|
14868
|
+
/**
|
|
14869
|
+
* Inserts many items to the low-numbered side of the array;
|
|
14870
|
+
* moves the cursor to `0`.
|
|
14871
|
+
*
|
|
14872
|
+
* @param {Array<T>} items
|
|
14873
|
+
* Items.
|
|
14874
|
+
* @returns {undefined}
|
|
14875
|
+
* Nothing.
|
|
14876
|
+
*/
|
|
14877
|
+
unshiftMany(items) {
|
|
14878
|
+
this.setCursor(0);
|
|
14879
|
+
chunkedPush(this.right, items.reverse());
|
|
14880
|
+
}
|
|
14881
|
+
|
|
14882
|
+
/**
|
|
14883
|
+
* Move the cursor to a specific position in the array. Requires
|
|
14884
|
+
* time proportional to the distance moved.
|
|
14885
|
+
*
|
|
14886
|
+
* If `n < 0`, the cursor will end up at the beginning.
|
|
14887
|
+
* If `n > length`, the cursor will end up at the end.
|
|
14888
|
+
*
|
|
14889
|
+
* @param {number} n
|
|
14890
|
+
* Position.
|
|
14891
|
+
* @return {undefined}
|
|
14892
|
+
* Nothing.
|
|
14893
|
+
*/
|
|
14894
|
+
setCursor(n) {
|
|
14895
|
+
if (n === this.left.length || n > this.left.length && this.right.length === 0 || n < 0 && this.left.length === 0) return;
|
|
14896
|
+
if (n < this.left.length) {
|
|
14897
|
+
// Move cursor to the this.left
|
|
14898
|
+
const removed = this.left.splice(n, Number.POSITIVE_INFINITY);
|
|
14899
|
+
chunkedPush(this.right, removed.reverse());
|
|
14900
|
+
} else {
|
|
14901
|
+
// Move cursor to the this.right
|
|
14902
|
+
const removed = this.right.splice(this.left.length + this.right.length - n, Number.POSITIVE_INFINITY);
|
|
14903
|
+
chunkedPush(this.left, removed.reverse());
|
|
14904
|
+
}
|
|
14905
|
+
}
|
|
14906
|
+
}
|
|
14907
|
+
|
|
14908
|
+
/**
|
|
14909
|
+
* Avoid stack overflow by pushing items onto the stack in segments
|
|
14910
|
+
*
|
|
14911
|
+
* @template T
|
|
14912
|
+
* Item type.
|
|
14913
|
+
* @param {Array<T>} list
|
|
14914
|
+
* List to inject into.
|
|
14915
|
+
* @param {ReadonlyArray<T>} right
|
|
14916
|
+
* Items to inject.
|
|
14917
|
+
* @return {undefined}
|
|
14918
|
+
* Nothing.
|
|
14919
|
+
*/
|
|
14920
|
+
function chunkedPush(list, right) {
|
|
14921
|
+
/** @type {number} */
|
|
14922
|
+
let chunkStart = 0;
|
|
14923
|
+
if (right.length < 10000) {
|
|
14924
|
+
list.push(...right);
|
|
14925
|
+
} else {
|
|
14926
|
+
while (chunkStart < right.length) {
|
|
14927
|
+
list.push(...right.slice(chunkStart, chunkStart + 10000));
|
|
14928
|
+
chunkStart += 10000;
|
|
14929
|
+
}
|
|
14930
|
+
}
|
|
14931
|
+
}
|
|
14679
14932
|
;// ./node_modules/micromark-util-subtokenize/index.js
|
|
14680
14933
|
/**
|
|
14681
|
-
* @
|
|
14682
|
-
* @typedef {import('micromark-util-types').Event} Event
|
|
14683
|
-
* @typedef {import('micromark-util-types').Token} Token
|
|
14934
|
+
* @import {Chunk, Event, Token} from 'micromark-util-types'
|
|
14684
14935
|
*/
|
|
14685
14936
|
|
|
14686
14937
|
|
|
14938
|
+
|
|
14939
|
+
|
|
14940
|
+
// Hidden API exposed for testing.
|
|
14941
|
+
|
|
14942
|
+
|
|
14687
14943
|
/**
|
|
14688
14944
|
* Tokenize subcontent.
|
|
14689
14945
|
*
|
|
14690
|
-
* @param {Array<Event>}
|
|
14946
|
+
* @param {Array<Event>} eventsArray
|
|
14691
14947
|
* List of events.
|
|
14692
14948
|
* @returns {boolean}
|
|
14693
14949
|
* Whether subtokens were found.
|
|
14694
|
-
*/
|
|
14695
|
-
|
|
14950
|
+
*/
|
|
14951
|
+
// eslint-disable-next-line complexity
|
|
14952
|
+
function subtokenize(eventsArray) {
|
|
14696
14953
|
/** @type {Record<string, number>} */
|
|
14697
|
-
const jumps = {}
|
|
14698
|
-
let index = -1
|
|
14954
|
+
const jumps = {};
|
|
14955
|
+
let index = -1;
|
|
14699
14956
|
/** @type {Event} */
|
|
14700
|
-
let event
|
|
14957
|
+
let event;
|
|
14701
14958
|
/** @type {number | undefined} */
|
|
14702
|
-
let lineIndex
|
|
14959
|
+
let lineIndex;
|
|
14703
14960
|
/** @type {number} */
|
|
14704
|
-
let otherIndex
|
|
14961
|
+
let otherIndex;
|
|
14705
14962
|
/** @type {Event} */
|
|
14706
|
-
let otherEvent
|
|
14963
|
+
let otherEvent;
|
|
14707
14964
|
/** @type {Array<Event>} */
|
|
14708
|
-
let parameters
|
|
14965
|
+
let parameters;
|
|
14709
14966
|
/** @type {Array<Event>} */
|
|
14710
|
-
let subevents
|
|
14967
|
+
let subevents;
|
|
14711
14968
|
/** @type {boolean | undefined} */
|
|
14712
|
-
let more
|
|
14969
|
+
let more;
|
|
14970
|
+
const events = new SpliceBuffer(eventsArray);
|
|
14713
14971
|
while (++index < events.length) {
|
|
14714
14972
|
while (index in jumps) {
|
|
14715
|
-
index = jumps[index]
|
|
14973
|
+
index = jumps[index];
|
|
14716
14974
|
}
|
|
14717
|
-
event = events
|
|
14975
|
+
event = events.get(index);
|
|
14718
14976
|
|
|
14719
14977
|
// Add a hook for the GFM tasklist extension, which needs to know if text
|
|
14720
14978
|
// is in the first content of a list item.
|
|
14721
|
-
if (
|
|
14722
|
-
|
|
14723
|
-
|
|
14724
|
-
|
|
14725
|
-
|
|
14726
|
-
subevents = event[1]._tokenizer.events
|
|
14727
|
-
otherIndex = 0
|
|
14728
|
-
if (
|
|
14729
|
-
otherIndex < subevents.length &&
|
|
14730
|
-
subevents[otherIndex][1].type === 'lineEndingBlank'
|
|
14731
|
-
) {
|
|
14732
|
-
otherIndex += 2
|
|
14979
|
+
if (index && event[1].type === "chunkFlow" && events.get(index - 1)[1].type === "listItemPrefix") {
|
|
14980
|
+
subevents = event[1]._tokenizer.events;
|
|
14981
|
+
otherIndex = 0;
|
|
14982
|
+
if (otherIndex < subevents.length && subevents[otherIndex][1].type === "lineEndingBlank") {
|
|
14983
|
+
otherIndex += 2;
|
|
14733
14984
|
}
|
|
14734
|
-
if (
|
|
14735
|
-
otherIndex < subevents.length &&
|
|
14736
|
-
subevents[otherIndex][1].type === 'content'
|
|
14737
|
-
) {
|
|
14985
|
+
if (otherIndex < subevents.length && subevents[otherIndex][1].type === "content") {
|
|
14738
14986
|
while (++otherIndex < subevents.length) {
|
|
14739
|
-
if (subevents[otherIndex][1].type ===
|
|
14740
|
-
break
|
|
14987
|
+
if (subevents[otherIndex][1].type === "content") {
|
|
14988
|
+
break;
|
|
14741
14989
|
}
|
|
14742
|
-
if (subevents[otherIndex][1].type ===
|
|
14743
|
-
subevents[otherIndex][1]._isInFirstContentOfListItem = true
|
|
14744
|
-
otherIndex
|
|
14990
|
+
if (subevents[otherIndex][1].type === "chunkText") {
|
|
14991
|
+
subevents[otherIndex][1]._isInFirstContentOfListItem = true;
|
|
14992
|
+
otherIndex++;
|
|
14745
14993
|
}
|
|
14746
14994
|
}
|
|
14747
14995
|
}
|
|
@@ -14750,158 +14998,160 @@ function subtokenize(events) {
|
|
|
14750
14998
|
// Enter.
|
|
14751
14999
|
if (event[0] === 'enter') {
|
|
14752
15000
|
if (event[1].contentType) {
|
|
14753
|
-
Object.assign(jumps, subcontent(events, index))
|
|
14754
|
-
index = jumps[index]
|
|
14755
|
-
more = true
|
|
15001
|
+
Object.assign(jumps, subcontent(events, index));
|
|
15002
|
+
index = jumps[index];
|
|
15003
|
+
more = true;
|
|
14756
15004
|
}
|
|
14757
15005
|
}
|
|
14758
15006
|
// Exit.
|
|
14759
15007
|
else if (event[1]._container) {
|
|
14760
|
-
otherIndex = index
|
|
14761
|
-
lineIndex = undefined
|
|
15008
|
+
otherIndex = index;
|
|
15009
|
+
lineIndex = undefined;
|
|
14762
15010
|
while (otherIndex--) {
|
|
14763
|
-
otherEvent = events
|
|
14764
|
-
if (
|
|
14765
|
-
otherEvent[1].type === 'lineEnding' ||
|
|
14766
|
-
otherEvent[1].type === 'lineEndingBlank'
|
|
14767
|
-
) {
|
|
15011
|
+
otherEvent = events.get(otherIndex);
|
|
15012
|
+
if (otherEvent[1].type === "lineEnding" || otherEvent[1].type === "lineEndingBlank") {
|
|
14768
15013
|
if (otherEvent[0] === 'enter') {
|
|
14769
15014
|
if (lineIndex) {
|
|
14770
|
-
events
|
|
15015
|
+
events.get(lineIndex)[1].type = "lineEndingBlank";
|
|
14771
15016
|
}
|
|
14772
|
-
otherEvent[1].type =
|
|
14773
|
-
lineIndex = otherIndex
|
|
15017
|
+
otherEvent[1].type = "lineEnding";
|
|
15018
|
+
lineIndex = otherIndex;
|
|
14774
15019
|
}
|
|
15020
|
+
} else if (otherEvent[1].type === "linePrefix") {
|
|
15021
|
+
// Move past.
|
|
14775
15022
|
} else {
|
|
14776
|
-
break
|
|
15023
|
+
break;
|
|
14777
15024
|
}
|
|
14778
15025
|
}
|
|
14779
15026
|
if (lineIndex) {
|
|
14780
15027
|
// Fix position.
|
|
14781
|
-
event[1].end =
|
|
15028
|
+
event[1].end = {
|
|
15029
|
+
...events.get(lineIndex)[1].start
|
|
15030
|
+
};
|
|
14782
15031
|
|
|
14783
15032
|
// Switch container exit w/ line endings.
|
|
14784
|
-
parameters = events.slice(lineIndex, index)
|
|
14785
|
-
parameters.unshift(event)
|
|
14786
|
-
splice(
|
|
15033
|
+
parameters = events.slice(lineIndex, index);
|
|
15034
|
+
parameters.unshift(event);
|
|
15035
|
+
events.splice(lineIndex, index - lineIndex + 1, parameters);
|
|
14787
15036
|
}
|
|
14788
15037
|
}
|
|
14789
15038
|
}
|
|
14790
|
-
|
|
15039
|
+
|
|
15040
|
+
// The changes to the `events` buffer must be copied back into the eventsArray
|
|
15041
|
+
splice(eventsArray, 0, Number.POSITIVE_INFINITY, events.slice(0));
|
|
15042
|
+
return !more;
|
|
14791
15043
|
}
|
|
14792
15044
|
|
|
14793
15045
|
/**
|
|
14794
15046
|
* Tokenize embedded tokens.
|
|
14795
15047
|
*
|
|
14796
|
-
* @param {
|
|
15048
|
+
* @param {SpliceBuffer<Event>} events
|
|
15049
|
+
* Events.
|
|
14797
15050
|
* @param {number} eventIndex
|
|
15051
|
+
* Index.
|
|
14798
15052
|
* @returns {Record<string, number>}
|
|
15053
|
+
* Gaps.
|
|
14799
15054
|
*/
|
|
14800
15055
|
function subcontent(events, eventIndex) {
|
|
14801
|
-
const token = events
|
|
14802
|
-
const context = events
|
|
14803
|
-
let startPosition = eventIndex - 1
|
|
15056
|
+
const token = events.get(eventIndex)[1];
|
|
15057
|
+
const context = events.get(eventIndex)[2];
|
|
15058
|
+
let startPosition = eventIndex - 1;
|
|
14804
15059
|
/** @type {Array<number>} */
|
|
14805
|
-
const startPositions = []
|
|
14806
|
-
const tokenizer =
|
|
14807
|
-
|
|
14808
|
-
const childEvents = tokenizer.events
|
|
15060
|
+
const startPositions = [];
|
|
15061
|
+
const tokenizer = token._tokenizer || context.parser[token.contentType](token.start);
|
|
15062
|
+
const childEvents = tokenizer.events;
|
|
14809
15063
|
/** @type {Array<[number, number]>} */
|
|
14810
|
-
const jumps = []
|
|
15064
|
+
const jumps = [];
|
|
14811
15065
|
/** @type {Record<string, number>} */
|
|
14812
|
-
const gaps = {}
|
|
15066
|
+
const gaps = {};
|
|
14813
15067
|
/** @type {Array<Chunk>} */
|
|
14814
|
-
let stream
|
|
15068
|
+
let stream;
|
|
14815
15069
|
/** @type {Token | undefined} */
|
|
14816
|
-
let previous
|
|
14817
|
-
let index = -1
|
|
15070
|
+
let previous;
|
|
15071
|
+
let index = -1;
|
|
14818
15072
|
/** @type {Token | undefined} */
|
|
14819
|
-
let current = token
|
|
14820
|
-
let adjust = 0
|
|
14821
|
-
let start = 0
|
|
14822
|
-
const breaks = [start]
|
|
15073
|
+
let current = token;
|
|
15074
|
+
let adjust = 0;
|
|
15075
|
+
let start = 0;
|
|
15076
|
+
const breaks = [start];
|
|
14823
15077
|
|
|
14824
15078
|
// Loop forward through the linked tokens to pass them in order to the
|
|
14825
15079
|
// subtokenizer.
|
|
14826
15080
|
while (current) {
|
|
14827
15081
|
// Find the position of the event for this token.
|
|
14828
|
-
while (events
|
|
15082
|
+
while (events.get(++startPosition)[1] !== current) {
|
|
14829
15083
|
// Empty.
|
|
14830
15084
|
}
|
|
14831
|
-
startPositions.push(startPosition)
|
|
15085
|
+
startPositions.push(startPosition);
|
|
14832
15086
|
if (!current._tokenizer) {
|
|
14833
|
-
stream = context.sliceStream(current)
|
|
15087
|
+
stream = context.sliceStream(current);
|
|
14834
15088
|
if (!current.next) {
|
|
14835
|
-
stream.push(null)
|
|
15089
|
+
stream.push(null);
|
|
14836
15090
|
}
|
|
14837
15091
|
if (previous) {
|
|
14838
|
-
tokenizer.defineSkip(current.start)
|
|
15092
|
+
tokenizer.defineSkip(current.start);
|
|
14839
15093
|
}
|
|
14840
15094
|
if (current._isInFirstContentOfListItem) {
|
|
14841
|
-
tokenizer._gfmTasklistFirstContentOfListItem = true
|
|
15095
|
+
tokenizer._gfmTasklistFirstContentOfListItem = true;
|
|
14842
15096
|
}
|
|
14843
|
-
tokenizer.write(stream)
|
|
15097
|
+
tokenizer.write(stream);
|
|
14844
15098
|
if (current._isInFirstContentOfListItem) {
|
|
14845
|
-
tokenizer._gfmTasklistFirstContentOfListItem = undefined
|
|
15099
|
+
tokenizer._gfmTasklistFirstContentOfListItem = undefined;
|
|
14846
15100
|
}
|
|
14847
15101
|
}
|
|
14848
15102
|
|
|
14849
15103
|
// Unravel the next token.
|
|
14850
|
-
previous = current
|
|
14851
|
-
current = current.next
|
|
15104
|
+
previous = current;
|
|
15105
|
+
current = current.next;
|
|
14852
15106
|
}
|
|
14853
15107
|
|
|
14854
15108
|
// Now, loop back through all events (and linked tokens), to figure out which
|
|
14855
15109
|
// parts belong where.
|
|
14856
|
-
current = token
|
|
15110
|
+
current = token;
|
|
14857
15111
|
while (++index < childEvents.length) {
|
|
14858
15112
|
if (
|
|
14859
|
-
|
|
14860
|
-
|
|
14861
|
-
|
|
14862
|
-
|
|
14863
|
-
childEvents[index][1].start.line !== childEvents[index][1].end.line
|
|
14864
|
-
) {
|
|
14865
|
-
start = index + 1
|
|
14866
|
-
breaks.push(start)
|
|
15113
|
+
// Find a void token that includes a break.
|
|
15114
|
+
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) {
|
|
15115
|
+
start = index + 1;
|
|
15116
|
+
breaks.push(start);
|
|
14867
15117
|
// Help GC.
|
|
14868
|
-
current._tokenizer = undefined
|
|
14869
|
-
current.previous = undefined
|
|
14870
|
-
current = current.next
|
|
15118
|
+
current._tokenizer = undefined;
|
|
15119
|
+
current.previous = undefined;
|
|
15120
|
+
current = current.next;
|
|
14871
15121
|
}
|
|
14872
15122
|
}
|
|
14873
15123
|
|
|
14874
15124
|
// Help GC.
|
|
14875
|
-
tokenizer.events = []
|
|
15125
|
+
tokenizer.events = [];
|
|
14876
15126
|
|
|
14877
15127
|
// If there’s one more token (which is the cases for lines that end in an
|
|
14878
15128
|
// EOF), that’s perfect: the last point we found starts it.
|
|
14879
15129
|
// If there isn’t then make sure any remaining content is added to it.
|
|
14880
15130
|
if (current) {
|
|
14881
15131
|
// Help GC.
|
|
14882
|
-
current._tokenizer = undefined
|
|
14883
|
-
current.previous = undefined
|
|
15132
|
+
current._tokenizer = undefined;
|
|
15133
|
+
current.previous = undefined;
|
|
14884
15134
|
} else {
|
|
14885
|
-
breaks.pop()
|
|
15135
|
+
breaks.pop();
|
|
14886
15136
|
}
|
|
14887
15137
|
|
|
14888
15138
|
// Now splice the events from the subtokenizer into the current events,
|
|
14889
15139
|
// moving back to front so that splice indices aren’t affected.
|
|
14890
|
-
index = breaks.length
|
|
15140
|
+
index = breaks.length;
|
|
14891
15141
|
while (index--) {
|
|
14892
|
-
const slice = childEvents.slice(breaks[index], breaks[index + 1])
|
|
14893
|
-
const start = startPositions.pop()
|
|
14894
|
-
jumps.
|
|
14895
|
-
splice(
|
|
15142
|
+
const slice = childEvents.slice(breaks[index], breaks[index + 1]);
|
|
15143
|
+
const start = startPositions.pop();
|
|
15144
|
+
jumps.push([start, start + slice.length - 1]);
|
|
15145
|
+
events.splice(start, 2, slice);
|
|
14896
15146
|
}
|
|
14897
|
-
|
|
15147
|
+
jumps.reverse();
|
|
15148
|
+
index = -1;
|
|
14898
15149
|
while (++index < jumps.length) {
|
|
14899
|
-
gaps[adjust + jumps[index][0]] = adjust + jumps[index][1]
|
|
14900
|
-
adjust += jumps[index][1] - jumps[index][0] - 1
|
|
15150
|
+
gaps[adjust + jumps[index][0]] = adjust + jumps[index][1];
|
|
15151
|
+
adjust += jumps[index][1] - jumps[index][0] - 1;
|
|
14901
15152
|
}
|
|
14902
|
-
return gaps
|
|
15153
|
+
return gaps;
|
|
14903
15154
|
}
|
|
14904
|
-
|
|
14905
15155
|
;// ./node_modules/micromark/lib/postprocess.js
|
|
14906
15156
|
/**
|
|
14907
15157
|
* @typedef {import('micromark-util-types').Event} Event
|
|
@@ -74433,11 +74683,6 @@ const looseHtmlEntityConstruct = {
|
|
|
74433
74683
|
name: 'looseHtmlEntity',
|
|
74434
74684
|
tokenize: tokenizeLooseHtmlEntity,
|
|
74435
74685
|
};
|
|
74436
|
-
function resolveEntity(name) {
|
|
74437
|
-
const input = `&${name};`;
|
|
74438
|
-
const decoded = decode_decodeHTMLStrict(input);
|
|
74439
|
-
return decoded !== input ? decoded : undefined;
|
|
74440
|
-
}
|
|
74441
74686
|
function tokenizeLooseHtmlEntity(effects, ok, nok) {
|
|
74442
74687
|
let length = 0;
|
|
74443
74688
|
const start = (code) => {
|
|
@@ -74504,28 +74749,9 @@ function tokenizeLooseHtmlEntity(effects, ok, nok) {
|
|
|
74504
74749
|
}
|
|
74505
74750
|
function exitLooseHtmlEntity(token) {
|
|
74506
74751
|
const raw = this.sliceSerialize(token);
|
|
74507
|
-
|
|
74508
|
-
|
|
74509
|
-
|
|
74510
|
-
if (decoded) {
|
|
74511
|
-
this.enter({ type: 'text', value: decoded }, token);
|
|
74512
|
-
this.exit(token);
|
|
74513
|
-
return;
|
|
74514
|
-
}
|
|
74515
|
-
}
|
|
74516
|
-
else {
|
|
74517
|
-
for (let len = entityChars.length; len >= 2; len -= 1) {
|
|
74518
|
-
const candidate = entityChars.slice(0, len);
|
|
74519
|
-
const decoded = resolveEntity(candidate);
|
|
74520
|
-
if (decoded) {
|
|
74521
|
-
const remainder = entityChars.slice(len);
|
|
74522
|
-
this.enter({ type: 'text', value: decoded + remainder }, token);
|
|
74523
|
-
this.exit(token);
|
|
74524
|
-
return;
|
|
74525
|
-
}
|
|
74526
|
-
}
|
|
74527
|
-
}
|
|
74528
|
-
this.enter({ type: 'text', value: raw }, token);
|
|
74752
|
+
// `decodeHTML` follows the HTML spec's legacy rules, where only a small
|
|
74753
|
+
// whitelist of names may omit the semicolon, so `&partner_key` stays intact.
|
|
74754
|
+
this.enter({ type: 'text', value: esm_decode_decodeHTML(raw) }, token);
|
|
74529
74755
|
this.exit(token);
|
|
74530
74756
|
}
|
|
74531
74757
|
function looseHtmlEntity() {
|
|
@@ -74545,10 +74771,11 @@ function looseHtmlEntityFromMarkdown() {
|
|
|
74545
74771
|
/**
|
|
74546
74772
|
* Micromark extension for HTML entities without semicolons.
|
|
74547
74773
|
*
|
|
74548
|
-
* Handles named entities
|
|
74549
|
-
*
|
|
74550
|
-
* `&#
|
|
74551
|
-
* standard parser
|
|
74774
|
+
* Handles the named entities the HTML spec lets authors write without a
|
|
74775
|
+
* semicolon (e.g. ` `, `&`, `©`), decimal numeric references (e.g.
|
|
74776
|
+
* ` `, `©`), and hex numeric references (e.g. ` `, ` `).
|
|
74777
|
+
* Entities that already include the semicolon are left for the standard parser
|
|
74778
|
+
* to handle.
|
|
74552
74779
|
*/
|
|
74553
74780
|
|
|
74554
74781
|
|
|
@@ -93289,7 +93516,9 @@ class MdxSyntaxError extends SyntaxError {
|
|
|
93289
93516
|
* as `\r<br>`. Treating both characters as hard breaks doubles the spacing.
|
|
93290
93517
|
*/
|
|
93291
93518
|
const hardBreaks = () => tree => {
|
|
93292
|
-
|
|
93519
|
+
// Skip `html-block`: its opaque payload is rendered verbatim, so turning its newlines
|
|
93520
|
+
// into `break` nodes is unnecessary and costly on large blocks.
|
|
93521
|
+
findAndReplace(tree, [/\r?\n/g, () => ({ type: 'break' })], { ignore: ['html-block'] });
|
|
93293
93522
|
};
|
|
93294
93523
|
/* harmony default export */ const hard_breaks = (hardBreaks);
|
|
93295
93524
|
|
|
@@ -103758,6 +103987,10 @@ const NESTED_ATTR_EXPRESSION_RE = /[\w-]+\s*=\s*\{/;
|
|
|
103758
103987
|
// Name shape mirrors `componentTagPattern`; the lookbehind skips the inner tag
|
|
103759
103988
|
// of a legacy `<<VARIABLE>>`.
|
|
103760
103989
|
const NESTED_COMPONENT_TAG_RE = /(?<!<)<([A-Z][A-Za-z0-9_]*)[\s/>]/g;
|
|
103990
|
+
// Whole blank lines at a component body's edges. `\n` sits inside each group so a
|
|
103991
|
+
// match can only ever span complete lines, never part of a content line.
|
|
103992
|
+
const LEADING_BLANK_LINES_RE = /^(?:[ \t]*\n)+/;
|
|
103993
|
+
const TRAILING_BLANK_LINES_RE = /(?:\n[ \t]*)+$/;
|
|
103761
103994
|
// Excludes tags with dedicated transformers (`Table`, `HTMLBlock`, inline
|
|
103762
103995
|
// components), which expect their wrapper to stay raw.
|
|
103763
103996
|
const hasNestedGenericComponentTag = (content) => [...content.matchAll(NESTED_COMPONENT_TAG_RE)].some(match => !GENERIC_MDX_COMPONENT_EXCLUDED_TAGS.has(match[1]));
|
|
@@ -103791,13 +104024,21 @@ function safeDeindent(text) {
|
|
|
103791
104024
|
})
|
|
103792
104025
|
.join('\n');
|
|
103793
104026
|
}
|
|
104027
|
+
/**
|
|
104028
|
+
* Drop the blank lines at a component body's edges, keeping the first content line's
|
|
104029
|
+
* indent: `.trim()` stripped that line alone, so a uniformly indented body reparsed
|
|
104030
|
+
* lopsided and every list item after the first nested. The trailing pattern
|
|
104031
|
+
* takes the last content line's newline but leaves its spaces, which are code content
|
|
104032
|
+
* when a fence runs into the end tag.
|
|
104033
|
+
*/
|
|
104034
|
+
const trimBlankEdges = (text) => text.replace(LEADING_BLANK_LINES_RE, '').replace(TRAILING_BLANK_LINES_RE, '');
|
|
103794
104035
|
/**
|
|
103795
104036
|
* Parse component-body markdown into mdast children. Dedenting shifts columns and
|
|
103796
104037
|
* stales the top-level `terminateHtmlFlowBlocks` decisions, so that one preprocessor
|
|
103797
104038
|
* re-runs here; other column-anchored fixups (compact headings, tables) do not.
|
|
103798
104039
|
*/
|
|
103799
104040
|
const parseMdChildren = (value, safeMode) => {
|
|
103800
|
-
const reparseSource = terminateHtmlFlowBlocks(safeDeindent(value)
|
|
104041
|
+
const reparseSource = terminateHtmlFlowBlocks(trimBlankEdges(safeDeindent(value)));
|
|
103801
104042
|
const parsed = getInlineMdProcessor({ safeMode }).parse(reparseSource);
|
|
103802
104043
|
// Promote nested wrappers bottom-up so an outer wrapper sees markdown buried in a
|
|
103803
104044
|
// child claimed whole (e.g. `<li>` in `<ol>`) before its containsMarkdownConstruct check (RM-17560).
|
|
@@ -103962,7 +104203,8 @@ function promoteComponentBlocks(tree, safeMode, source) {
|
|
|
103962
104203
|
// Case 2: Self-contained block (closing tag in content)
|
|
103963
104204
|
const closingTagIndex = isPlainLowercaseHtml ? plainClosingTagIndex : contentAfterTag.lastIndexOf(closingTagStr);
|
|
103964
104205
|
if (closingTagIndex >= 0) {
|
|
103965
|
-
//
|
|
104206
|
+
// Left as authored: parseMdChildren needs the original columns to dedent by, and
|
|
104207
|
+
// it clears the blank edges itself.
|
|
103966
104208
|
const componentInnerContent = contentAfterTag.substring(0, closingTagIndex);
|
|
103967
104209
|
const contentAfterClose = contentAfterTag.substring(closingTagIndex + closingTagStr.length).trim();
|
|
103968
104210
|
let parsedChildren = [];
|
|
@@ -106328,9 +106570,9 @@ const resolveDeferredAttributeExpressionProps = () => (tree, file) => {
|
|
|
106328
106570
|
properties[name] = name === 'style' && style_object_to_css_isPlainObject(result) ? styleObjectToCssText(result) : result;
|
|
106329
106571
|
}
|
|
106330
106572
|
catch {
|
|
106331
|
-
// Evaluation failed —
|
|
106332
|
-
//
|
|
106333
|
-
properties[name] = source
|
|
106573
|
+
// Evaluation failed — keep the literal `{...}`, matching how `evaluateExpressions` falls
|
|
106574
|
+
// back in body text. Variable references like `{user.name}` stay resolvable at render time.
|
|
106575
|
+
properties[name] = `{${source}}`;
|
|
106334
106576
|
}
|
|
106335
106577
|
});
|
|
106336
106578
|
delete node.data.deferredExpressions;
|
|
@@ -107236,6 +107478,24 @@ const Contexts = ({ children, terms = [], variables = { user: {}, defaults: [] }
|
|
|
107236
107478
|
};
|
|
107237
107479
|
/* harmony default export */ const contexts = (Contexts);
|
|
107238
107480
|
|
|
107481
|
+
;// ./utils/user.ts
|
|
107482
|
+
const User = (variables) => {
|
|
107483
|
+
const { user = {}, defaults = [] } = variables || {};
|
|
107484
|
+
return new Proxy(user, {
|
|
107485
|
+
get(target, attribute) {
|
|
107486
|
+
if (typeof attribute === 'symbol') {
|
|
107487
|
+
return '';
|
|
107488
|
+
}
|
|
107489
|
+
if (attribute in target) {
|
|
107490
|
+
return target[attribute];
|
|
107491
|
+
}
|
|
107492
|
+
const def = defaults.find((d) => d.name === attribute);
|
|
107493
|
+
return def ? def.default : attribute.toUpperCase();
|
|
107494
|
+
},
|
|
107495
|
+
});
|
|
107496
|
+
};
|
|
107497
|
+
/* harmony default export */ const user = (User);
|
|
107498
|
+
|
|
107239
107499
|
;// ./lib/utils/makeUseMdxComponents.ts
|
|
107240
107500
|
|
|
107241
107501
|
|
|
@@ -107266,6 +107526,35 @@ const makeUseMDXComponents = (more = {}) => {
|
|
|
107266
107526
|
};
|
|
107267
107527
|
/* harmony default export */ const makeUseMdxComponents = (makeUseMDXComponents);
|
|
107268
107528
|
|
|
107529
|
+
;// ./lib/utils/mdxish/mdxish-variables.ts
|
|
107530
|
+
|
|
107531
|
+
// The `$` guard skips template-literal interpolation: `${user.name}` embeds `{user.name}`, and
|
|
107532
|
+
// substituting it would leave a mangled `` `Hi $Name` `` behind. Those belong to an expression,
|
|
107533
|
+
// which either evaluated already or is meant to stay literal.
|
|
107534
|
+
const MDX_VARIABLE_REGEX = new RegExp(`(?<!\\$)${variable_.MDX_VARIABLE_REGEXP}`, 'gu');
|
|
107535
|
+
// Bracket notation names the same variable as dot notation, so normalize it before substituting.
|
|
107536
|
+
// Escaped and `$`-prefixed forms are left alone so a reference that stays literal keeps its source.
|
|
107537
|
+
// A closing escape needs no lookahead: requiring a literal `]}` already rules out `]\}`.
|
|
107538
|
+
const BRACKET_NOTATION_REGEX = /(?<![$\\])\{user\[['"](\w+)['"]\]\}/gu;
|
|
107539
|
+
/**
|
|
107540
|
+
* Resolve `{user.*}` in a JSX attribute value against the same `user` binding the rmdx engine gets,
|
|
107541
|
+
* so both engines agree. Body text differs on empty values: `Variable` falls back to the default.
|
|
107542
|
+
*
|
|
107543
|
+
* Legacy `<<...>>` is valid inside a quoted attribute but deliberately left literal — attributes are
|
|
107544
|
+
* an MDX surface, and `{user.*}` is the syntax authors use there.
|
|
107545
|
+
*/
|
|
107546
|
+
function resolveAttributeVariables(value, user) {
|
|
107547
|
+
if (!value.includes('{user'))
|
|
107548
|
+
return value;
|
|
107549
|
+
return value
|
|
107550
|
+
.replace(BRACKET_NOTATION_REGEX, '{user.$1}')
|
|
107551
|
+
.replace(MDX_VARIABLE_REGEX, (source, escapePrefix, name, escapeSuffix) => {
|
|
107552
|
+
if (escapePrefix || escapeSuffix)
|
|
107553
|
+
return source;
|
|
107554
|
+
return user[name];
|
|
107555
|
+
});
|
|
107556
|
+
}
|
|
107557
|
+
|
|
107269
107558
|
;// ./lib/utils/mdxish/mdxish-render-utils.tsx
|
|
107270
107559
|
|
|
107271
107560
|
|
|
@@ -107274,6 +107563,8 @@ const makeUseMDXComponents = (more = {}) => {
|
|
|
107274
107563
|
|
|
107275
107564
|
|
|
107276
107565
|
|
|
107566
|
+
|
|
107567
|
+
|
|
107277
107568
|
/** Flatten CustomComponents into a component map for rehype-react */
|
|
107278
107569
|
function exportComponentsForRehype(components) {
|
|
107279
107570
|
const exported = Object.entries(components).reduce((memo, [tag, mod]) => {
|
|
@@ -107301,6 +107592,28 @@ function exportComponentsForRehype(components) {
|
|
|
107301
107592
|
result.variable = (variable_default());
|
|
107302
107593
|
return result;
|
|
107303
107594
|
}
|
|
107595
|
+
/**
|
|
107596
|
+
* Code rides on a `value` prop, and `variablesCodeResolver` owns it at parse time where it
|
|
107597
|
+
* deliberately leaves mermaid alone; resolving it again here would override that.
|
|
107598
|
+
*/
|
|
107599
|
+
const CODE_TAG_NAMES = new Set(['code']);
|
|
107600
|
+
/** Raw markup injected with `dangerouslySetInnerHTML` by HTMLBlock and Embed — never interpolate. */
|
|
107601
|
+
const RAW_HTML_PROP_NAMES = new Set(['html']);
|
|
107602
|
+
/**
|
|
107603
|
+
* Resolve `{user.*}` in string-valued props. Body text is handled by the `Variable` component, but
|
|
107604
|
+
* attributes are plain strings, so they are substituted here — at render time, so that a
|
|
107605
|
+
* server-parsed (user-agnostic) tree resolves against the current reader's variables.
|
|
107606
|
+
*/
|
|
107607
|
+
function resolveVariablesInProps(props, user, tagName) {
|
|
107608
|
+
const isCodeTag = Boolean(tagName && CODE_TAG_NAMES.has(tagName));
|
|
107609
|
+
const resolvedEntries = Object.entries(props).map(([key, value]) => {
|
|
107610
|
+
const isDocumentContent = RAW_HTML_PROP_NAMES.has(key) || (isCodeTag && key === 'value');
|
|
107611
|
+
if (typeof value !== 'string' || isDocumentContent)
|
|
107612
|
+
return [key, value];
|
|
107613
|
+
return [key, resolveAttributeVariables(value, user)];
|
|
107614
|
+
});
|
|
107615
|
+
return Object.fromEntries(resolvedEntries);
|
|
107616
|
+
}
|
|
107304
107617
|
/**
|
|
107305
107618
|
* Custom React.createElement wrapper that recovers real JS prop values for
|
|
107306
107619
|
* custom components. rehype-react v6 uses hast-to-hyperscript, which stringifies
|
|
@@ -107312,7 +107625,7 @@ function exportComponentsForRehype(components) {
|
|
|
107312
107625
|
* Only arrays win over `rest`, overwriting other shapes would undo correct
|
|
107313
107626
|
* React conversions like `style="color:red"` → `{ color: 'red' }`.
|
|
107314
107627
|
*/
|
|
107315
|
-
function createElementPreservingHastProps(type, props, ...children) {
|
|
107628
|
+
const makeCreateElementPreservingHastProps = (user) => function createElementPreservingHastProps(type, props, ...children) {
|
|
107316
107629
|
if (props?.node?.properties) {
|
|
107317
107630
|
const { node, ...rest } = props;
|
|
107318
107631
|
const mergedProps = { ...rest };
|
|
@@ -107322,15 +107635,16 @@ function createElementPreservingHastProps(type, props, ...children) {
|
|
|
107322
107635
|
});
|
|
107323
107636
|
// Strip undefined so positional args don't shadow node.properties.children
|
|
107324
107637
|
const definedChildren = children.filter(c => c !== undefined);
|
|
107325
|
-
|
|
107638
|
+
const withVariables = resolveVariablesInProps(mergedProps, user, node.tagName);
|
|
107639
|
+
return external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_default().createElement(type, withVariables, ...definedChildren);
|
|
107326
107640
|
}
|
|
107327
|
-
return external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_default().createElement(type, props, ...children);
|
|
107328
|
-
}
|
|
107641
|
+
return external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_default().createElement(type, props && resolveVariablesInProps(props, user), ...children);
|
|
107642
|
+
};
|
|
107329
107643
|
/** Create a rehype-react processor */
|
|
107330
|
-
function createRehypeReactProcessor(components) {
|
|
107644
|
+
function createRehypeReactProcessor(components, variables) {
|
|
107331
107645
|
// @ts-expect-error - rehype-react types are incompatible with React.Fragment return type
|
|
107332
107646
|
return unified().use((rehype_react_default()), {
|
|
107333
|
-
createElement:
|
|
107647
|
+
createElement: makeCreateElementPreservingHastProps(user(variables)),
|
|
107334
107648
|
Fragment: (external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_default()).Fragment,
|
|
107335
107649
|
components,
|
|
107336
107650
|
passNode: true,
|
|
@@ -107345,7 +107659,7 @@ function createTocComponent(tocHast) {
|
|
|
107345
107659
|
components: { p: (external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_default()).Fragment },
|
|
107346
107660
|
});
|
|
107347
107661
|
const tocReactElement = tocProcessor.stringify(tocHast);
|
|
107348
|
-
const TocComponent = () => tocReactElement ?
|
|
107662
|
+
const TocComponent = () => tocReactElement ? external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_default().createElement(components_TableOfContents, null, tocReactElement) : null;
|
|
107349
107663
|
TocComponent.displayName = 'Toc';
|
|
107350
107664
|
return TocComponent;
|
|
107351
107665
|
}
|
|
@@ -107394,7 +107708,7 @@ const renderMdxish = (tree, opts = {}) => {
|
|
|
107394
107708
|
Object.entries(localScope).forEach(([name, value]) => {
|
|
107395
107709
|
componentsForRehype[name] = value;
|
|
107396
107710
|
});
|
|
107397
|
-
const processor = createRehypeReactProcessor(componentsForRehype);
|
|
107711
|
+
const processor = createRehypeReactProcessor(componentsForRehype, variables);
|
|
107398
107712
|
const content = processor.stringify(tree);
|
|
107399
107713
|
const tocHast = headings.length > 0 ? tocToHast(headings, variables) : null;
|
|
107400
107714
|
return buildRMDXModule(content, headings, tocHast, { ...contextOpts, variables });
|
|
@@ -107450,24 +107764,6 @@ function runSync(code, options) {
|
|
|
107450
107764
|
// EXTERNAL MODULE: ./node_modules/react/jsx-runtime.js
|
|
107451
107765
|
var jsx_runtime = __webpack_require__(2467);
|
|
107452
107766
|
var jsx_runtime_namespaceObject = /*#__PURE__*/__webpack_require__.t(jsx_runtime, 2);
|
|
107453
|
-
;// ./utils/user.ts
|
|
107454
|
-
const User = (variables) => {
|
|
107455
|
-
const { user = {}, defaults = [] } = variables || {};
|
|
107456
|
-
return new Proxy(user, {
|
|
107457
|
-
get(target, attribute) {
|
|
107458
|
-
if (typeof attribute === 'symbol') {
|
|
107459
|
-
return '';
|
|
107460
|
-
}
|
|
107461
|
-
if (attribute in target) {
|
|
107462
|
-
return target[attribute];
|
|
107463
|
-
}
|
|
107464
|
-
const def = defaults.find((d) => d.name === attribute);
|
|
107465
|
-
return def ? def.default : attribute.toUpperCase();
|
|
107466
|
-
},
|
|
107467
|
-
});
|
|
107468
|
-
};
|
|
107469
|
-
/* harmony default export */ const user = (User);
|
|
107470
|
-
|
|
107471
107767
|
;// ./lib/run.tsx
|
|
107472
107768
|
|
|
107473
107769
|
|
|
@@ -107712,7 +108008,7 @@ async function stripComments(doc, { mdx, mdxish } = {}) {
|
|
|
107712
108008
|
|
|
107713
108009
|
|
|
107714
108010
|
|
|
107715
|
-
const
|
|
108011
|
+
const index_utils = {
|
|
107716
108012
|
get options() {
|
|
107717
108013
|
return { ...options };
|
|
107718
108014
|
},
|