@readme/markdown 14.13.0 → 14.13.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/Accordion/style.scss +4 -0
- package/dist/lib/micromark/mdx-component/continuation-checks.d.ts +3 -0
- package/dist/main.css +1 -1
- package/dist/main.css.map +1 -1
- package/dist/main.js +183 -103
- package/dist/main.node.js +183 -103
- package/dist/main.node.js.map +1 -1
- package/dist/processor/transform/mdxish/components/mdx-blocks.d.ts +0 -31
- package/dist/render-fixture.css +1 -1
- package/dist/render-fixture.css.map +1 -1
- package/dist/render-fixture.node.js +183 -103
- package/dist/render-fixture.node.js.map +1 -1
- package/dist/utils/common-html-words.d.ts +9 -0
- package/package.json +1 -1
|
@@ -1,37 +1,6 @@
|
|
|
1
1
|
import type { Parent } from 'mdast';
|
|
2
2
|
import type { Plugin } from 'unified';
|
|
3
3
|
export { parseAttributes, parseTag } from '../../../../lib/utils/mdxish/mdxish-component-tag-parser';
|
|
4
|
-
/**
|
|
5
|
-
* Transform PascalCase HTML nodes into mdxJsxFlowElement nodes.
|
|
6
|
-
*
|
|
7
|
-
* Remark parses unknown/custom component tags as raw HTML nodes.
|
|
8
|
-
* These are the custom readme MDX syntax for components.
|
|
9
|
-
* This transformer identifies these patterns and converts them to proper MDX JSX elements so they
|
|
10
|
-
* can be accurately recognized and rendered later with their component definition code.
|
|
11
|
-
*
|
|
12
|
-
* Note: The main goal is to promote PascalCase tags to MDX elements, but we want to promote
|
|
13
|
-
* normal HTML to MDX elements in some cases so they get the full custom parsing behavior.
|
|
14
|
-
* E.g. tags with JSX expressions, nested components, etc.
|
|
15
|
-
*
|
|
16
|
-
* The mdx-component micromark tokenizer ensures that multi-line components are captured
|
|
17
|
-
* as single HTML nodes, so this transformer only needs to handle two cases:
|
|
18
|
-
*
|
|
19
|
-
* ### 1. Self-closing tags
|
|
20
|
-
* ```
|
|
21
|
-
* <Component />
|
|
22
|
-
* ```
|
|
23
|
-
* Parsed as: `html: "<Component />"`
|
|
24
|
-
*
|
|
25
|
-
* ### 2. Self-contained blocks (entire component in single HTML node)
|
|
26
|
-
* ```
|
|
27
|
-
* <Component>
|
|
28
|
-
* content
|
|
29
|
-
* </Component>
|
|
30
|
-
* ```
|
|
31
|
-
* Parsed as: `html: "<Component>\n content\n</Component>"`
|
|
32
|
-
* The opening tag, content, and closing tag are all captured in one HTML node
|
|
33
|
-
* (guaranteed by the mdx-component tokenizer).
|
|
34
|
-
*/
|
|
35
4
|
declare const mdxishMdxComponentBlocks: Plugin<[{
|
|
36
5
|
safeMode?: boolean;
|
|
37
6
|
}?], Parent>;
|
package/dist/render-fixture.css
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
.Accordion{background:rgba(var(--color-bg-page-rgb, white), 1);border:1px solid var(--color-border-default, rgba(0, 0, 0, 0.1));border-radius:5px}.Accordion-title{align-items:center;background:rgba(var(--color-bg-page-rgb, white), 1);border:0;border-radius:5px;color:var(--color-text-default, #384248);cursor:pointer;display:flex;font-size:16px;font-weight:500;padding:10px;position:relative;text-align:left;width:100%}.Accordion-title:hover{background:var(--color-bg-hover, rgba(0, 0, 0, 0.05))}.Accordion[open] .Accordion-title{border-bottom-left-radius:0;border-bottom-right-radius:0}.Accordion-title::marker{content:""}.Accordion-title::-webkit-details-marker{display:none}.Accordion-toggleIcon,.Accordion-toggleIcon_opened{color:var(--color-text-minimum, #637288);font-size:14px;margin-left:5px;margin-right:10px;transition:transform .1s}.Accordion-toggleIcon_opened,.Accordion-toggleIcon_opened_opened{transform:rotate(90deg)}.Accordion-icon{color:var(--project-color-primary, inherit);margin-right:10px}.Accordion-content{color:var(--color-text-muted, #4f5a66);padding:5px 15px 0 15px}
|
|
1
|
+
.Accordion{background:rgba(var(--color-bg-page-rgb, white), 1);border:1px solid var(--color-border-default, rgba(0, 0, 0, 0.1));border-radius:5px}.Accordion-title{align-items:center;background:rgba(var(--color-bg-page-rgb, white), 1);border:0;border-radius:5px;color:var(--color-text-default, #384248);cursor:pointer;display:flex;font-size:16px;font-weight:500;padding:10px;position:relative;text-align:left;width:100%}.Accordion-title:hover{background:var(--color-bg-hover, rgba(0, 0, 0, 0.05))}.Accordion[open] .Accordion-title{border-bottom-left-radius:0;border-bottom-right-radius:0}.Accordion-title::marker{content:""}.Accordion-title::-webkit-details-marker{display:none}.Accordion-toggleIcon,.Accordion-toggleIcon_opened{color:var(--color-text-minimum, #637288);font-size:14px;margin-left:5px;margin-right:10px;transition:transform .1s}.Accordion-toggleIcon_opened,.Accordion-toggleIcon_opened_opened{transform:rotate(90deg)}.Accordion-icon{color:var(--project-color-primary, inherit);margin-right:10px}.Accordion-content{color:var(--color-text-muted, #4f5a66);padding:5px 15px 0 15px}.Accordion-content>*{margin-bottom:var(--markdown-spacing, 15px)}
|
|
2
2
|
.CardsGrid{--CardsGrid-gap: 1.5em;--CardsGrid-columns: auto-fit;--CardsGrid-cardWidth: auto;display:grid;gap:var(--CardsGrid-gap);grid-template-columns:repeat(var(--CardsGrid-columns), minmax(var(--CardsGrid-cardWidth), 1fr))}.Card{--Card-badge-bg-color: var(--yellow);--Card-badge-color: var(--yellow10);--Card-content-color: var(--color-text-minimum);--Card-gap: 0.25em;--Card-href-arrow-opacity: 0;--Card-href-arrow-transform: translateX(-5px);--Card-icon-color: var(--color-text-default);--Card-icon-opacity: 0.65;--Card-icon-opacity-hover: 0.75;--Card-line-height: 1.4;--Card-shadow: none;--Card-title-color: var(--color-text-default);background:var(--Card-bg-color);border:1px solid var(--Card-border-color);border-radius:var(--border-radius-lg);box-shadow:var(--Card-shadow);display:flex;flex-direction:var(--Card-layout);gap:var(--Card-gap);line-height:var(--Card-line-height);padding:var(--Card-padding);text-decoration:none}.Card_card{--Card-bg-color: rgba(var(--color-bg-page-inverse-rgb), 0);--Card-bg-color-hover: rgba(var(--color-bg-page-inverse-rgb), 0);--Card-border-color: var(--color-border-default);--Card-layout: column;--Card-padding: 1.5em}[data-color-mode=dark] .Card_card{--Card-bg-color: rgba(var(--color-bg-page-inverse-rgb), 0.05);--Card-bg-color-hover: rgba(var(--color-bg-page-inverse-rgb), 0.1)}@media(prefers-color-scheme: dark){[data-color-mode=auto] .Card_card,[data-color-mode=system] .Card_card{--Card-bg-color: rgba(var(--color-bg-page-inverse-rgb), 0.05);--Card-bg-color-hover: rgba(var(--color-bg-page-inverse-rgb), 0.1)}}.Card_tile{--Card-gap: 1em;--Card-icon-opacity: 0.5;--Card-layout: row}.Card_tile .Card-content{--Card-gap: 0}.Card[href]:not([href=""]){color:inherit;text-decoration:none}.Card[href]:not([href=""]):hover,.Card[href]:not([href=""]):active,.Card[href]:not([href=""]):focus{--Card-icon-opacity: var(--Card-icon-opacity-hover);--Card-href-arrow-opacity: 0.75;--Card-href-arrow-transform: none;background:var(--Card-bg-color-hover)}.Card-icon{color:var(--Card-icon-color);font-size:1.4em;margin-bottom:.5em;opacity:var(--Card-icon-opacity);transition:opacity var(--transition-timing) var(--transition-fast)}.Card-title{align-items:flex-start;color:var(--Card-title-color);display:flex;gap:.5em;font-weight:var(--font-weight-bold)}.Card-badge{align-items:center;background:var(--Card-badge-bg-color);border-radius:1em;color:var(--Card-badge-color);font-size:.6em;padding:0 .5em;display:inline-flex;position:relative;top:.5em}.Card-arrow{font-size:.8em;opacity:var(--Card-href-arrow-opacity);position:relative;top:.375em;transition:opacity var(--transition-timing) var(--transition-fast),transform var(--transition-timing) var(--transition-fast);transform:var(--Card-href-arrow-transform)}.Card-content{color:var(--Card-content-color);display:flex;flex-direction:column;font-size:1em;gap:var(--Card-gap)}.Card-content p:last-child{margin-bottom:0}
|
|
3
3
|
.Columns{display:grid;gap:var(--md, 20px)}@media(max-width: 414px){.Columns{grid-template-columns:1fr !important}}
|
|
4
4
|
.TabGroup-nav{border-bottom:solid var(--color-border-default, rgba(0, 0, 0, 0.1));margin-bottom:15px}.TabGroup-tab{background:none;border:0;color:var(--color-text-minimum, #637288);cursor:pointer;font-size:15px;font-weight:600;margin-right:15px;padding:0;padding-bottom:10px}.TabGroup-tab_active{background:none;border:0;border-bottom:solid var(--color-tab-active, currentcolor);color:var(--color-tab-active, currentcolor);font-size:15px;font-weight:600;margin-right:15px;margin-bottom:-2px;padding:0;padding-bottom:10px}.TabGroup-tab:hover{color:var(--color-text-muted, #4f5a66)}.TabGroup-icon{color:var(--project-color-primary, inherit);margin-right:10px}.TabGroup .TabContent{color:var(--color-text-muted, #4f5a66)}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render-fixture.css","mappings":"AAAA,WACE,oDACA,iEACA,kBAEA,iBACE,mBACA,oDACA,SACA,kBACA,yCACA,eACA,aACA,eACA,gBACA,aACA,kBACA,gBACA,WAEA,uBACE,sDAGF,kCACE,4BACA,6BAGF,yBACE,WAGF,yCACE,aAIJ,mDAEE,yCACA,eACA,gBACA,kBACA,yBAEA,iEACE,wBAIJ,gBACE,4CACA,kBAGF,mBACE,uCACA,
|
|
1
|
+
{"version":3,"file":"render-fixture.css","mappings":"AAAA,WACE,oDACA,iEACA,kBAEA,iBACE,mBACA,oDACA,SACA,kBACA,yCACA,eACA,aACA,eACA,gBACA,aACA,kBACA,gBACA,WAEA,uBACE,sDAGF,kCACE,4BACA,6BAGF,yBACE,WAGF,yCACE,aAIJ,mDAEE,yCACA,eACA,gBACA,kBACA,yBAEA,iEACE,wBAIJ,gBACE,4CACA,kBAGF,mBACE,uCACA,wBAEA,qBACE,4C;ACzDN,WACE,uBACA,8BACA,4BAEA,aACA,yBACA,gGAGF,MAGE,qCACA,oCACA,gDACA,mBACA,6BACA,8CACA,6CACA,0BACA,gCACA,wBACA,oBACA,8CAEA,gCACA,0CACA,sCACA,8BACA,aACA,kCACA,oBACA,oCACA,4BACA,qBAEA,WACE,2DACA,iEACA,iDACA,sBACA,sBCXA,kCDcE,8DACA,mECTA,mCAFF,sEDUE,8DACA,oEAIJ,WACE,gBACA,yBACA,mBAEA,yBACE,cAKJ,2BACE,cACA,qBAEA,oGAGE,oDACA,gCACA,kCAEA,sCAIJ,WACE,6BACA,gBACA,mBACA,iCACA,mEAGF,YACE,uBACA,8BACA,aACA,SACA,oCAGF,YACE,mBACA,sCACA,kBACA,8BACA,eACA,eACA,oBACA,kBACA,SAGF,YACE,eACA,uCACA,kBACA,WACA,4HACE,CAEF,2CAGF,cACE,gCACA,aACA,sBACA,cACA,oBAEA,2BACE,gB;AE7HN,SACE,aACA,oBAEA,yBAJF,SAKI,sC;ACNF,cACE,oEACA,mBAGF,cACE,gBACA,SACA,yCACA,eACA,eACA,gBACA,kBACA,UACA,oBAEA,qBACE,gBACA,SACA,0DACA,4CACA,eACA,gBACA,kBACA,mBACA,UACA,oBAGF,oBACE,uCAIJ,eACE,4CACA,kBAGF,sBACE,uC","sources":["webpack://@readme/markdown/./components/Accordion/style.scss","webpack://@readme/markdown/./components/Cards/style.scss","webpack://@readme/markdown/./styles/mixins/dark-mode.scss","webpack://@readme/markdown/./components/Columns/style.scss","webpack://@readme/markdown/./components/Tabs/style.scss"],"sourcesContent":[".Accordion {\n background: rgba(var(--color-bg-page-rgb, white), 1);\n border: 1px solid var(--color-border-default, rgba(black, 0.1));\n border-radius: 5px;\n\n &-title {\n align-items: center;\n background: rgba(var(--color-bg-page-rgb, white), 1);\n border: 0;\n border-radius: 5px;\n color: var(--color-text-default, #384248);\n cursor: pointer;\n display: flex;\n font-size: 16px;\n font-weight: 500;\n padding: 10px;\n position: relative;\n text-align: left;\n width: 100%;\n\n &:hover {\n background: var(--color-bg-hover, rgba(black, 0.05));\n }\n\n .Accordion[open] & {\n border-bottom-left-radius: 0;\n border-bottom-right-radius: 0;\n }\n\n &::marker {\n content: \"\";\n }\n\n &::-webkit-details-marker {\n display: none;\n } \n }\n\n &-toggleIcon,\n &-toggleIcon_opened {\n color: var(--color-text-minimum, #637288);\n font-size: 14px;\n margin-left: 5px;\n margin-right: 10px;\n transition: transform 0.1s;\n\n &_opened {\n transform: rotate(90deg);\n }\n }\n\n &-icon {\n color: var(--project-color-primary, inherit);\n margin-right: 10px;\n }\n\n &-content {\n color: var(--color-text-muted, #4f5a66);\n padding: 5px 15px 0 15px;\n\n > * {\n margin-bottom: var(--markdown-spacing, 15px);\n }\n }\n}\n","@import '../../styles/mixins/dark-mode.scss';\n\n$iphone-plus: 414px;\n\n.CardsGrid {\n --CardsGrid-gap: 1.5em;\n --CardsGrid-columns: auto-fit;\n --CardsGrid-cardWidth: auto;\n\n display: grid;\n gap: var(--CardsGrid-gap);\n grid-template-columns: repeat(var(--CardsGrid-columns), minmax(var(--CardsGrid-cardWidth), 1fr));\n}\n\n.Card {\n $card: &;\n\n --Card-badge-bg-color: var(--yellow);\n --Card-badge-color: var(--yellow10);\n --Card-content-color: var(--color-text-minimum);\n --Card-gap: 0.25em;\n --Card-href-arrow-opacity: 0;\n --Card-href-arrow-transform: translateX(-5px);\n --Card-icon-color: var(--color-text-default);\n --Card-icon-opacity: 0.65;\n --Card-icon-opacity-hover: 0.75;\n --Card-line-height: 1.4;\n --Card-shadow: none;\n --Card-title-color: var(--color-text-default);\n\n background: var(--Card-bg-color);\n border: 1px solid var(--Card-border-color);\n border-radius: var(--border-radius-lg);\n box-shadow: var(--Card-shadow);\n display: flex;\n flex-direction: var(--Card-layout);\n gap: var(--Card-gap);\n line-height: var(--Card-line-height);\n padding: var(--Card-padding);\n text-decoration: none;\n\n &_card {\n --Card-bg-color: rgba(var(--color-bg-page-inverse-rgb), 0);\n --Card-bg-color-hover: rgba(var(--color-bg-page-inverse-rgb), 0);\n --Card-border-color: var(--color-border-default);\n --Card-layout: column;\n --Card-padding: 1.5em;\n\n @include dark-mode {\n --Card-bg-color: rgba(var(--color-bg-page-inverse-rgb), 0.05);\n --Card-bg-color-hover: rgba(var(--color-bg-page-inverse-rgb), 0.1);\n }\n }\n\n &_tile {\n --Card-gap: 1em;\n --Card-icon-opacity: 0.5;\n --Card-layout: row;\n\n #{$card}-content {\n --Card-gap: 0;\n }\n }\n\n // needs specificity to override the default link styles; while preserving logic for empty hrefs\n &[href]:not([href='']) {\n color: inherit;\n text-decoration: none;\n\n &:hover,\n &:active,\n &:focus {\n --Card-icon-opacity: var(--Card-icon-opacity-hover);\n --Card-href-arrow-opacity: 0.75;\n --Card-href-arrow-transform: none;\n\n background: var(--Card-bg-color-hover);\n }\n }\n\n &-icon {\n color: var(--Card-icon-color);\n font-size: 1.4em;\n margin-bottom: 0.5em;\n opacity: var(--Card-icon-opacity);\n transition: opacity var(--transition-timing) var(--transition-fast);\n }\n\n &-title {\n align-items: flex-start;\n color: var(--Card-title-color);\n display: flex;\n gap: 0.5em;\n font-weight: var(--font-weight-bold);\n }\n\n &-badge {\n align-items: center;\n background: var(--Card-badge-bg-color);\n border-radius: 1em;\n color: var(--Card-badge-color);\n font-size: 0.6em;\n padding: 0 0.5em;\n display: inline-flex;\n position: relative;\n top: 0.5em;\n }\n\n &-arrow {\n font-size: 0.8em;\n opacity: var(--Card-href-arrow-opacity);\n position: relative;\n top: 0.375em;\n transition:\n opacity var(--transition-timing) var(--transition-fast),\n transform var(--transition-timing) var(--transition-fast);\n transform: var(--Card-href-arrow-transform);\n }\n\n &-content {\n color: var(--Card-content-color);\n display: flex;\n flex-direction: column;\n font-size: 1em;\n gap: var(--Card-gap);\n\n p:last-child {\n margin-bottom: 0;\n }\n }\n}\n","/* We’re planning to move this in to the monorepo in which case\n we could share the dark mode mix in. Kelly is planning to take\n some time to make that move so can we add a comment here to\n circle back on this at that point?\n\n - Rafe\n April 2025\n*/\n\n@mixin dark-mode($global: false) {\n $root: &;\n\n @if not $root {\n [data-color-mode='dark'] {\n @content;\n }\n\n [data-color-mode='auto'],\n [data-color-mode='system'] {\n @media (prefers-color-scheme: dark) {\n @content;\n }\n }\n } @else if $global {\n :global([data-color-mode='dark']) & {\n @content;\n }\n\n :global([data-color-mode='auto']) &,\n :global([data-color-mode='system']) & {\n @media (prefers-color-scheme: dark) {\n @content;\n }\n }\n } @else {\n [data-color-mode='dark'] & {\n @content;\n }\n\n [data-color-mode='auto'] &,\n [data-color-mode='system'] & {\n @media (prefers-color-scheme: dark) {\n @content;\n }\n }\n }\n}\n","$iphone-plus: 414px;\n\n.Columns {\n display: grid;\n gap: var(--md, 20px);\n\n @media (max-width: $iphone-plus) {\n grid-template-columns: 1fr !important;\n }\n}\n",".TabGroup {\n &-nav {\n border-bottom: solid var(--color-border-default, #{rgba(black, 0.1)});\n margin-bottom: 15px;\n }\n\n &-tab {\n background: none;\n border: 0;\n color: var(--color-text-minimum, #637288);\n cursor: pointer;\n font-size: 15px;\n font-weight: 600;\n margin-right: 15px;\n padding: 0;\n padding-bottom: 10px;\n\n &_active {\n background: none;\n border: 0;\n border-bottom: solid var(--color-tab-active, currentcolor);\n color: var(--color-tab-active, currentcolor);\n font-size: 15px;\n font-weight: 600;\n margin-right: 15px;\n margin-bottom: -2px;\n padding: 0;\n padding-bottom: 10px;\n }\n\n &:hover {\n color: var(--color-text-muted, #4f5a66);\n }\n }\n\n &-icon {\n color: var(--project-color-primary, inherit);\n margin-right: 10px;\n }\n\n .TabContent {\n color: var(--color-text-muted, #4f5a66);\n }\n}\n"],"names":[],"sourceRoot":""}
|
|
@@ -96476,6 +96476,15 @@ const HTML_TABLE_STRUCTURE_TAGS = new Set([
|
|
|
96476
96476
|
'caption',
|
|
96477
96477
|
'colgroup',
|
|
96478
96478
|
]);
|
|
96479
|
+
/**
|
|
96480
|
+
* Tags whose bodies a later mdxish transform keeps raw and never re-parses as
|
|
96481
|
+
* markdown. Both layers depend on this property, not on the tags being figures:
|
|
96482
|
+
* the transformer treats them as non-promotable, and the tokenizer must not claim
|
|
96483
|
+
* markdown islands inside them (a claimed island would never be re-parsed and would
|
|
96484
|
+
* leak as literal text). Currently just the figure tags, whose bodies are owned by
|
|
96485
|
+
* the figure reassembly transform (`mdxishJsxToMdast`).
|
|
96486
|
+
*/
|
|
96487
|
+
const NON_REPARSED_BODY_TAGS = new Set(['figure', 'figcaption']);
|
|
96479
96488
|
/**
|
|
96480
96489
|
* The two HTML "foreign content" namespaces: SVG and MathML. Their descendants
|
|
96481
96490
|
* (`<path>`, `<mrow>`, …) are namespaced XML, not HTML tags or components. A closed
|
|
@@ -120253,12 +120262,95 @@ function tokenizeMagicBlockText(effects, ok, nok) {
|
|
|
120253
120262
|
*/
|
|
120254
120263
|
|
|
120255
120264
|
|
|
120265
|
+
;// ./lib/micromark/mdx-component/continuation-checks.ts
|
|
120266
|
+
|
|
120267
|
+
|
|
120268
|
+
/**
|
|
120269
|
+
* Partial constructs the `mdxComponent` tokenizer runs via `effects.check` to
|
|
120270
|
+
* decide whether the next line continues the block. They live here (not in
|
|
120271
|
+
* `syntax.ts`) because they hold none of `createTokenize`'s closure state — each
|
|
120272
|
+
* is a self-contained, single-line lookahead.
|
|
120273
|
+
*/
|
|
120274
|
+
function continuation_checks_tokenizeNonLazyContinuationStart(effects, ok, nok) {
|
|
120275
|
+
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
120276
|
+
const self = this;
|
|
120277
|
+
return start;
|
|
120278
|
+
function start(code) {
|
|
120279
|
+
if (markdownLineEnding(code)) {
|
|
120280
|
+
effects.enter(types_types.lineEnding);
|
|
120281
|
+
effects.consume(code);
|
|
120282
|
+
effects.exit(types_types.lineEnding);
|
|
120283
|
+
return after;
|
|
120284
|
+
}
|
|
120285
|
+
return nok(code);
|
|
120286
|
+
}
|
|
120287
|
+
function after(code) {
|
|
120288
|
+
if (self.parser.lazy[self.now().line]) {
|
|
120289
|
+
return nok(code);
|
|
120290
|
+
}
|
|
120291
|
+
return ok(code);
|
|
120292
|
+
}
|
|
120293
|
+
}
|
|
120294
|
+
// A markup-only line opens with a tag (`<x`/`</x`) and ends (ignoring trailing
|
|
120295
|
+
// spaces) at a `>`. That distinguishes a structural continuation like
|
|
120296
|
+
// `<span>b</span></div>` from a paragraph like `<b>Note:</b> read *this*`.
|
|
120297
|
+
function tokenizeMarkupOnlyContinuation(effects, ok, nok) {
|
|
120298
|
+
let lastNonSpace = null;
|
|
120299
|
+
return start;
|
|
120300
|
+
function start(code) {
|
|
120301
|
+
// Caller guarantees we are at `<` at the (already de-indented) line start.
|
|
120302
|
+
effects.enter(types_types.data);
|
|
120303
|
+
effects.consume(code);
|
|
120304
|
+
return afterLessThan;
|
|
120305
|
+
}
|
|
120306
|
+
function afterLessThan(code) {
|
|
120307
|
+
if (code === codes.slash) {
|
|
120308
|
+
effects.consume(code);
|
|
120309
|
+
return afterSlash;
|
|
120310
|
+
}
|
|
120311
|
+
return afterSlash(code);
|
|
120312
|
+
}
|
|
120313
|
+
// The `<` (or `</`) must introduce a real tag, not a stray `<` in prose.
|
|
120314
|
+
function afterSlash(code) {
|
|
120315
|
+
if (asciiAlpha(code)) {
|
|
120316
|
+
lastNonSpace = code;
|
|
120317
|
+
effects.consume(code);
|
|
120318
|
+
return scanToLineEnd;
|
|
120319
|
+
}
|
|
120320
|
+
effects.exit(types_types.data);
|
|
120321
|
+
return nok(code);
|
|
120322
|
+
}
|
|
120323
|
+
function scanToLineEnd(code) {
|
|
120324
|
+
if (code === null || markdownLineEnding(code)) {
|
|
120325
|
+
effects.exit(types_types.data);
|
|
120326
|
+
return lastNonSpace === codes.greaterThan ? ok(code) : nok(code);
|
|
120327
|
+
}
|
|
120328
|
+
if (!markdownSpace(code))
|
|
120329
|
+
lastNonSpace = code;
|
|
120330
|
+
effects.consume(code);
|
|
120331
|
+
return scanToLineEnd;
|
|
120332
|
+
}
|
|
120333
|
+
}
|
|
120334
|
+
// A line ending whose next line isn't a lazy paragraph continuation. Checked so a
|
|
120335
|
+
// component body's blank/continuation lines aren't stolen by an interrupted paragraph.
|
|
120336
|
+
const continuation_checks_nonLazyContinuationStart = {
|
|
120337
|
+
tokenize: continuation_checks_tokenizeNonLazyContinuationStart,
|
|
120338
|
+
partial: true,
|
|
120339
|
+
};
|
|
120340
|
+
// Lookahead for `plainClaimLineStart`: is this line markup-only, or a paragraph
|
|
120341
|
+
// that merely starts with a tag? Run via `effects.check` so it never consumes.
|
|
120342
|
+
const markupOnlyContinuation = {
|
|
120343
|
+
tokenize: tokenizeMarkupOnlyContinuation,
|
|
120344
|
+
partial: true,
|
|
120345
|
+
};
|
|
120346
|
+
|
|
120256
120347
|
;// ./lib/micromark/mdx-component/syntax.ts
|
|
120257
120348
|
|
|
120258
120349
|
|
|
120259
120350
|
|
|
120260
120351
|
|
|
120261
120352
|
|
|
120353
|
+
|
|
120262
120354
|
// Raw tags (type-1: pre/script/style/textarea) and block tags (type-6: div,
|
|
120263
120355
|
// section, …) always start a block, so they stay flow even with trailing
|
|
120264
120356
|
// content. Other lowercase tags (i, span, …) follow the type-7 rule and only
|
|
@@ -120268,16 +120360,12 @@ const htmlFlowTagNames = new Set([...htmlRawNames, ...htmlBlockNames]);
|
|
|
120268
120360
|
// blank lines between nested JSX siblings don't fragment the block. Excludes table
|
|
120269
120361
|
// tags (mdxishTables owns their blank lines) and voids (never close).
|
|
120270
120362
|
const plainBlockClaimTagNames = new Set([...htmlBlockNames].filter(tag => !HTML_TABLE_STRUCTURE_TAGS.has(tag) && !HTML_VOID_ELEMENTS.has(tag)));
|
|
120271
|
-
|
|
120272
|
-
|
|
120273
|
-
|
|
120274
|
-
|
|
120275
|
-
|
|
120276
|
-
|
|
120277
|
-
const markupOnlyContinuation = {
|
|
120278
|
-
tokenize: tokenizeMarkupOnlyContinuation,
|
|
120279
|
-
partial: true,
|
|
120280
|
-
};
|
|
120363
|
+
// Both are 4 columns per CommonMark, but they mean different things: a tab advances
|
|
120364
|
+
// to the next multiple of TAB_STOP_WIDTH, and INDENTED_CODE_MIN_COLUMNS is the depth
|
|
120365
|
+
// at which a line would fragment into indented code. Named separately so the two
|
|
120366
|
+
// concepts don't read as one incidental literal.
|
|
120367
|
+
const TAB_STOP_WIDTH = 4;
|
|
120368
|
+
const INDENTED_CODE_MIN_COLUMNS = 4;
|
|
120281
120369
|
function resolveToMdxComponent(events) {
|
|
120282
120370
|
let index = events.length;
|
|
120283
120371
|
while (index > 0) {
|
|
@@ -120336,6 +120424,18 @@ function createTokenize(mode) {
|
|
|
120336
120424
|
// `plainClaimLineStart`: after a blank line it may only continue on a tag line.
|
|
120337
120425
|
let isPlainBlockClaim = false;
|
|
120338
120426
|
let pendingBlankLine = false;
|
|
120427
|
+
// Leading indent columns of the current plain-claim line, reset per line; ≥4 is
|
|
120428
|
+
// where CommonMark would fragment the island as indented code. Tabs advance to the
|
|
120429
|
+
// next 4-column stop — the same rule `expandIndentToColumns`
|
|
120430
|
+
// (processor/transform/mdxish/indentation.ts) applies, kept in sync by hand since
|
|
120431
|
+
// this side works on a `Code` stream, not a string. NB: do NOT swap this for
|
|
120432
|
+
// `self.now().column`; micromark bumps the point column by 1 per `horizontalTab`
|
|
120433
|
+
// code (the trailing `virtualSpace` codes don't move it), so it measures a tab as
|
|
120434
|
+
// 1 column, reviving the tab-under-measurement bug this math exists to avoid.
|
|
120435
|
+
let plainClaimIndentColumns = 0;
|
|
120436
|
+
// True once a non-blank line follows the opener: a deep island below it is nested
|
|
120437
|
+
// (cosmetic indent), not top-of-body indented code.
|
|
120438
|
+
let sawPlainBlockBodyContent = false;
|
|
120339
120439
|
// Code span tracking
|
|
120340
120440
|
let codeSpanOpenSize = 0;
|
|
120341
120441
|
let codeSpanCloseSize = 0;
|
|
@@ -120635,7 +120735,7 @@ function createTokenize(mode) {
|
|
|
120635
120735
|
}
|
|
120636
120736
|
// Continuation for multi-line opening tags
|
|
120637
120737
|
function openTagContinuationStart(code) {
|
|
120638
|
-
return effects.check(
|
|
120738
|
+
return effects.check(continuation_checks_nonLazyContinuationStart, openTagContinuationNonLazy, continuationAfter)(code);
|
|
120639
120739
|
}
|
|
120640
120740
|
function openTagContinuationNonLazy(code) {
|
|
120641
120741
|
sawLineEnding = true;
|
|
@@ -120680,6 +120780,9 @@ function createTokenize(mode) {
|
|
|
120680
120780
|
}
|
|
120681
120781
|
if (code !== codes.space && code !== codes.horizontalTab) {
|
|
120682
120782
|
openerLineHasContent = true;
|
|
120783
|
+
// Continuation content marks a later deep island as nested, not indented code.
|
|
120784
|
+
if (!onOpenerLine)
|
|
120785
|
+
sawPlainBlockBodyContent = true;
|
|
120683
120786
|
}
|
|
120684
120787
|
if (code === codes.backslash) {
|
|
120685
120788
|
effects.consume(code);
|
|
@@ -120760,7 +120863,7 @@ function createTokenize(mode) {
|
|
|
120760
120863
|
return inFencedCode;
|
|
120761
120864
|
}
|
|
120762
120865
|
function fencedCodeContinuationStart(code) {
|
|
120763
|
-
return effects.check(
|
|
120866
|
+
return effects.check(continuation_checks_nonLazyContinuationStart, fencedCodeContinuationNonLazy, continuationAfter)(code);
|
|
120764
120867
|
}
|
|
120765
120868
|
function fencedCodeContinuationNonLazy(code) {
|
|
120766
120869
|
sawLineEnding = true;
|
|
@@ -120968,7 +121071,7 @@ function createTokenize(mode) {
|
|
|
120968
121071
|
}
|
|
120969
121072
|
// ── Body continuation (line endings) ───────────────────────────────────
|
|
120970
121073
|
function bodyContinuationStart(code) {
|
|
120971
|
-
return effects.check(
|
|
121074
|
+
return effects.check(continuation_checks_nonLazyContinuationStart, bodyContinuationNonLazy, continuationAfter)(code);
|
|
120972
121075
|
}
|
|
120973
121076
|
function bodyContinuationNonLazy(code) {
|
|
120974
121077
|
sawLineEnding = true;
|
|
@@ -120994,8 +121097,10 @@ function createTokenize(mode) {
|
|
|
120994
121097
|
return inBodyBraceString(code);
|
|
120995
121098
|
return inBodyBraceExpr(code);
|
|
120996
121099
|
}
|
|
120997
|
-
if (isPlainBlockClaim)
|
|
121100
|
+
if (isPlainBlockClaim) {
|
|
121101
|
+
plainClaimIndentColumns = 0;
|
|
120998
121102
|
return plainClaimLineStart(code);
|
|
121103
|
+
}
|
|
120999
121104
|
return bodyLineStart(code);
|
|
121000
121105
|
}
|
|
121001
121106
|
// Dispatch a non-blank continuation line: fenced code at line start, else body.
|
|
@@ -121025,6 +121130,8 @@ function createTokenize(mode) {
|
|
|
121025
121130
|
function plainClaimLineStart(code) {
|
|
121026
121131
|
// Leading whitespace only → treat as a blank line, matching CommonMark.
|
|
121027
121132
|
if (code === codes.space || code === codes.horizontalTab) {
|
|
121133
|
+
plainClaimIndentColumns +=
|
|
121134
|
+
code === codes.horizontalTab ? TAB_STOP_WIDTH - (plainClaimIndentColumns % TAB_STOP_WIDTH) : 1;
|
|
121028
121135
|
effects.consume(code);
|
|
121029
121136
|
return plainClaimLineStart;
|
|
121030
121137
|
}
|
|
@@ -121033,10 +121140,18 @@ function createTokenize(mode) {
|
|
|
121033
121140
|
effects.exit('mdxComponentData');
|
|
121034
121141
|
return bodyContinuationStart(code);
|
|
121035
121142
|
}
|
|
121036
|
-
// Across a blank line the block only continues onto a markup-only line; a
|
|
121037
|
-
// paragraph that merely starts with a tag must fall back so its markdown
|
|
121038
|
-
// parses and rehype-raw re-nests it into the wrapper.
|
|
121039
121143
|
if (pendingBlankLine) {
|
|
121144
|
+
// A 4+ col island nested under other tags is cosmetic nesting indent, not code:
|
|
121145
|
+
// keep claiming so promotion dedents + re-parses it as markdown (RM-17560).
|
|
121146
|
+
// Tags whose bodies stay raw are excluded — a claimed island there would never
|
|
121147
|
+
// be re-parsed and would leak as literal text.
|
|
121148
|
+
if (plainClaimIndentColumns >= INDENTED_CODE_MIN_COLUMNS &&
|
|
121149
|
+
sawPlainBlockBodyContent &&
|
|
121150
|
+
!NON_REPARSED_BODY_TAGS.has(tagName)) {
|
|
121151
|
+
return plainClaimContinue(code);
|
|
121152
|
+
}
|
|
121153
|
+
// Otherwise only a markup-only tag line continues; markdown/prose falls back to
|
|
121154
|
+
// CommonMark so it parses and rehype-raw re-nests it into the wrapper.
|
|
121040
121155
|
if (code !== codes.lessThan)
|
|
121041
121156
|
return nok(code);
|
|
121042
121157
|
return effects.check(markupOnlyContinuation, plainClaimContinue, nok)(code);
|
|
@@ -121057,66 +121172,6 @@ function createTokenize(mode) {
|
|
|
121057
121172
|
}
|
|
121058
121173
|
};
|
|
121059
121174
|
}
|
|
121060
|
-
function mdx_component_syntax_tokenizeNonLazyContinuationStart(effects, ok, nok) {
|
|
121061
|
-
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
121062
|
-
const self = this;
|
|
121063
|
-
return start;
|
|
121064
|
-
function start(code) {
|
|
121065
|
-
if (markdownLineEnding(code)) {
|
|
121066
|
-
effects.enter(types_types.lineEnding);
|
|
121067
|
-
effects.consume(code);
|
|
121068
|
-
effects.exit(types_types.lineEnding);
|
|
121069
|
-
return after;
|
|
121070
|
-
}
|
|
121071
|
-
return nok(code);
|
|
121072
|
-
}
|
|
121073
|
-
function after(code) {
|
|
121074
|
-
if (self.parser.lazy[self.now().line]) {
|
|
121075
|
-
return nok(code);
|
|
121076
|
-
}
|
|
121077
|
-
return ok(code);
|
|
121078
|
-
}
|
|
121079
|
-
}
|
|
121080
|
-
// A markup-only line opens with a tag (`<x`/`</x`) and ends (ignoring trailing
|
|
121081
|
-
// spaces) at a `>`. That distinguishes a structural continuation like
|
|
121082
|
-
// `<span>b</span></div>` from a paragraph like `<b>Note:</b> read *this*`.
|
|
121083
|
-
function tokenizeMarkupOnlyContinuation(effects, ok, nok) {
|
|
121084
|
-
let lastNonSpace = null;
|
|
121085
|
-
return start;
|
|
121086
|
-
function start(code) {
|
|
121087
|
-
// Caller guarantees we are at `<` at the (already de-indented) line start.
|
|
121088
|
-
effects.enter(types_types.data);
|
|
121089
|
-
effects.consume(code);
|
|
121090
|
-
return afterLessThan;
|
|
121091
|
-
}
|
|
121092
|
-
function afterLessThan(code) {
|
|
121093
|
-
if (code === codes.slash) {
|
|
121094
|
-
effects.consume(code);
|
|
121095
|
-
return afterSlash;
|
|
121096
|
-
}
|
|
121097
|
-
return afterSlash(code);
|
|
121098
|
-
}
|
|
121099
|
-
// The `<` (or `</`) must introduce a real tag, not a stray `<` in prose.
|
|
121100
|
-
function afterSlash(code) {
|
|
121101
|
-
if (asciiAlpha(code)) {
|
|
121102
|
-
lastNonSpace = code;
|
|
121103
|
-
effects.consume(code);
|
|
121104
|
-
return scanToLineEnd;
|
|
121105
|
-
}
|
|
121106
|
-
effects.exit(types_types.data);
|
|
121107
|
-
return nok(code);
|
|
121108
|
-
}
|
|
121109
|
-
function scanToLineEnd(code) {
|
|
121110
|
-
if (code === null || markdownLineEnding(code)) {
|
|
121111
|
-
effects.exit(types_types.data);
|
|
121112
|
-
return lastNonSpace === codes.greaterThan ? ok(code) : nok(code);
|
|
121113
|
-
}
|
|
121114
|
-
if (!markdownSpace(code))
|
|
121115
|
-
lastNonSpace = code;
|
|
121116
|
-
effects.consume(code);
|
|
121117
|
-
return scanToLineEnd;
|
|
121118
|
-
}
|
|
121119
|
-
}
|
|
121120
121175
|
/**
|
|
121121
121176
|
* Micromark extension that tokenizes MDX-like components.
|
|
121122
121177
|
*
|
|
@@ -121170,6 +121225,7 @@ function syntax_mdxComponent() {
|
|
|
121170
121225
|
|
|
121171
121226
|
|
|
121172
121227
|
|
|
121228
|
+
|
|
121173
121229
|
|
|
121174
121230
|
const buildInlineMdProcessor = (safeMode) => {
|
|
121175
121231
|
// `jsxTable` must be present so a `<Table>`/`<table>` nested in a component
|
|
@@ -121241,7 +121297,7 @@ const toMdxJsxTextElement = (name, attributes, children, position) => ({
|
|
|
121241
121297
|
// Raw-body tags (pre/script/style/textarea) must stay byte-exact; table
|
|
121242
121298
|
// structure (`table` + `tableTags`) is owned by `mdxishTables` and figures by
|
|
121243
121299
|
// `mdxishJsxToMdast`, both of which run later on raw html nodes.
|
|
121244
|
-
const NON_PROMOTABLE_PLAIN_TAGS = new Set([...htmlRawNames, ...tableTags, 'table',
|
|
121300
|
+
const NON_PROMOTABLE_PLAIN_TAGS = new Set([...htmlRawNames, ...tableTags, 'table', ...NON_REPARSED_BODY_TAGS]);
|
|
121245
121301
|
const NESTED_TABLE_RE = /<table[\s>]/i;
|
|
121246
121302
|
const isMarkdownPromotableHtmlTag = (tag) => !NON_PROMOTABLE_PLAIN_TAGS.has(tag);
|
|
121247
121303
|
// Expression nodes count as plain so `<div>{1+1}</div>` keeps its current
|
|
@@ -121600,15 +121656,22 @@ function safeDeindent(text) {
|
|
|
121600
121656
|
*/
|
|
121601
121657
|
const parseMdChildren = (value, safeMode) => {
|
|
121602
121658
|
const parsed = getInlineMdProcessor({ safeMode }).parse(terminateHtmlFlowBlocks(safeDeindent(value).trim()));
|
|
121659
|
+
// Promote nested wrappers bottom-up so an outer wrapper sees markdown buried in a
|
|
121660
|
+
// child claimed whole (e.g. `<li>` in `<ol>`) before its containsMarkdownConstruct check (RM-17560).
|
|
121661
|
+
// eslint-disable-next-line @typescript-eslint/no-use-before-define -- mutually recursive; hoisted decl, safe at runtime
|
|
121662
|
+
promoteComponentBlocks(parsed, safeMode, null);
|
|
121603
121663
|
return parsed.children || [];
|
|
121604
121664
|
};
|
|
121605
|
-
//
|
|
121606
|
-
// components among them
|
|
121607
|
-
|
|
121665
|
+
// Splices trailing content in as sibling nodes. parseMdChildren has already
|
|
121666
|
+
// promoted any components nested among them (bottom-up); the main loop's
|
|
121667
|
+
// index-based walk then reaches these spliced siblings and the original children
|
|
121668
|
+
// they shift down, so no parent re-queue is needed. Each spliced subtree is marked
|
|
121669
|
+
// `promoted` so the walk doesn't redundantly re-descend into it (its html is gone).
|
|
121670
|
+
const parseSibling = (parent, index, sibling, safeMode, promoted) => {
|
|
121608
121671
|
const siblingNodes = parseMdChildren(sibling, safeMode);
|
|
121609
121672
|
if (siblingNodes.length > 0) {
|
|
121610
121673
|
parent.children.splice(index + 1, 0, ...siblingNodes);
|
|
121611
|
-
|
|
121674
|
+
siblingNodes.forEach(siblingNode => promoted.add(siblingNode));
|
|
121612
121675
|
}
|
|
121613
121676
|
};
|
|
121614
121677
|
// Ends the position at `consumedLength` so the component doesn't claim trailing
|
|
@@ -121674,16 +121737,19 @@ const substituteNodeWithMdxNode = (parent, index, mdxNode) => {
|
|
|
121674
121737
|
* The opening tag, content, and closing tag are all captured in one HTML node
|
|
121675
121738
|
* (guaranteed by the mdx-component tokenizer).
|
|
121676
121739
|
*/
|
|
121677
|
-
|
|
121740
|
+
function promoteComponentBlocks(tree, safeMode, source) {
|
|
121678
121741
|
const stack = [tree];
|
|
121679
|
-
const safeMode = !!opts.safeMode;
|
|
121680
|
-
const source = file?.value ? String(file.value) : null;
|
|
121681
121742
|
const parseOpts = { preserveExpressionsAsText: safeMode };
|
|
121743
|
+
// Subtrees a nested parseMdChildren already promoted wholesale (spliced siblings):
|
|
121744
|
+
// re-descending them finds no html to promote, so skip them.
|
|
121745
|
+
const promoted = new WeakSet();
|
|
121682
121746
|
const processChildNode = (parent, index) => {
|
|
121683
121747
|
const node = parent.children[index];
|
|
121684
121748
|
if (!node)
|
|
121685
121749
|
return;
|
|
121686
|
-
|
|
121750
|
+
// Descend into container nodes (lists, blockquotes, …) so their html children
|
|
121751
|
+
// are reached — unless the subtree was already promoted upstream.
|
|
121752
|
+
if ('children' in node && Array.isArray(node.children) && !promoted.has(node)) {
|
|
121687
121753
|
stack.push(node);
|
|
121688
121754
|
}
|
|
121689
121755
|
// Only html nodes can be an unparsed MDX component.
|
|
@@ -121738,7 +121804,7 @@ const mdx_blocks_mdxishMdxComponentBlocks = (opts = {}) => (tree, file) => {
|
|
|
121738
121804
|
substituteNodeWithMdxNode(parent, index, componentNode);
|
|
121739
121805
|
const remainingContent = contentAfterTag.trim();
|
|
121740
121806
|
if (remainingContent) {
|
|
121741
|
-
parseSibling(
|
|
121807
|
+
parseSibling(parent, index, remainingContent, safeMode, promoted);
|
|
121742
121808
|
}
|
|
121743
121809
|
return;
|
|
121744
121810
|
}
|
|
@@ -121765,43 +121831,57 @@ const mdx_blocks_mdxishMdxComponentBlocks = (opts = {}) => (tree, file) => {
|
|
|
121765
121831
|
return;
|
|
121766
121832
|
// Lowercase tags are usually inline; unwrap a sole paragraph so their
|
|
121767
121833
|
// phrasing content isn't spuriously block-wrapped.
|
|
121834
|
+
let unwrappedSoleParagraph = false;
|
|
121768
121835
|
if (!isPascal && parsedChildren.length === 1 && parsedChildren[0].type === 'paragraph') {
|
|
121769
121836
|
parsedChildren = parsedChildren[0].children;
|
|
121837
|
+
unwrappedSoleParagraph = true;
|
|
121838
|
+
}
|
|
121839
|
+
// Without trailing content the whole node position is correct. With it, end
|
|
121840
|
+
// precisely at the closing tag — preferring source offsets when available (the
|
|
121841
|
+
// node's value strips blockquote/list prefixes), else the consumed span.
|
|
121842
|
+
let endPosition = node.position;
|
|
121843
|
+
if (contentAfterClose) {
|
|
121844
|
+
endPosition = source
|
|
121845
|
+
? positionEndingAtClosingTagInSource(node.position, closingTagStr, source)
|
|
121846
|
+
: positionEndingAtConsumed(node.position, value, leadingWhitespace + openingTagEnd + closingTagIndex + closingTagStr.length);
|
|
121770
121847
|
}
|
|
121771
121848
|
const componentNode = createComponentNode({
|
|
121772
121849
|
tag,
|
|
121773
121850
|
attributes,
|
|
121774
121851
|
children: parsedChildren,
|
|
121775
121852
|
startPosition: node.position,
|
|
121776
|
-
|
|
121777
|
-
// offsets when available (the node's value strips blockquote/list
|
|
121778
|
-
// prefixes); otherwise fall back to the whole node position.
|
|
121779
|
-
endPosition: contentAfterClose
|
|
121780
|
-
? source
|
|
121781
|
-
? positionEndingAtClosingTagInSource(node.position, closingTagStr, source)
|
|
121782
|
-
: positionEndingAtConsumed(node.position, value, leadingWhitespace + openingTagEnd + closingTagIndex + closingTagStr.length)
|
|
121783
|
-
: node.position,
|
|
121853
|
+
endPosition,
|
|
121784
121854
|
});
|
|
121785
121855
|
substituteNodeWithMdxNode(parent, index, componentNode);
|
|
121786
|
-
//
|
|
121787
|
-
|
|
121788
|
-
|
|
121789
|
-
}
|
|
121790
|
-
else if (componentNode.children.length > 0) {
|
|
121856
|
+
// The unwrap reparented the children out of their paragraph, so re-walk them
|
|
121857
|
+
// since the children HTML may contain promotable syntax (e.g. `{…}`-attr tags)
|
|
121858
|
+
if (unwrappedSoleParagraph) {
|
|
121791
121859
|
stack.push(componentNode);
|
|
121792
121860
|
}
|
|
121861
|
+
// Trailing content after the close becomes siblings; parseMdChildren has
|
|
121862
|
+
// already promoted any components nested inside both sides, so the promoted
|
|
121863
|
+
// subtree itself needs no re-queue.
|
|
121864
|
+
if (contentAfterClose) {
|
|
121865
|
+
parseSibling(parent, index, contentAfterClose, safeMode, promoted);
|
|
121866
|
+
}
|
|
121793
121867
|
}
|
|
121794
121868
|
};
|
|
121795
|
-
// Depth-first so nodes keep their source order.
|
|
121869
|
+
// Depth-first so nodes keep their source order. Index-based (not forEach) and
|
|
121870
|
+
// re-reading length each step: parseSibling splices siblings in mid-iteration, and
|
|
121871
|
+
// those — plus the original children they shift down — must all stay eligible.
|
|
121796
121872
|
while (stack.length) {
|
|
121797
121873
|
const parent = stack.pop();
|
|
121798
121874
|
if (parent?.children) {
|
|
121799
|
-
parent.children.
|
|
121875
|
+
for (let index = 0; index < parent.children.length; index += 1) {
|
|
121800
121876
|
processChildNode(parent, index);
|
|
121801
|
-
}
|
|
121877
|
+
}
|
|
121802
121878
|
}
|
|
121803
121879
|
}
|
|
121804
121880
|
return tree;
|
|
121881
|
+
}
|
|
121882
|
+
const mdx_blocks_mdxishMdxComponentBlocks = (opts = {}) => (tree, file) => {
|
|
121883
|
+
const source = file?.value ? String(file.value) : null;
|
|
121884
|
+
return promoteComponentBlocks(tree, !!opts.safeMode, source);
|
|
121805
121885
|
};
|
|
121806
121886
|
/* harmony default export */ const mdx_blocks = (mdx_blocks_mdxishMdxComponentBlocks);
|
|
121807
121887
|
|