@readme/markdown 15.9.4 → 15.10.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/components/Cards/index.tsx +6 -1
- package/components/Cards/style.scss +15 -0
- package/dist/index.d.ts +1 -1
- package/dist/lib/index.d.ts +1 -0
- package/dist/lib/mdast-util/heading-id/index.d.ts +3 -0
- package/dist/lib/mdxish.d.ts +2 -0
- package/dist/lib/mdxishHeadingIds.d.ts +4 -0
- package/dist/lib/micromark/heading-id/index.d.ts +1 -0
- package/dist/lib/micromark/heading-id/syntax.d.ts +10 -0
- package/dist/lib/micromark/mdxish-extensions.d.ts +13 -7
- package/dist/main.css +1 -1
- package/dist/main.css.map +1 -1
- package/dist/main.js +464 -195
- package/dist/main.node.js +464 -195
- package/dist/main.node.js.map +1 -1
- package/dist/processor/compile/heading.d.ts +5 -0
- package/dist/processor/transform/mdxish/heading-ids.d.ts +14 -0
- package/dist/processor/transform/mdxish/heading-slugs.d.ts +2 -1
- package/dist/processor/utils.d.ts +9 -1
- package/dist/render-fixture.css +1 -1
- package/dist/render-fixture.css.map +1 -1
- package/dist/render-fixture.node.js +471 -195
- package/dist/render-fixture.node.js.map +1 -1
- package/package.json +2 -1
package/dist/main.js
CHANGED
|
@@ -11423,7 +11423,7 @@ module.exports = function () {
|
|
|
11423
11423
|
|
|
11424
11424
|
/***/ },
|
|
11425
11425
|
|
|
11426
|
-
/***/
|
|
11426
|
+
/***/ 9477
|
|
11427
11427
|
(module, __webpack_exports__, __webpack_require__) {
|
|
11428
11428
|
|
|
11429
11429
|
"use strict";
|
|
@@ -11448,6 +11448,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
11448
11448
|
mdx: () => (/* reexport */ lib_mdx),
|
|
11449
11449
|
mdxish: () => (/* reexport */ lib_mdxish),
|
|
11450
11450
|
mdxishAstProcessor: () => (/* reexport */ mdxishAstProcessor),
|
|
11451
|
+
mdxishHeadingIds: () => (/* reexport */ mdxishHeadingIds),
|
|
11451
11452
|
mdxishMdastToMd: () => (/* reexport */ mdxishMdastToMd),
|
|
11452
11453
|
mdxishTags: () => (/* reexport */ mdxishTags),
|
|
11453
11454
|
migrate: () => (/* reexport */ lib_migrate),
|
|
@@ -11779,8 +11780,11 @@ const Card = ({ badge, children, href, kind = 'card', icon, iconColor, LinkCompo
|
|
|
11779
11780
|
href && external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_default().createElement("i", { "aria-hidden": "true", className: "Card-arrow fa-regular fa-arrow-right" }))),
|
|
11780
11781
|
children)));
|
|
11781
11782
|
};
|
|
11783
|
+
// max() can't take keyword widths like auto or min-content, so only wrap a length or a math expression
|
|
11784
|
+
const canWrapColumns = (columns, cardWidth) => Number(columns) > 0 && /^(\.?\d|(calc|min|max|clamp)\()/.test(cardWidth);
|
|
11782
11785
|
const CardsGrid = ({ cardWidth = '200px', columns = 'auto-fit', children }) => {
|
|
11783
|
-
|
|
11786
|
+
const className = canWrapColumns(columns, cardWidth) ? 'CardsGrid CardsGrid_wrap' : 'CardsGrid';
|
|
11787
|
+
return (external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_default().createElement("div", { className: className, style: { '--CardsGrid-cardWidth': cardWidth, '--CardsGrid-columns': columns } }, children));
|
|
11784
11788
|
};
|
|
11785
11789
|
/* harmony default export */ const Cards = (CardsGrid);
|
|
11786
11790
|
|
|
@@ -54835,6 +54839,209 @@ const mdast = (text, opts = {}) => {
|
|
|
54835
54839
|
};
|
|
54836
54840
|
/* harmony default export */ const lib_mdast = (mdast);
|
|
54837
54841
|
|
|
54842
|
+
;// ./node_modules/micromark-util-symbol/lib/codes.js
|
|
54843
|
+
/**
|
|
54844
|
+
* Character codes.
|
|
54845
|
+
*
|
|
54846
|
+
* This module is compiled away!
|
|
54847
|
+
*
|
|
54848
|
+
* micromark works based on character codes.
|
|
54849
|
+
* This module contains constants for the ASCII block and the replacement
|
|
54850
|
+
* character.
|
|
54851
|
+
* A couple of them are handled in a special way, such as the line endings
|
|
54852
|
+
* (CR, LF, and CR+LF, commonly known as end-of-line: EOLs), the tab (horizontal
|
|
54853
|
+
* tab) and its expansion based on what column it’s at (virtual space),
|
|
54854
|
+
* and the end-of-file (eof) character.
|
|
54855
|
+
* As values are preprocessed before handling them, the actual characters LF,
|
|
54856
|
+
* CR, HT, and NUL (which is present as the replacement character), are
|
|
54857
|
+
* guaranteed to not exist.
|
|
54858
|
+
*
|
|
54859
|
+
* Unicode basic latin block.
|
|
54860
|
+
*/
|
|
54861
|
+
const codes = /** @type {const} */ ({
|
|
54862
|
+
carriageReturn: -5,
|
|
54863
|
+
lineFeed: -4,
|
|
54864
|
+
carriageReturnLineFeed: -3,
|
|
54865
|
+
horizontalTab: -2,
|
|
54866
|
+
virtualSpace: -1,
|
|
54867
|
+
eof: null,
|
|
54868
|
+
nul: 0,
|
|
54869
|
+
soh: 1,
|
|
54870
|
+
stx: 2,
|
|
54871
|
+
etx: 3,
|
|
54872
|
+
eot: 4,
|
|
54873
|
+
enq: 5,
|
|
54874
|
+
ack: 6,
|
|
54875
|
+
bel: 7,
|
|
54876
|
+
bs: 8,
|
|
54877
|
+
ht: 9, // `\t`
|
|
54878
|
+
lf: 10, // `\n`
|
|
54879
|
+
vt: 11, // `\v`
|
|
54880
|
+
ff: 12, // `\f`
|
|
54881
|
+
cr: 13, // `\r`
|
|
54882
|
+
so: 14,
|
|
54883
|
+
si: 15,
|
|
54884
|
+
dle: 16,
|
|
54885
|
+
dc1: 17,
|
|
54886
|
+
dc2: 18,
|
|
54887
|
+
dc3: 19,
|
|
54888
|
+
dc4: 20,
|
|
54889
|
+
nak: 21,
|
|
54890
|
+
syn: 22,
|
|
54891
|
+
etb: 23,
|
|
54892
|
+
can: 24,
|
|
54893
|
+
em: 25,
|
|
54894
|
+
sub: 26,
|
|
54895
|
+
esc: 27,
|
|
54896
|
+
fs: 28,
|
|
54897
|
+
gs: 29,
|
|
54898
|
+
rs: 30,
|
|
54899
|
+
us: 31,
|
|
54900
|
+
space: 32,
|
|
54901
|
+
exclamationMark: 33, // `!`
|
|
54902
|
+
quotationMark: 34, // `"`
|
|
54903
|
+
numberSign: 35, // `#`
|
|
54904
|
+
dollarSign: 36, // `$`
|
|
54905
|
+
percentSign: 37, // `%`
|
|
54906
|
+
ampersand: 38, // `&`
|
|
54907
|
+
apostrophe: 39, // `'`
|
|
54908
|
+
leftParenthesis: 40, // `(`
|
|
54909
|
+
rightParenthesis: 41, // `)`
|
|
54910
|
+
asterisk: 42, // `*`
|
|
54911
|
+
plusSign: 43, // `+`
|
|
54912
|
+
comma: 44, // `,`
|
|
54913
|
+
dash: 45, // `-`
|
|
54914
|
+
dot: 46, // `.`
|
|
54915
|
+
slash: 47, // `/`
|
|
54916
|
+
digit0: 48, // `0`
|
|
54917
|
+
digit1: 49, // `1`
|
|
54918
|
+
digit2: 50, // `2`
|
|
54919
|
+
digit3: 51, // `3`
|
|
54920
|
+
digit4: 52, // `4`
|
|
54921
|
+
digit5: 53, // `5`
|
|
54922
|
+
digit6: 54, // `6`
|
|
54923
|
+
digit7: 55, // `7`
|
|
54924
|
+
digit8: 56, // `8`
|
|
54925
|
+
digit9: 57, // `9`
|
|
54926
|
+
colon: 58, // `:`
|
|
54927
|
+
semicolon: 59, // `;`
|
|
54928
|
+
lessThan: 60, // `<`
|
|
54929
|
+
equalsTo: 61, // `=`
|
|
54930
|
+
greaterThan: 62, // `>`
|
|
54931
|
+
questionMark: 63, // `?`
|
|
54932
|
+
atSign: 64, // `@`
|
|
54933
|
+
uppercaseA: 65, // `A`
|
|
54934
|
+
uppercaseB: 66, // `B`
|
|
54935
|
+
uppercaseC: 67, // `C`
|
|
54936
|
+
uppercaseD: 68, // `D`
|
|
54937
|
+
uppercaseE: 69, // `E`
|
|
54938
|
+
uppercaseF: 70, // `F`
|
|
54939
|
+
uppercaseG: 71, // `G`
|
|
54940
|
+
uppercaseH: 72, // `H`
|
|
54941
|
+
uppercaseI: 73, // `I`
|
|
54942
|
+
uppercaseJ: 74, // `J`
|
|
54943
|
+
uppercaseK: 75, // `K`
|
|
54944
|
+
uppercaseL: 76, // `L`
|
|
54945
|
+
uppercaseM: 77, // `M`
|
|
54946
|
+
uppercaseN: 78, // `N`
|
|
54947
|
+
uppercaseO: 79, // `O`
|
|
54948
|
+
uppercaseP: 80, // `P`
|
|
54949
|
+
uppercaseQ: 81, // `Q`
|
|
54950
|
+
uppercaseR: 82, // `R`
|
|
54951
|
+
uppercaseS: 83, // `S`
|
|
54952
|
+
uppercaseT: 84, // `T`
|
|
54953
|
+
uppercaseU: 85, // `U`
|
|
54954
|
+
uppercaseV: 86, // `V`
|
|
54955
|
+
uppercaseW: 87, // `W`
|
|
54956
|
+
uppercaseX: 88, // `X`
|
|
54957
|
+
uppercaseY: 89, // `Y`
|
|
54958
|
+
uppercaseZ: 90, // `Z`
|
|
54959
|
+
leftSquareBracket: 91, // `[`
|
|
54960
|
+
backslash: 92, // `\`
|
|
54961
|
+
rightSquareBracket: 93, // `]`
|
|
54962
|
+
caret: 94, // `^`
|
|
54963
|
+
underscore: 95, // `_`
|
|
54964
|
+
graveAccent: 96, // `` ` ``
|
|
54965
|
+
lowercaseA: 97, // `a`
|
|
54966
|
+
lowercaseB: 98, // `b`
|
|
54967
|
+
lowercaseC: 99, // `c`
|
|
54968
|
+
lowercaseD: 100, // `d`
|
|
54969
|
+
lowercaseE: 101, // `e`
|
|
54970
|
+
lowercaseF: 102, // `f`
|
|
54971
|
+
lowercaseG: 103, // `g`
|
|
54972
|
+
lowercaseH: 104, // `h`
|
|
54973
|
+
lowercaseI: 105, // `i`
|
|
54974
|
+
lowercaseJ: 106, // `j`
|
|
54975
|
+
lowercaseK: 107, // `k`
|
|
54976
|
+
lowercaseL: 108, // `l`
|
|
54977
|
+
lowercaseM: 109, // `m`
|
|
54978
|
+
lowercaseN: 110, // `n`
|
|
54979
|
+
lowercaseO: 111, // `o`
|
|
54980
|
+
lowercaseP: 112, // `p`
|
|
54981
|
+
lowercaseQ: 113, // `q`
|
|
54982
|
+
lowercaseR: 114, // `r`
|
|
54983
|
+
lowercaseS: 115, // `s`
|
|
54984
|
+
lowercaseT: 116, // `t`
|
|
54985
|
+
lowercaseU: 117, // `u`
|
|
54986
|
+
lowercaseV: 118, // `v`
|
|
54987
|
+
lowercaseW: 119, // `w`
|
|
54988
|
+
lowercaseX: 120, // `x`
|
|
54989
|
+
lowercaseY: 121, // `y`
|
|
54990
|
+
lowercaseZ: 122, // `z`
|
|
54991
|
+
leftCurlyBrace: 123, // `{`
|
|
54992
|
+
verticalBar: 124, // `|`
|
|
54993
|
+
rightCurlyBrace: 125, // `}`
|
|
54994
|
+
tilde: 126, // `~`
|
|
54995
|
+
del: 127,
|
|
54996
|
+
// Unicode Specials block.
|
|
54997
|
+
byteOrderMarker: 65_279,
|
|
54998
|
+
// Unicode Specials block.
|
|
54999
|
+
replacementCharacter: 65_533 // `�`
|
|
55000
|
+
})
|
|
55001
|
+
|
|
55002
|
+
;// ./lib/micromark/heading-id/syntax.ts
|
|
55003
|
+
|
|
55004
|
+
|
|
55005
|
+
/** One character a `{#id}` heading id may use: the ones github-slugger keeps, plus `.` and `:`. */
|
|
55006
|
+
const HEADING_ID_CHAR = '[\\p{L}\\p{M}\\p{N}_.:-]';
|
|
55007
|
+
const ID_CLOSE_REGEX = new RegExp(`^${HEADING_ID_CHAR}+\\}$`, 'u');
|
|
55008
|
+
const typeAt = (events, index) => events[index]?.[1].type;
|
|
55009
|
+
function isIdToken(events, index, context, type, value) {
|
|
55010
|
+
return typeAt(events, index) === type && value.test(context.sliceSerialize(events[index][1]));
|
|
55011
|
+
}
|
|
55012
|
+
/** The exit index of the heading's last content token, past any trailing space and closing `##`. */
|
|
55013
|
+
function contentEnd(events) {
|
|
55014
|
+
let end = events.length - 2;
|
|
55015
|
+
if (typeAt(events, end) === 'whitespace')
|
|
55016
|
+
end -= 2;
|
|
55017
|
+
if (typeAt(events, end) === 'atxHeadingSequence' && typeAt(events, end - 2) === 'whitespace')
|
|
55018
|
+
end -= 4;
|
|
55019
|
+
return end;
|
|
55020
|
+
}
|
|
55021
|
+
const resolveHeadingId = (events, context) => {
|
|
55022
|
+
// Each token is an enter and an exit event; these indexes point at the exits.
|
|
55023
|
+
const close = contentEnd(events);
|
|
55024
|
+
const hash = close - 2;
|
|
55025
|
+
const open = close - 4;
|
|
55026
|
+
const space = close - 6;
|
|
55027
|
+
const endsWithId = isIdToken(events, close, context, 'atxHeadingText', ID_CLOSE_REGEX) &&
|
|
55028
|
+
isIdToken(events, hash, context, 'atxHeadingSequence', /^#$/) &&
|
|
55029
|
+
isIdToken(events, open, context, 'atxHeadingText', /^\{$/) &&
|
|
55030
|
+
typeAt(events, space) === 'whitespace';
|
|
55031
|
+
if (!endsWithId)
|
|
55032
|
+
return headingAtx.resolve?.(events, context) ?? events;
|
|
55033
|
+
const id = { type: 'headingId', start: events[open][1].start, end: events[close][1].end };
|
|
55034
|
+
events.splice(space - 1, close - space + 2);
|
|
55035
|
+
const resolved = headingAtx.resolve?.(events, context) ?? events;
|
|
55036
|
+
resolved.splice(resolved.length - 1, 0, ['enter', id, context], ['exit', id, context]);
|
|
55037
|
+
return resolved;
|
|
55038
|
+
};
|
|
55039
|
+
const headingIdConstruct = { ...headingAtx, resolve: resolveHeadingId };
|
|
55040
|
+
/** The ATX heading construct, with a line-final ` {#id}` split off as a `headingId` token. */
|
|
55041
|
+
function headingId() {
|
|
55042
|
+
return { flow: { [codes.numberSign]: headingIdConstruct } };
|
|
55043
|
+
}
|
|
55044
|
+
|
|
54838
55045
|
;// ./lib/utils/jsx-acorn-parser.ts
|
|
54839
55046
|
|
|
54840
55047
|
|
|
@@ -54946,6 +55153,7 @@ const evaluateLiteralExpression = (source) => {
|
|
|
54946
55153
|
|
|
54947
55154
|
|
|
54948
55155
|
|
|
55156
|
+
|
|
54949
55157
|
/**
|
|
54950
55158
|
* Evaluate a JavaScript expression source and return its value.
|
|
54951
55159
|
*
|
|
@@ -55062,6 +55270,24 @@ const getHPropKeys = (node) => {
|
|
|
55062
55270
|
const hProps = getHProps(node);
|
|
55063
55271
|
return Object.keys(hProps) || [];
|
|
55064
55272
|
};
|
|
55273
|
+
/** Turn a non-renderable evaluation result into a text node. */
|
|
55274
|
+
const createTextNode = (result, position) => {
|
|
55275
|
+
if (result === null || result === undefined)
|
|
55276
|
+
return { type: 'text', value: '', position };
|
|
55277
|
+
if (typeof result === 'object')
|
|
55278
|
+
return { type: 'text', value: JSON.stringify(result), position };
|
|
55279
|
+
return { type: 'text', value: String(result), position };
|
|
55280
|
+
};
|
|
55281
|
+
const HEADING_ID_REGEX = new RegExp(`^${HEADING_ID_CHAR}+$`, 'u');
|
|
55282
|
+
/**
|
|
55283
|
+
* The id a heading's trailing `{#id}` set, when it is one the `{#id}` syntax can spell.
|
|
55284
|
+
*
|
|
55285
|
+
* Ids may use letters, numbers, `-`, `_`, `.` and `:`; anything else, like `x y`, is dropped.
|
|
55286
|
+
*/
|
|
55287
|
+
const explicitHeadingId = (node) => {
|
|
55288
|
+
const id = node.data?.hProperties?.id;
|
|
55289
|
+
return typeof id === 'string' && HEADING_ID_REGEX.test(id) ? id : undefined;
|
|
55290
|
+
};
|
|
55065
55291
|
/**
|
|
55066
55292
|
* Gets the attributes of an MDX element and returns them as an object of hProperties.
|
|
55067
55293
|
*
|
|
@@ -73197,6 +73423,17 @@ function gemojiFromMarkdown() {
|
|
|
73197
73423
|
};
|
|
73198
73424
|
}
|
|
73199
73425
|
|
|
73426
|
+
;// ./lib/mdast-util/heading-id/index.ts
|
|
73427
|
+
function exitHeadingId(token) {
|
|
73428
|
+
const heading = this.stack[this.stack.length - 1];
|
|
73429
|
+
const id = this.sliceSerialize(token).slice('{#'.length, -'}'.length);
|
|
73430
|
+
heading.data = { ...heading.data, hProperties: { ...heading.data?.hProperties, id } };
|
|
73431
|
+
}
|
|
73432
|
+
/** Sets a heading's id from its `headingId` token. */
|
|
73433
|
+
function headingIdFromMarkdown() {
|
|
73434
|
+
return { exit: { headingId: exitHeadingId } };
|
|
73435
|
+
}
|
|
73436
|
+
|
|
73200
73437
|
;// ./lib/mdast-util/html-block-component/index.ts
|
|
73201
73438
|
const contextMap = new WeakMap();
|
|
73202
73439
|
function findHtmlBlockComponentToken() {
|
|
@@ -73575,166 +73812,6 @@ function mdxComponentFromMarkdown() {
|
|
|
73575
73812
|
};
|
|
73576
73813
|
}
|
|
73577
73814
|
|
|
73578
|
-
;// ./node_modules/micromark-util-symbol/lib/codes.js
|
|
73579
|
-
/**
|
|
73580
|
-
* Character codes.
|
|
73581
|
-
*
|
|
73582
|
-
* This module is compiled away!
|
|
73583
|
-
*
|
|
73584
|
-
* micromark works based on character codes.
|
|
73585
|
-
* This module contains constants for the ASCII block and the replacement
|
|
73586
|
-
* character.
|
|
73587
|
-
* A couple of them are handled in a special way, such as the line endings
|
|
73588
|
-
* (CR, LF, and CR+LF, commonly known as end-of-line: EOLs), the tab (horizontal
|
|
73589
|
-
* tab) and its expansion based on what column it’s at (virtual space),
|
|
73590
|
-
* and the end-of-file (eof) character.
|
|
73591
|
-
* As values are preprocessed before handling them, the actual characters LF,
|
|
73592
|
-
* CR, HT, and NUL (which is present as the replacement character), are
|
|
73593
|
-
* guaranteed to not exist.
|
|
73594
|
-
*
|
|
73595
|
-
* Unicode basic latin block.
|
|
73596
|
-
*/
|
|
73597
|
-
const codes = /** @type {const} */ ({
|
|
73598
|
-
carriageReturn: -5,
|
|
73599
|
-
lineFeed: -4,
|
|
73600
|
-
carriageReturnLineFeed: -3,
|
|
73601
|
-
horizontalTab: -2,
|
|
73602
|
-
virtualSpace: -1,
|
|
73603
|
-
eof: null,
|
|
73604
|
-
nul: 0,
|
|
73605
|
-
soh: 1,
|
|
73606
|
-
stx: 2,
|
|
73607
|
-
etx: 3,
|
|
73608
|
-
eot: 4,
|
|
73609
|
-
enq: 5,
|
|
73610
|
-
ack: 6,
|
|
73611
|
-
bel: 7,
|
|
73612
|
-
bs: 8,
|
|
73613
|
-
ht: 9, // `\t`
|
|
73614
|
-
lf: 10, // `\n`
|
|
73615
|
-
vt: 11, // `\v`
|
|
73616
|
-
ff: 12, // `\f`
|
|
73617
|
-
cr: 13, // `\r`
|
|
73618
|
-
so: 14,
|
|
73619
|
-
si: 15,
|
|
73620
|
-
dle: 16,
|
|
73621
|
-
dc1: 17,
|
|
73622
|
-
dc2: 18,
|
|
73623
|
-
dc3: 19,
|
|
73624
|
-
dc4: 20,
|
|
73625
|
-
nak: 21,
|
|
73626
|
-
syn: 22,
|
|
73627
|
-
etb: 23,
|
|
73628
|
-
can: 24,
|
|
73629
|
-
em: 25,
|
|
73630
|
-
sub: 26,
|
|
73631
|
-
esc: 27,
|
|
73632
|
-
fs: 28,
|
|
73633
|
-
gs: 29,
|
|
73634
|
-
rs: 30,
|
|
73635
|
-
us: 31,
|
|
73636
|
-
space: 32,
|
|
73637
|
-
exclamationMark: 33, // `!`
|
|
73638
|
-
quotationMark: 34, // `"`
|
|
73639
|
-
numberSign: 35, // `#`
|
|
73640
|
-
dollarSign: 36, // `$`
|
|
73641
|
-
percentSign: 37, // `%`
|
|
73642
|
-
ampersand: 38, // `&`
|
|
73643
|
-
apostrophe: 39, // `'`
|
|
73644
|
-
leftParenthesis: 40, // `(`
|
|
73645
|
-
rightParenthesis: 41, // `)`
|
|
73646
|
-
asterisk: 42, // `*`
|
|
73647
|
-
plusSign: 43, // `+`
|
|
73648
|
-
comma: 44, // `,`
|
|
73649
|
-
dash: 45, // `-`
|
|
73650
|
-
dot: 46, // `.`
|
|
73651
|
-
slash: 47, // `/`
|
|
73652
|
-
digit0: 48, // `0`
|
|
73653
|
-
digit1: 49, // `1`
|
|
73654
|
-
digit2: 50, // `2`
|
|
73655
|
-
digit3: 51, // `3`
|
|
73656
|
-
digit4: 52, // `4`
|
|
73657
|
-
digit5: 53, // `5`
|
|
73658
|
-
digit6: 54, // `6`
|
|
73659
|
-
digit7: 55, // `7`
|
|
73660
|
-
digit8: 56, // `8`
|
|
73661
|
-
digit9: 57, // `9`
|
|
73662
|
-
colon: 58, // `:`
|
|
73663
|
-
semicolon: 59, // `;`
|
|
73664
|
-
lessThan: 60, // `<`
|
|
73665
|
-
equalsTo: 61, // `=`
|
|
73666
|
-
greaterThan: 62, // `>`
|
|
73667
|
-
questionMark: 63, // `?`
|
|
73668
|
-
atSign: 64, // `@`
|
|
73669
|
-
uppercaseA: 65, // `A`
|
|
73670
|
-
uppercaseB: 66, // `B`
|
|
73671
|
-
uppercaseC: 67, // `C`
|
|
73672
|
-
uppercaseD: 68, // `D`
|
|
73673
|
-
uppercaseE: 69, // `E`
|
|
73674
|
-
uppercaseF: 70, // `F`
|
|
73675
|
-
uppercaseG: 71, // `G`
|
|
73676
|
-
uppercaseH: 72, // `H`
|
|
73677
|
-
uppercaseI: 73, // `I`
|
|
73678
|
-
uppercaseJ: 74, // `J`
|
|
73679
|
-
uppercaseK: 75, // `K`
|
|
73680
|
-
uppercaseL: 76, // `L`
|
|
73681
|
-
uppercaseM: 77, // `M`
|
|
73682
|
-
uppercaseN: 78, // `N`
|
|
73683
|
-
uppercaseO: 79, // `O`
|
|
73684
|
-
uppercaseP: 80, // `P`
|
|
73685
|
-
uppercaseQ: 81, // `Q`
|
|
73686
|
-
uppercaseR: 82, // `R`
|
|
73687
|
-
uppercaseS: 83, // `S`
|
|
73688
|
-
uppercaseT: 84, // `T`
|
|
73689
|
-
uppercaseU: 85, // `U`
|
|
73690
|
-
uppercaseV: 86, // `V`
|
|
73691
|
-
uppercaseW: 87, // `W`
|
|
73692
|
-
uppercaseX: 88, // `X`
|
|
73693
|
-
uppercaseY: 89, // `Y`
|
|
73694
|
-
uppercaseZ: 90, // `Z`
|
|
73695
|
-
leftSquareBracket: 91, // `[`
|
|
73696
|
-
backslash: 92, // `\`
|
|
73697
|
-
rightSquareBracket: 93, // `]`
|
|
73698
|
-
caret: 94, // `^`
|
|
73699
|
-
underscore: 95, // `_`
|
|
73700
|
-
graveAccent: 96, // `` ` ``
|
|
73701
|
-
lowercaseA: 97, // `a`
|
|
73702
|
-
lowercaseB: 98, // `b`
|
|
73703
|
-
lowercaseC: 99, // `c`
|
|
73704
|
-
lowercaseD: 100, // `d`
|
|
73705
|
-
lowercaseE: 101, // `e`
|
|
73706
|
-
lowercaseF: 102, // `f`
|
|
73707
|
-
lowercaseG: 103, // `g`
|
|
73708
|
-
lowercaseH: 104, // `h`
|
|
73709
|
-
lowercaseI: 105, // `i`
|
|
73710
|
-
lowercaseJ: 106, // `j`
|
|
73711
|
-
lowercaseK: 107, // `k`
|
|
73712
|
-
lowercaseL: 108, // `l`
|
|
73713
|
-
lowercaseM: 109, // `m`
|
|
73714
|
-
lowercaseN: 110, // `n`
|
|
73715
|
-
lowercaseO: 111, // `o`
|
|
73716
|
-
lowercaseP: 112, // `p`
|
|
73717
|
-
lowercaseQ: 113, // `q`
|
|
73718
|
-
lowercaseR: 114, // `r`
|
|
73719
|
-
lowercaseS: 115, // `s`
|
|
73720
|
-
lowercaseT: 116, // `t`
|
|
73721
|
-
lowercaseU: 117, // `u`
|
|
73722
|
-
lowercaseV: 118, // `v`
|
|
73723
|
-
lowercaseW: 119, // `w`
|
|
73724
|
-
lowercaseX: 120, // `x`
|
|
73725
|
-
lowercaseY: 121, // `y`
|
|
73726
|
-
lowercaseZ: 122, // `z`
|
|
73727
|
-
leftCurlyBrace: 123, // `{`
|
|
73728
|
-
verticalBar: 124, // `|`
|
|
73729
|
-
rightCurlyBrace: 125, // `}`
|
|
73730
|
-
tilde: 126, // `~`
|
|
73731
|
-
del: 127,
|
|
73732
|
-
// Unicode Specials block.
|
|
73733
|
-
byteOrderMarker: 65_279,
|
|
73734
|
-
// Unicode Specials block.
|
|
73735
|
-
replacementCharacter: 65_533 // `�`
|
|
73736
|
-
})
|
|
73737
|
-
|
|
73738
73815
|
;// ./lib/micromark/gemoji/syntax.ts
|
|
73739
73816
|
|
|
73740
73817
|
// Matches the name pattern from the original regex: \+1 or [-\w]+
|
|
@@ -73822,6 +73899,9 @@ function syntax_gemoji() {
|
|
|
73822
73899
|
};
|
|
73823
73900
|
}
|
|
73824
73901
|
|
|
73902
|
+
;// ./lib/micromark/heading-id/index.ts
|
|
73903
|
+
|
|
73904
|
+
|
|
73825
73905
|
;// ./node_modules/micromark-util-symbol/lib/types.js
|
|
73826
73906
|
/**
|
|
73827
73907
|
* This module is compiled away!
|
|
@@ -77271,6 +77351,8 @@ function mdxExpressionLenient() {
|
|
|
77271
77351
|
|
|
77272
77352
|
|
|
77273
77353
|
|
|
77354
|
+
|
|
77355
|
+
|
|
77274
77356
|
|
|
77275
77357
|
|
|
77276
77358
|
|
|
@@ -77310,6 +77392,8 @@ const REGISTRY = {
|
|
|
77310
77392
|
mdxComponent: { syntax: mdxComponent, fromMarkdown: mdxComponentFromMarkdown },
|
|
77311
77393
|
gemoji: { syntax: syntax_gemoji, fromMarkdown: gemojiFromMarkdown },
|
|
77312
77394
|
legacyVariable: { syntax: legacyVariable, fromMarkdown: legacyVariableFromMarkdown },
|
|
77395
|
+
// Replaces the ATX heading construct in `flow`, so it never touches prose outside a heading.
|
|
77396
|
+
headingId: { syntax: headingId, fromMarkdown: headingIdFromMarkdown },
|
|
77313
77397
|
looseHtmlEntity: { syntax: looseHtmlEntity, fromMarkdown: looseHtmlEntityFromMarkdown },
|
|
77314
77398
|
htmlBlockComponent: { syntax: htmlBlockComponent, fromMarkdown: htmlBlockComponentFromMarkdown },
|
|
77315
77399
|
// This is for in-document variable & function definitions
|
|
@@ -77340,18 +77424,13 @@ const EXPRESSIONS = ['jsxComment', 'mdxExpressionLenient', 'mdxjsEsm'];
|
|
|
77340
77424
|
*/
|
|
77341
77425
|
const FEATURES = {
|
|
77342
77426
|
/** `lib/mdxish.ts` — the document parser; the only site taking every group */
|
|
77343
|
-
document: [...BLOCK_CLAIMS, ...INLINE, ...EXPRESSIONS, 'emptyTaskListItem'],
|
|
77427
|
+
document: [...BLOCK_CLAIMS, ...INLINE, ...EXPRESSIONS, 'emptyTaskListItem', 'headingId'],
|
|
77344
77428
|
/**
|
|
77345
77429
|
* `components/utils.ts` — re-parses a component body, which should tokenize
|
|
77346
77430
|
* like the document around it: when the two drifted a `<Table>` in a
|
|
77347
77431
|
* `<Callout>` lost every row (CX-3705).
|
|
77348
77432
|
*/
|
|
77349
|
-
componentBody: [
|
|
77350
|
-
...BLOCK_CLAIMS,
|
|
77351
|
-
...INLINE,
|
|
77352
|
-
'mdxExpression',
|
|
77353
|
-
'emptyTaskListItem',
|
|
77354
|
-
],
|
|
77433
|
+
componentBody: [...BLOCK_CLAIMS, ...INLINE, 'mdxExpression', 'emptyTaskListItem', 'headingId'],
|
|
77355
77434
|
/**
|
|
77356
77435
|
* `lib/mdxishTags.ts` — collects component names, so nothing inline is needed.
|
|
77357
77436
|
* Omits `htmlBlockComponent` deliberately since it's not a custom component,
|
|
@@ -101975,6 +102054,18 @@ const embed_embed = (node) => {
|
|
|
101975
102054
|
};
|
|
101976
102055
|
/* harmony default export */ const compile_embed = (embed_embed);
|
|
101977
102056
|
|
|
102057
|
+
;// ./processor/compile/heading.ts
|
|
102058
|
+
|
|
102059
|
+
|
|
102060
|
+
const SETEXT_UNDERLINE_REGEX = /\n(?:=+|-+)$/;
|
|
102061
|
+
/** Writes an explicit heading id back as ` {#id}`. A setext heading, written for a line break, can't carry one. */
|
|
102062
|
+
const compile_heading_heading = ((node, parent, state, info) => {
|
|
102063
|
+
const markdown = handle.heading(node, parent, state, info);
|
|
102064
|
+
const id = explicitHeadingId(node);
|
|
102065
|
+
return id && !SETEXT_UNDERLINE_REGEX.test(markdown) ? `${markdown} {#${id}}` : markdown;
|
|
102066
|
+
});
|
|
102067
|
+
/* harmony default export */ const compile_heading = (compile_heading_heading);
|
|
102068
|
+
|
|
101978
102069
|
;// ./processor/compile/html-block.ts
|
|
101979
102070
|
|
|
101980
102071
|
const htmlBlock = (node) => {
|
|
@@ -102120,6 +102211,7 @@ const mdxishText = (node, parent, state, info) => compile_text_text(node, parent
|
|
|
102120
102211
|
|
|
102121
102212
|
|
|
102122
102213
|
|
|
102214
|
+
|
|
102123
102215
|
function compilers(mdxish = false) {
|
|
102124
102216
|
const data = this.data();
|
|
102125
102217
|
const toMarkdownExtensions = data.toMarkdownExtensions || (data.toMarkdownExtensions = []);
|
|
@@ -102140,6 +102232,7 @@ function compilers(mdxish = false) {
|
|
|
102140
102232
|
text: compile_text_text,
|
|
102141
102233
|
yaml: compile_compatibility,
|
|
102142
102234
|
// needed only for mdxish
|
|
102235
|
+
...(mdxish && { heading: compile_heading }),
|
|
102143
102236
|
...(mdxish && { list: compile_list }),
|
|
102144
102237
|
...(mdxish && { listItem: list_item }),
|
|
102145
102238
|
...(mdxish && { text: compile_text }),
|
|
@@ -103949,6 +104042,7 @@ const rehypeMdxishComponents = ({ components, processMarkdown }) => {
|
|
|
103949
104042
|
;// ./processor/plugin/mdxish-handlers.ts
|
|
103950
104043
|
|
|
103951
104044
|
|
|
104045
|
+
|
|
103952
104046
|
// If hChildren is populated, it means the node holds a renderable value (e.g. React)
|
|
103953
104047
|
// See evaluate-expressions.ts for more details
|
|
103954
104048
|
// Otherwise, it's a simple value and we fall back to text
|
|
@@ -104014,8 +104108,30 @@ const embedHandler = (state, node) => {
|
|
|
104014
104108
|
children: isMagicBlockEmbed ? [] : state.all(node),
|
|
104015
104109
|
};
|
|
104016
104110
|
};
|
|
104111
|
+
/**
|
|
104112
|
+
* Renders a list item whose marker sits alone on its line with that line kept empty.
|
|
104113
|
+
*
|
|
104114
|
+
* `-` over an indented block (a sublist, a code block) parses to the same mdast as the
|
|
104115
|
+
* block written on the marker's line, since CommonMark has no empty paragraph, so both
|
|
104116
|
+
* would render as `- - B`. Positions still tell the spellings apart. A `<br>` holds the
|
|
104117
|
+
* line open, which an empty `<p>` wouldn't.
|
|
104118
|
+
*/
|
|
104119
|
+
const listItemHandler = (state, node, parent) => {
|
|
104120
|
+
const item = node;
|
|
104121
|
+
const result = handlers_handlers.listItem(state, item, parent);
|
|
104122
|
+
const first = item.children[0];
|
|
104123
|
+
if (!first || first.type === 'paragraph')
|
|
104124
|
+
return result;
|
|
104125
|
+
const itemLine = item.position?.start.line;
|
|
104126
|
+
const blockLine = first.position?.start.line;
|
|
104127
|
+
if (itemLine === undefined || blockLine === undefined || blockLine <= itemLine)
|
|
104128
|
+
return result;
|
|
104129
|
+
result.children.unshift({ type: 'element', tagName: 'br', properties: {}, children: [] });
|
|
104130
|
+
return result;
|
|
104131
|
+
};
|
|
104017
104132
|
const mdxComponentHandlers = {
|
|
104018
104133
|
embed: embedHandler,
|
|
104134
|
+
listItem: listItemHandler,
|
|
104019
104135
|
mdxFlowExpression: mdxExpressionHandler,
|
|
104020
104136
|
mdxJsxFlowElement: mdxJsxElementHandler,
|
|
104021
104137
|
mdxJsxTextElement: mdxJsxElementHandler,
|
|
@@ -105689,6 +105805,7 @@ function reactElementToHast(node) {
|
|
|
105689
105805
|
|
|
105690
105806
|
|
|
105691
105807
|
|
|
105808
|
+
|
|
105692
105809
|
/**
|
|
105693
105810
|
* Bind the components a given expression actually uses as tags. Scoped per expression on purpose:
|
|
105694
105811
|
* binding the whole hash would shadow same-named globals (a `math` component would break
|
|
@@ -105739,14 +105856,6 @@ const wrapInParagraph = (child) => ({
|
|
|
105739
105856
|
position: child.position,
|
|
105740
105857
|
});
|
|
105741
105858
|
const placeText = (text, needsBlock) => (needsBlock ? wrapInParagraph(text) : text);
|
|
105742
|
-
/** Turn a non-renderable evaluation result into a text node. */
|
|
105743
|
-
const createTextNode = (result, position) => {
|
|
105744
|
-
if (result === null || result === undefined)
|
|
105745
|
-
return { type: 'text', value: '', position };
|
|
105746
|
-
if (typeof result === 'object')
|
|
105747
|
-
return { type: 'text', value: JSON.stringify(result), position };
|
|
105748
|
-
return { type: 'text', value: String(result), position };
|
|
105749
|
-
};
|
|
105750
105859
|
/**
|
|
105751
105860
|
* AST transformer to evaluate MDX expressions.
|
|
105752
105861
|
* Replaces mdxFlowExpression and mdxTextExpression nodes with their evaluated values.
|
|
@@ -105866,6 +105975,26 @@ const evaluateStyleBlockExpressions = () => (tree, file) => {
|
|
|
105866
105975
|
};
|
|
105867
105976
|
/* harmony default export */ const evaluate_style_block_expressions = (evaluateStyleBlockExpressions);
|
|
105868
105977
|
|
|
105978
|
+
;// ./processor/transform/mdxish/heading-ids.ts
|
|
105979
|
+
|
|
105980
|
+
/**
|
|
105981
|
+
* Records every heading id set by `{#id}`, so the slug pass never gives one to another heading.
|
|
105982
|
+
* Warns when two headings share an id, since links can only reach the first.
|
|
105983
|
+
*/
|
|
105984
|
+
const headingIdsTransformer = () => (tree, file) => {
|
|
105985
|
+
visit(tree, 'heading', (node) => {
|
|
105986
|
+
const id = node.data?.hProperties?.id;
|
|
105987
|
+
if (typeof id !== 'string')
|
|
105988
|
+
return;
|
|
105989
|
+
const ids = file.data.explicitHeadingIds ?? new Set();
|
|
105990
|
+
file.data.explicitHeadingIds = ids;
|
|
105991
|
+
if (ids.has(id))
|
|
105992
|
+
console.warn(`[mdxish] Heading id "${id}" is used more than once; links reach only the first.`);
|
|
105993
|
+
ids.add(id);
|
|
105994
|
+
});
|
|
105995
|
+
};
|
|
105996
|
+
/* harmony default export */ const heading_ids = (headingIdsTransformer);
|
|
105997
|
+
|
|
105869
105998
|
;// ./processor/transform/mdxish/heading-slugs.ts
|
|
105870
105999
|
|
|
105871
106000
|
|
|
@@ -105891,12 +106020,17 @@ function textContent(node) {
|
|
|
105891
106020
|
* Id's are used to construct slug anchor links & Table of Contents during rendering
|
|
105892
106021
|
* Use the text / nodes that make up the heading to generate the id
|
|
105893
106022
|
*/
|
|
105894
|
-
const generateSlugForHeadings = () => (tree) => {
|
|
106023
|
+
const generateSlugForHeadings = () => (tree, file) => {
|
|
105895
106024
|
const slugger = new BananaSlug();
|
|
106025
|
+
// The slugger only counts the ids it generates, so `{#id}` ones are skipped past by hand.
|
|
106026
|
+
const explicitIds = file.data.explicitHeadingIds ?? new Set();
|
|
105896
106027
|
visit(tree, 'element', (node) => {
|
|
105897
106028
|
if (isHeading(node) && !node.properties.id) {
|
|
105898
106029
|
const text = node.children.map(textContent).join('');
|
|
105899
|
-
|
|
106030
|
+
let id = slugger.slug(text);
|
|
106031
|
+
while (explicitIds.has(id))
|
|
106032
|
+
id = slugger.slug(text);
|
|
106033
|
+
node.properties.id = id;
|
|
105900
106034
|
}
|
|
105901
106035
|
});
|
|
105902
106036
|
return tree;
|
|
@@ -108411,6 +108545,7 @@ function loadComponents() {
|
|
|
108411
108545
|
|
|
108412
108546
|
|
|
108413
108547
|
|
|
108548
|
+
|
|
108414
108549
|
|
|
108415
108550
|
|
|
108416
108551
|
const defaultTransformers = [
|
|
@@ -108530,24 +108665,15 @@ function mdxishMdastToMd(mdast) {
|
|
|
108530
108665
|
.use(remarkStringify, stringifyOptions);
|
|
108531
108666
|
return processor.stringify(processor.runSync(mdast));
|
|
108532
108667
|
}
|
|
108533
|
-
/**
|
|
108534
|
-
|
|
108535
|
-
* Detects and renders custom component tags from the components hash.
|
|
108536
|
-
*
|
|
108537
|
-
* @see .claude/context/MDXish/Processor Overview.md
|
|
108538
|
-
*/
|
|
108539
|
-
function mdxish(mdContent, opts = {}) {
|
|
108668
|
+
/** The steps `mdxish()` runs after parsing; run it on the parse's VFile, since steps read `file.data`. */
|
|
108669
|
+
function mdxishRenderProcessor(opts = {}) {
|
|
108540
108670
|
const { components: userComponents = {}, hardBreaks: enableHardBreaks = true, safeMode = false, sanitize = false, variables, } = opts;
|
|
108541
108671
|
const components = {
|
|
108542
108672
|
...loadComponents(),
|
|
108543
108673
|
...userComponents,
|
|
108544
108674
|
};
|
|
108545
|
-
|
|
108546
|
-
|
|
108547
|
-
const withoutComments = removeJSXComments(protectedContent);
|
|
108548
|
-
const contentWithoutComments = restoreCodeBlocks(withoutComments, protectedCode);
|
|
108549
|
-
const { processor, parserReadyContent } = mdxishAstProcessor(contentWithoutComments, opts);
|
|
108550
|
-
processor
|
|
108675
|
+
return unified()
|
|
108676
|
+
.use(heading_ids)
|
|
108551
108677
|
.use(safeMode ? undefined : evaluate_exports, { sanitize }) // Evaluate `export const/function` and stash scope on file.data.mdxishScope
|
|
108552
108678
|
.use(enableHardBreaks ? hard_breaks : undefined) // Must precede evaluateExpressions to avoid splitting the \n in an evaluated template literal into a <br> node
|
|
108553
108679
|
.use(safeMode ? undefined : evaluate_expressions, { components, variables }) // Evaluate self-contained MDX expressions (e.g. `{1+1}`)
|
|
@@ -108565,11 +108691,25 @@ function mdxish(mdContent, opts = {}) {
|
|
|
108565
108691
|
.use(heading_slugs)
|
|
108566
108692
|
.use(rehypeMdxishComponents, {
|
|
108567
108693
|
components,
|
|
108694
|
+
// eslint-disable-next-line @typescript-eslint/no-use-before-define -- component bodies render through mdxish() again
|
|
108568
108695
|
processMarkdown: (markdown) => mdxish(markdown, opts),
|
|
108569
108696
|
});
|
|
108697
|
+
}
|
|
108698
|
+
/**
|
|
108699
|
+
* Processes markdown content with MDX syntax support and returns a HAST.
|
|
108700
|
+
* Detects and renders custom component tags from the components hash.
|
|
108701
|
+
*
|
|
108702
|
+
* @see .claude/context/MDXish/Processor Overview.md
|
|
108703
|
+
*/
|
|
108704
|
+
function mdxish(mdContent, opts = {}) {
|
|
108705
|
+
// Remove JSX comments before processing (protect code blocks first)
|
|
108706
|
+
const { protectedCode, protectedContent } = protectCodeBlocks(mdContent);
|
|
108707
|
+
const withoutComments = removeJSXComments(protectedContent);
|
|
108708
|
+
const contentWithoutComments = restoreCodeBlocks(withoutComments, protectedCode);
|
|
108709
|
+
const { processor, parserReadyContent } = mdxishAstProcessor(contentWithoutComments, opts);
|
|
108570
108710
|
const vfile = new VFile({ value: parserReadyContent });
|
|
108571
|
-
const mdast = processor.parse(parserReadyContent);
|
|
108572
|
-
const hast =
|
|
108711
|
+
const mdast = processor.runSync(processor.parse(parserReadyContent), vfile);
|
|
108712
|
+
const hast = mdxishRenderProcessor(opts).runSync(mdast, vfile);
|
|
108573
108713
|
if (!hast) {
|
|
108574
108714
|
throw new Error('Markdown pipeline did not produce a HAST tree.');
|
|
108575
108715
|
}
|
|
@@ -108594,6 +108734,134 @@ const mix = (text, opts = {}) => {
|
|
|
108594
108734
|
};
|
|
108595
108735
|
/* harmony default export */ const lib_mix = (mix);
|
|
108596
108736
|
|
|
108737
|
+
;// ./lib/mdxishHeadingIds.ts
|
|
108738
|
+
|
|
108739
|
+
|
|
108740
|
+
|
|
108741
|
+
|
|
108742
|
+
|
|
108743
|
+
|
|
108744
|
+
|
|
108745
|
+
|
|
108746
|
+
const HEADING_INDEX = 'dataMdxishHeadingIndex';
|
|
108747
|
+
const HEADING_TAG_REGEX = /^h[1-6]$/;
|
|
108748
|
+
const JSX_COMMENT_ONLY_REGEX = new RegExp(`^${JSX_COMMENT_REGEX.source}$`);
|
|
108749
|
+
const isExpression = (node) => node.type === 'mdxFlowExpression' || node.type === 'mdxTextExpression';
|
|
108750
|
+
function collectHeadings(tree) {
|
|
108751
|
+
const headings = [];
|
|
108752
|
+
visit(tree, 'heading', (node) => {
|
|
108753
|
+
headings.push(node);
|
|
108754
|
+
});
|
|
108755
|
+
return headings;
|
|
108756
|
+
}
|
|
108757
|
+
function literalValue(source) {
|
|
108758
|
+
try {
|
|
108759
|
+
return { value: evaluateLiteralExpression(source) };
|
|
108760
|
+
}
|
|
108761
|
+
catch {
|
|
108762
|
+
return null;
|
|
108763
|
+
}
|
|
108764
|
+
}
|
|
108765
|
+
function trimHeadingText(heading) {
|
|
108766
|
+
const first = heading.children[0];
|
|
108767
|
+
if (first?.type === 'text')
|
|
108768
|
+
first.value = first.value.trimStart();
|
|
108769
|
+
const last = heading.children.at(-1);
|
|
108770
|
+
if (last?.type === 'text')
|
|
108771
|
+
last.value = last.value.trimEnd();
|
|
108772
|
+
}
|
|
108773
|
+
const isNamePath = (node) => node.type === 'Identifier' ||
|
|
108774
|
+
(node.type === 'MemberExpression' && !node.computed && !!node.object && isNamePath(node.object));
|
|
108775
|
+
// A name like `{price}` or `{plan.name}` can only read a value, never build an element. Code the parser
|
|
108776
|
+
// rejects can't run at all, so the hub shows it as text.
|
|
108777
|
+
function canBuildElements(source) {
|
|
108778
|
+
try {
|
|
108779
|
+
return !isNamePath(jsxAcornParser.parseExpressionAt(source, 0, { ecmaVersion: 'latest' }));
|
|
108780
|
+
}
|
|
108781
|
+
catch {
|
|
108782
|
+
return false;
|
|
108783
|
+
}
|
|
108784
|
+
}
|
|
108785
|
+
const isHeadingElement = (node) => isMDXElement(node) && HEADING_TAG_REGEX.test(node.name ?? '');
|
|
108786
|
+
// An expression the hub has to run changes a heading from inside one (Markdown or an HTML heading tag), by
|
|
108787
|
+
// building an element (a call or JSX), or as a block: alone in its paragraph, its result is lifted out as one.
|
|
108788
|
+
function canChangeHeadings(node, ancestors, heading) {
|
|
108789
|
+
if (heading || ancestors.some(isHeadingElement) || node.type === 'mdxFlowExpression' || canBuildElements(node.value))
|
|
108790
|
+
return true;
|
|
108791
|
+
const parent = ancestors[ancestors.length - 1];
|
|
108792
|
+
return parent.children.every(child => child === node || (child.type === 'text' && !child.value.trim()));
|
|
108793
|
+
}
|
|
108794
|
+
// Safe mode leaves `<h2 id={...}>` without the id the hub evaluates, which shifts the numbering.
|
|
108795
|
+
function hasEvaluatedHeadingAttribute(tree) {
|
|
108796
|
+
let found = false;
|
|
108797
|
+
visit(tree, isHeadingElement, (node) => {
|
|
108798
|
+
found = node.attributes.some(attribute => attribute.type === 'mdxJsxExpressionAttribute' || typeof attribute.value === 'object');
|
|
108799
|
+
return found ? (/* inlined export .EXIT */false) : undefined;
|
|
108800
|
+
});
|
|
108801
|
+
return found;
|
|
108802
|
+
}
|
|
108803
|
+
// Matches what the hub renders without running code: comments are stripped and plain literals become their
|
|
108804
|
+
// text. `false` when an expression that needs running could change the headings.
|
|
108805
|
+
function settleExpressions(tree) {
|
|
108806
|
+
const edits = [];
|
|
108807
|
+
let settled = true;
|
|
108808
|
+
visitParents(tree, isExpression, (node, ancestors) => {
|
|
108809
|
+
const heading = ancestors.find((ancestor) => ancestor.type === 'heading');
|
|
108810
|
+
const parent = ancestors[ancestors.length - 1];
|
|
108811
|
+
if (JSX_COMMENT_ONLY_REGEX.test(`{${node.value}}`)) {
|
|
108812
|
+
edits.push({ heading, node, parent, replacement: null });
|
|
108813
|
+
return;
|
|
108814
|
+
}
|
|
108815
|
+
const literal = literalValue(node.value);
|
|
108816
|
+
if (literal) {
|
|
108817
|
+
edits.push({ heading, node, parent, replacement: createTextNode(literal.value, node.position) });
|
|
108818
|
+
return;
|
|
108819
|
+
}
|
|
108820
|
+
if (canChangeHeadings(node, ancestors, heading))
|
|
108821
|
+
settled = false;
|
|
108822
|
+
});
|
|
108823
|
+
const apply = ({ node, parent, replacement }) => {
|
|
108824
|
+
parent.children.splice(parent.children.indexOf(node), 1, ...(replacement ? [replacement] : []));
|
|
108825
|
+
};
|
|
108826
|
+
// Comments go first: the hub strips them from the source, so the parser trims only the source
|
|
108827
|
+
// whitespace around them, never the spaces a literal adds.
|
|
108828
|
+
edits
|
|
108829
|
+
.filter(edit => !edit.replacement)
|
|
108830
|
+
.forEach(edit => {
|
|
108831
|
+
apply(edit);
|
|
108832
|
+
if (edit.heading)
|
|
108833
|
+
trimHeadingText(edit.heading);
|
|
108834
|
+
});
|
|
108835
|
+
edits.filter(edit => edit.replacement).forEach(apply);
|
|
108836
|
+
return settled;
|
|
108837
|
+
}
|
|
108838
|
+
/** Each heading's rendered anchor id, worked out without running code; `null` when code could change them. */
|
|
108839
|
+
function mdxishHeadingIds(tree, opts = {}) {
|
|
108840
|
+
const headings = collectHeadings(tree);
|
|
108841
|
+
if (headings.length === 0)
|
|
108842
|
+
return new Map();
|
|
108843
|
+
const copy = structuredClone(tree);
|
|
108844
|
+
let hasExport = false;
|
|
108845
|
+
visit(copy, 'mdxjsEsm', () => {
|
|
108846
|
+
hasExport = true;
|
|
108847
|
+
});
|
|
108848
|
+
// An `export` can define components that render headings.
|
|
108849
|
+
if (hasExport || hasEvaluatedHeadingAttribute(copy) || !settleExpressions(copy))
|
|
108850
|
+
return null;
|
|
108851
|
+
collectHeadings(copy).forEach((heading, index) => {
|
|
108852
|
+
heading.data = { ...heading.data, hProperties: { ...heading.data?.hProperties, [HEADING_INDEX]: index } };
|
|
108853
|
+
});
|
|
108854
|
+
const hast = mdxishRenderProcessor({ ...opts, safeMode: true }).runSync(copy, new VFile());
|
|
108855
|
+
const ids = new Map();
|
|
108856
|
+
visit(hast, 'element', (node) => {
|
|
108857
|
+
const index = node.properties[HEADING_INDEX];
|
|
108858
|
+
if (index === undefined || typeof node.properties.id !== 'string')
|
|
108859
|
+
return;
|
|
108860
|
+
ids.set(headings[Number(index)], node.properties.id);
|
|
108861
|
+
});
|
|
108862
|
+
return ids;
|
|
108863
|
+
}
|
|
108864
|
+
|
|
108597
108865
|
;// ./lib/extractToc.ts
|
|
108598
108866
|
|
|
108599
108867
|
/* harmony default export */ const lib_extractToc = (extractToc);
|
|
@@ -109213,6 +109481,7 @@ async function stripComments(doc, { mdx, mdxish } = {}) {
|
|
|
109213
109481
|
|
|
109214
109482
|
|
|
109215
109483
|
|
|
109484
|
+
|
|
109216
109485
|
|
|
109217
109486
|
;// ./index.tsx
|
|
109218
109487
|
|
|
@@ -109509,7 +109778,7 @@ module.exports = /*#__PURE__*/JSON.parse('{"*":["about","acceptCharset","accessK
|
|
|
109509
109778
|
/******/ // startup
|
|
109510
109779
|
/******/ // Load entry module and return exports
|
|
109511
109780
|
/******/ // This entry module used 'module' so it can't be inlined
|
|
109512
|
-
/******/ let __webpack_exports__ = __webpack_require__(
|
|
109781
|
+
/******/ let __webpack_exports__ = __webpack_require__(9477);
|
|
109513
109782
|
/******/
|
|
109514
109783
|
/******/ return __webpack_exports__;
|
|
109515
109784
|
/******/ })()
|