@readme/markdown 14.11.1 → 14.11.3
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/TableOfContents/index.tsx +29 -1
- package/dist/339.node.js +2 -2
- package/dist/486.node.js +4 -4
- package/dist/lib/mdast-util/html-block-component/index.d.ts +2 -0
- package/dist/lib/micromark/html-block-component/index.d.ts +1 -0
- package/dist/lib/micromark/html-block-component/syntax.d.ts +8 -0
- package/dist/main.js +412 -7
- package/dist/main.node.js +412 -7
- package/dist/main.node.js.map +1 -1
- package/dist/processor/transform/mdxish/tables/escape-stray-less-than.d.ts +9 -0
- package/dist/render-fixture.node.js +595 -190
- package/dist/render-fixture.node.js.map +1 -1
- package/package.json +1 -1
|
@@ -92021,6 +92021,34 @@ function useScrollHighlight(navRef) {
|
|
|
92021
92021
|
return scrollParent.scrollHeight > scrollParent.clientHeight
|
|
92022
92022
|
&& scrollParent.scrollTop + scrollParent.clientHeight >= scrollParent.scrollHeight - SCROLL_BOTTOM_TOLERANCE;
|
|
92023
92023
|
};
|
|
92024
|
+
/**
|
|
92025
|
+
* Keeps the active link visible within the TOC's own scroll container —
|
|
92026
|
+
* the same result as `scrollIntoView({ block: 'nearest' })`, but scoped to
|
|
92027
|
+
* a single scroller. `scrollIntoView` adjusts *every* scrollable ancestor,
|
|
92028
|
+
* and starting a scroll on the page's content scroller cancels any
|
|
92029
|
+
* in-flight smooth scroll there — e.g. the hub's scroll-to-top reset when
|
|
92030
|
+
* navigating between pages (CX-3667).
|
|
92031
|
+
*/
|
|
92032
|
+
const scrollTOCLinkIntoView = (link) => {
|
|
92033
|
+
const tocScroller = TableOfContents_getScrollParent(link);
|
|
92034
|
+
// Without a TOC-local scroll area, the link's nearest scrollable
|
|
92035
|
+
// ancestor is the window (`getScrollParent`'s fallback) or the scroller
|
|
92036
|
+
// holding the page content — never auto-scroll those just to reveal a
|
|
92037
|
+
// TOC link.
|
|
92038
|
+
if (!(tocScroller instanceof HTMLElement) || tocScroller.contains(headings[0]))
|
|
92039
|
+
return;
|
|
92040
|
+
const scrollerRect = tocScroller.getBoundingClientRect();
|
|
92041
|
+
const linkRect = link.getBoundingClientRect();
|
|
92042
|
+
if (linkRect.top < scrollerRect.top) {
|
|
92043
|
+
tocScroller.scrollTo?.({ top: tocScroller.scrollTop + (linkRect.top - scrollerRect.top), behavior: 'smooth' });
|
|
92044
|
+
}
|
|
92045
|
+
else if (linkRect.bottom > scrollerRect.bottom) {
|
|
92046
|
+
tocScroller.scrollTo?.({
|
|
92047
|
+
top: tocScroller.scrollTop + (linkRect.bottom - scrollerRect.bottom),
|
|
92048
|
+
behavior: 'smooth',
|
|
92049
|
+
});
|
|
92050
|
+
}
|
|
92051
|
+
};
|
|
92024
92052
|
const activate = (id) => {
|
|
92025
92053
|
if (id === activeId)
|
|
92026
92054
|
return;
|
|
@@ -92037,7 +92065,7 @@ function useScrollHighlight(navRef) {
|
|
|
92037
92065
|
const linkRect = link.getBoundingClientRect();
|
|
92038
92066
|
nav.style.setProperty('--ToC-border-active-height', `${linkRect.height}px`);
|
|
92039
92067
|
nav.style.setProperty('--ToC-border-active-top', `${linkRect.top - navRect.top}px`);
|
|
92040
|
-
link
|
|
92068
|
+
scrollTOCLinkIntoView(link);
|
|
92041
92069
|
}
|
|
92042
92070
|
}
|
|
92043
92071
|
};
|
|
@@ -92812,7 +92840,7 @@ function legacyVariableFromMarkdown() {
|
|
|
92812
92840
|
*
|
|
92813
92841
|
* Unicode basic latin block.
|
|
92814
92842
|
*/
|
|
92815
|
-
const
|
|
92843
|
+
const codes_codes = /** @type {const} */ ({
|
|
92816
92844
|
carriageReturn: -5,
|
|
92817
92845
|
lineFeed: -4,
|
|
92818
92846
|
carriageReturnLineFeed: -3,
|
|
@@ -92960,11 +92988,11 @@ const codes = /** @type {const} */ ({
|
|
|
92960
92988
|
function isNameChar(code) {
|
|
92961
92989
|
if (code === null)
|
|
92962
92990
|
return false;
|
|
92963
|
-
return ((code >=
|
|
92964
|
-
(code >=
|
|
92965
|
-
(code >=
|
|
92966
|
-
code ===
|
|
92967
|
-
code ===
|
|
92991
|
+
return ((code >= codes_codes.lowercaseA && code <= codes_codes.lowercaseZ) ||
|
|
92992
|
+
(code >= codes_codes.uppercaseA && code <= codes_codes.uppercaseZ) ||
|
|
92993
|
+
(code >= codes_codes.digit0 && code <= codes_codes.digit9) ||
|
|
92994
|
+
code === codes_codes.dash ||
|
|
92995
|
+
code === codes_codes.underscore);
|
|
92968
92996
|
}
|
|
92969
92997
|
const gemojiConstruct = {
|
|
92970
92998
|
name: 'gemoji',
|
|
@@ -92974,7 +93002,7 @@ function tokenize(effects, ok, nok) {
|
|
|
92974
93002
|
let hasName = false;
|
|
92975
93003
|
// Entry point — expect opening `:`
|
|
92976
93004
|
const start = (code) => {
|
|
92977
|
-
if (code !==
|
|
93005
|
+
if (code !== codes_codes.colon)
|
|
92978
93006
|
return nok(code);
|
|
92979
93007
|
effects.enter('gemoji');
|
|
92980
93008
|
effects.enter('gemojiMarker');
|
|
@@ -92985,7 +93013,7 @@ function tokenize(effects, ok, nok) {
|
|
|
92985
93013
|
};
|
|
92986
93014
|
// First char after `:`, branch on `+` for :+1:, otherwise start normal name
|
|
92987
93015
|
const nameStart = (code) => {
|
|
92988
|
-
if (code ===
|
|
93016
|
+
if (code === codes_codes.plusSign) {
|
|
92989
93017
|
effects.consume(code); // +
|
|
92990
93018
|
return plusOne;
|
|
92991
93019
|
}
|
|
@@ -93000,7 +93028,7 @@ function tokenize(effects, ok, nok) {
|
|
|
93000
93028
|
// After `+`, only `1` is valid (for :+1:), anything else rejects
|
|
93001
93029
|
// this is a special case for :+1: 👍 since + isnt a normal name character
|
|
93002
93030
|
const plusOne = (code) => {
|
|
93003
|
-
if (code ===
|
|
93031
|
+
if (code === codes_codes.digit1) {
|
|
93004
93032
|
hasName = true;
|
|
93005
93033
|
effects.consume(code); // 1
|
|
93006
93034
|
return nameEnd;
|
|
@@ -93009,7 +93037,7 @@ function tokenize(effects, ok, nok) {
|
|
|
93009
93037
|
};
|
|
93010
93038
|
// Consume name characters until we hit closing `:` or an invalid char
|
|
93011
93039
|
const name = (code) => {
|
|
93012
|
-
if (code ===
|
|
93040
|
+
if (code === codes_codes.colon) {
|
|
93013
93041
|
if (!hasName)
|
|
93014
93042
|
return nok(code);
|
|
93015
93043
|
return nameEnd(code);
|
|
@@ -93023,7 +93051,7 @@ function tokenize(effects, ok, nok) {
|
|
|
93023
93051
|
};
|
|
93024
93052
|
// Expect closing `:`
|
|
93025
93053
|
const nameEnd = (code) => {
|
|
93026
|
-
if (code !==
|
|
93054
|
+
if (code !== codes_codes.colon)
|
|
93027
93055
|
return nok(code);
|
|
93028
93056
|
effects.exit('gemojiName');
|
|
93029
93057
|
effects.enter('gemojiMarker');
|
|
@@ -93036,7 +93064,7 @@ function tokenize(effects, ok, nok) {
|
|
|
93036
93064
|
}
|
|
93037
93065
|
function syntax_gemoji() {
|
|
93038
93066
|
return {
|
|
93039
|
-
text: { [
|
|
93067
|
+
text: { [codes_codes.colon]: gemojiConstruct },
|
|
93040
93068
|
};
|
|
93041
93069
|
}
|
|
93042
93070
|
|
|
@@ -93051,8 +93079,8 @@ function syntax_gemoji() {
|
|
|
93051
93079
|
|
|
93052
93080
|
function isAllowedValueChar(code) {
|
|
93053
93081
|
return (code !== null &&
|
|
93054
|
-
code !==
|
|
93055
|
-
code !==
|
|
93082
|
+
code !== codes_codes.lessThan &&
|
|
93083
|
+
code !== codes_codes.greaterThan &&
|
|
93056
93084
|
!markdownLineEnding(code));
|
|
93057
93085
|
}
|
|
93058
93086
|
const legacyVariableConstruct = {
|
|
@@ -93062,7 +93090,7 @@ const legacyVariableConstruct = {
|
|
|
93062
93090
|
function syntax_tokenize(effects, ok, nok) {
|
|
93063
93091
|
let hasValue = false;
|
|
93064
93092
|
const start = (code) => {
|
|
93065
|
-
if (code !==
|
|
93093
|
+
if (code !== codes_codes.lessThan)
|
|
93066
93094
|
return nok(code);
|
|
93067
93095
|
effects.enter('legacyVariable');
|
|
93068
93096
|
effects.enter('legacyVariableMarkerStart');
|
|
@@ -93070,7 +93098,7 @@ function syntax_tokenize(effects, ok, nok) {
|
|
|
93070
93098
|
return open2;
|
|
93071
93099
|
};
|
|
93072
93100
|
const open2 = (code) => {
|
|
93073
|
-
if (code !==
|
|
93101
|
+
if (code !== codes_codes.lessThan)
|
|
93074
93102
|
return nok(code);
|
|
93075
93103
|
effects.consume(code); // <<
|
|
93076
93104
|
effects.exit('legacyVariableMarkerStart');
|
|
@@ -93078,7 +93106,7 @@ function syntax_tokenize(effects, ok, nok) {
|
|
|
93078
93106
|
return value;
|
|
93079
93107
|
};
|
|
93080
93108
|
const value = (code) => {
|
|
93081
|
-
if (code ===
|
|
93109
|
+
if (code === codes_codes.greaterThan) {
|
|
93082
93110
|
if (!hasValue)
|
|
93083
93111
|
return nok(code);
|
|
93084
93112
|
effects.exit('legacyVariableValue');
|
|
@@ -93093,7 +93121,7 @@ function syntax_tokenize(effects, ok, nok) {
|
|
|
93093
93121
|
return value;
|
|
93094
93122
|
};
|
|
93095
93123
|
const close2 = (code) => {
|
|
93096
|
-
if (code !==
|
|
93124
|
+
if (code !== codes_codes.greaterThan)
|
|
93097
93125
|
return nok(code);
|
|
93098
93126
|
effects.consume(code); // >>
|
|
93099
93127
|
effects.exit('legacyVariableMarkerEnd');
|
|
@@ -93104,7 +93132,7 @@ function syntax_tokenize(effects, ok, nok) {
|
|
|
93104
93132
|
}
|
|
93105
93133
|
function legacyVariable() {
|
|
93106
93134
|
return {
|
|
93107
|
-
text: { [
|
|
93135
|
+
text: { [codes_codes.lessThan]: legacyVariableConstruct },
|
|
93108
93136
|
};
|
|
93109
93137
|
}
|
|
93110
93138
|
|
|
@@ -95942,6 +95970,32 @@ const applyInserts = (html, inserts) => {
|
|
|
95942
95970
|
return { value: out + html.slice(cursor), inserts: sorted };
|
|
95943
95971
|
};
|
|
95944
95972
|
|
|
95973
|
+
;// ./processor/transform/mdxish/tables/escape-stray-less-than.ts
|
|
95974
|
+
|
|
95975
|
+
|
|
95976
|
+
// A `<` only starts a JSX/HTML construct when followed by a tag-name start
|
|
95977
|
+
// (letter, `_`, `$`), a closer `/`, a fragment `>`, or a comment/declaration
|
|
95978
|
+
// `!`. Anything else (whitespace, EOL, a digit, …) is a literal `<` that acorn
|
|
95979
|
+
// rejects with "before name, expected a character that can start a name".
|
|
95980
|
+
const STRAY_LESS_THAN_RE = /<(?![a-zA-Z_$/>!])/g;
|
|
95981
|
+
/**
|
|
95982
|
+
* Escapes stray `<` characters that don't begin a valid tag so the strict mdxjs
|
|
95983
|
+
* parse treats them as literal text instead of throwing (`word <`, `a <1>`).
|
|
95984
|
+
*
|
|
95985
|
+
* Runs against the masked source so `<` inside code spans, legacy `<<var>>`
|
|
95986
|
+
* syntax, or already-escaped `\<` are left untouched.
|
|
95987
|
+
*/
|
|
95988
|
+
const escapeStrayLessThan = (html) => {
|
|
95989
|
+
const masked = maskNonTagRegions(html);
|
|
95990
|
+
const inserts = [];
|
|
95991
|
+
STRAY_LESS_THAN_RE.lastIndex = 0;
|
|
95992
|
+
let match;
|
|
95993
|
+
while ((match = STRAY_LESS_THAN_RE.exec(masked)) !== null) {
|
|
95994
|
+
inserts.push({ offset: match.index, text: '\\' });
|
|
95995
|
+
}
|
|
95996
|
+
return applyInserts(html, inserts);
|
|
95997
|
+
};
|
|
95998
|
+
|
|
95945
95999
|
;// ./processor/transform/mdxish/tables/normalize-tag-spacing.ts
|
|
95946
96000
|
|
|
95947
96001
|
|
|
@@ -96441,6 +96495,7 @@ const repairUnclosedTags = (html) => {
|
|
|
96441
96495
|
|
|
96442
96496
|
|
|
96443
96497
|
|
|
96498
|
+
|
|
96444
96499
|
|
|
96445
96500
|
|
|
96446
96501
|
const isTableCell = (node) => utils_isMDXElement(node) && ['th', 'td'].includes(node.name);
|
|
@@ -96727,11 +96782,14 @@ const mdxish_tables_mdxishTables = () => tree => {
|
|
|
96727
96782
|
// - normalizeTagSpacing: a line mixing text and an opening tag
|
|
96728
96783
|
// (e.g. `text <div> \n <div> text`)
|
|
96729
96784
|
// - repairExpressionEscapes: backslash escapes inside a `{…}` expression
|
|
96785
|
+
// - escapeStrayLessThan: a `<` that doesn't begin a valid tag
|
|
96786
|
+
// (e.g. `word <`, `a <1>`)
|
|
96730
96787
|
// These repairs are created after seeing real customer content that has failed to parse
|
|
96731
96788
|
const repairs = [
|
|
96732
96789
|
repairUnclosedTags,
|
|
96733
96790
|
normalizeTagSpacing,
|
|
96734
96791
|
repairExpressionEscapes,
|
|
96792
|
+
escapeStrayLessThan,
|
|
96735
96793
|
];
|
|
96736
96794
|
// Stops at the first repair that yields a parseable tree
|
|
96737
96795
|
repairs.some(repair => {
|
|
@@ -117470,6 +117528,21 @@ function isActualHtmlTag(tagName, originalExcerpt) {
|
|
|
117470
117528
|
return true;
|
|
117471
117529
|
return false;
|
|
117472
117530
|
}
|
|
117531
|
+
/**
|
|
117532
|
+
* Re-parsing a component's text child treats it as a standalone document, so
|
|
117533
|
+
* content that happens to start with the literal word `export`/`import`
|
|
117534
|
+
* (e.g. link text like "export Lorem Ipsum") sits at true column 1 and
|
|
117535
|
+
* gets mistaken for an MDX ESM statement, which then fails to parse as JS.
|
|
117536
|
+
* Fall back to `undefined` rather than letting one such child crash the page.
|
|
117537
|
+
*/
|
|
117538
|
+
function tryProcessMarkdown(processMarkdown, content) {
|
|
117539
|
+
try {
|
|
117540
|
+
return processMarkdown(content);
|
|
117541
|
+
}
|
|
117542
|
+
catch {
|
|
117543
|
+
return undefined;
|
|
117544
|
+
}
|
|
117545
|
+
}
|
|
117473
117546
|
/** Parse and replace text children with processed markdown */
|
|
117474
117547
|
function parseTextChildren(node, processMarkdown, components) {
|
|
117475
117548
|
if (!node.children?.length)
|
|
@@ -117484,7 +117557,9 @@ function parseTextChildren(node, processMarkdown, components) {
|
|
|
117484
117557
|
node.properties = { ...node.properties, children: child.value };
|
|
117485
117558
|
return [];
|
|
117486
117559
|
}
|
|
117487
|
-
const hast = processMarkdown
|
|
117560
|
+
const hast = tryProcessMarkdown(processMarkdown, child.value.trim());
|
|
117561
|
+
if (!hast)
|
|
117562
|
+
return [child];
|
|
117488
117563
|
const children = (hast.children ?? []).filter(isElementContentNode);
|
|
117489
117564
|
// For inline components, preserve plain text instead of wrapping in <p>
|
|
117490
117565
|
if (INLINE_COMPONENT_TAGS_LOWER.has(node.tagName.toLowerCase()) && isSingleParagraphTextNode(children)) {
|
|
@@ -117558,8 +117633,9 @@ const rehypeMdxishComponents = ({ components, processMarkdown }) => {
|
|
|
117558
117633
|
// rehypeRaw strips children from <img> (void element), so we must
|
|
117559
117634
|
// re-process the caption here, after rehypeRaw.
|
|
117560
117635
|
if (node.tagName === 'img' && typeof node.properties?.caption === 'string' && !node.children?.length) {
|
|
117561
|
-
const
|
|
117562
|
-
|
|
117636
|
+
const caption = node.properties.caption;
|
|
117637
|
+
const captionHast = tryProcessMarkdown(processMarkdown, caption);
|
|
117638
|
+
node.children = captionHast ? (captionHast.children ?? []).filter(isElementContentNode) : [{ type: 'text', value: caption }];
|
|
117563
117639
|
}
|
|
117564
117640
|
// Skip runtime components and standard HTML tags
|
|
117565
117641
|
if (RUNTIME_COMPONENT_TAGS.has(node.tagName))
|
|
@@ -118288,7 +118364,7 @@ const KNOWN_BLOCK_TYPES = new Set([
|
|
|
118288
118364
|
* Types can contain alphanumeric characters and hyphens (e.g., "api-header", "tutorial-tile")
|
|
118289
118365
|
*/
|
|
118290
118366
|
function isTypeChar(code) {
|
|
118291
|
-
return asciiAlphanumeric(code) || code ===
|
|
118367
|
+
return asciiAlphanumeric(code) || code === codes_codes.dash;
|
|
118292
118368
|
}
|
|
118293
118369
|
/**
|
|
118294
118370
|
* Creates the opening marker state machine: [block:
|
|
@@ -118296,37 +118372,37 @@ function isTypeChar(code) {
|
|
|
118296
118372
|
*/
|
|
118297
118373
|
function createOpeningMarkerParser(effects, nok, onComplete) {
|
|
118298
118374
|
const expectB = (code) => {
|
|
118299
|
-
if (code !==
|
|
118375
|
+
if (code !== codes_codes.lowercaseB)
|
|
118300
118376
|
return nok(code);
|
|
118301
118377
|
effects.consume(code);
|
|
118302
118378
|
return expectL;
|
|
118303
118379
|
};
|
|
118304
118380
|
const expectL = (code) => {
|
|
118305
|
-
if (code !==
|
|
118381
|
+
if (code !== codes_codes.lowercaseL)
|
|
118306
118382
|
return nok(code);
|
|
118307
118383
|
effects.consume(code);
|
|
118308
118384
|
return expectO;
|
|
118309
118385
|
};
|
|
118310
118386
|
const expectO = (code) => {
|
|
118311
|
-
if (code !==
|
|
118387
|
+
if (code !== codes_codes.lowercaseO)
|
|
118312
118388
|
return nok(code);
|
|
118313
118389
|
effects.consume(code);
|
|
118314
118390
|
return expectC;
|
|
118315
118391
|
};
|
|
118316
118392
|
const expectC = (code) => {
|
|
118317
|
-
if (code !==
|
|
118393
|
+
if (code !== codes_codes.lowercaseC)
|
|
118318
118394
|
return nok(code);
|
|
118319
118395
|
effects.consume(code);
|
|
118320
118396
|
return expectK;
|
|
118321
118397
|
};
|
|
118322
118398
|
const expectK = (code) => {
|
|
118323
|
-
if (code !==
|
|
118399
|
+
if (code !== codes_codes.lowercaseK)
|
|
118324
118400
|
return nok(code);
|
|
118325
118401
|
effects.consume(code);
|
|
118326
118402
|
return expectColon;
|
|
118327
118403
|
};
|
|
118328
118404
|
const expectColon = (code) => {
|
|
118329
|
-
if (code !==
|
|
118405
|
+
if (code !== codes_codes.colon)
|
|
118330
118406
|
return nok(code);
|
|
118331
118407
|
effects.consume(code);
|
|
118332
118408
|
effects.exit('magicBlockMarkerStart');
|
|
@@ -118342,7 +118418,7 @@ function createOpeningMarkerParser(effects, nok, onComplete) {
|
|
|
118342
118418
|
function createTypeCaptureParser(effects, nok, onComplete, blockTypeRef) {
|
|
118343
118419
|
const captureTypeFirst = (code) => {
|
|
118344
118420
|
// Reject empty type name [block:]
|
|
118345
|
-
if (code ===
|
|
118421
|
+
if (code === codes_codes.rightSquareBracket) {
|
|
118346
118422
|
return nok(code);
|
|
118347
118423
|
}
|
|
118348
118424
|
if (isTypeChar(code)) {
|
|
@@ -118353,7 +118429,7 @@ function createTypeCaptureParser(effects, nok, onComplete, blockTypeRef) {
|
|
|
118353
118429
|
return nok(code);
|
|
118354
118430
|
};
|
|
118355
118431
|
const captureType = (code) => {
|
|
118356
|
-
if (code ===
|
|
118432
|
+
if (code === codes_codes.rightSquareBracket) {
|
|
118357
118433
|
if (!KNOWN_BLOCK_TYPES.has(blockTypeRef.value)) {
|
|
118358
118434
|
return nok(code);
|
|
118359
118435
|
}
|
|
@@ -118378,7 +118454,7 @@ function createTypeCaptureParser(effects, nok, onComplete, blockTypeRef) {
|
|
|
118378
118454
|
*/
|
|
118379
118455
|
function createClosingMarkerParser(effects, onSuccess, onMismatch, onEof, jsonState) {
|
|
118380
118456
|
const handleMismatch = (code) => {
|
|
118381
|
-
if (jsonState && code ===
|
|
118457
|
+
if (jsonState && code === codes_codes.quotationMark) {
|
|
118382
118458
|
jsonState.inString = true;
|
|
118383
118459
|
}
|
|
118384
118460
|
return onMismatch(code);
|
|
@@ -118386,7 +118462,7 @@ function createClosingMarkerParser(effects, onSuccess, onMismatch, onEof, jsonSt
|
|
|
118386
118462
|
const expectSlash = (code) => {
|
|
118387
118463
|
if (code === null)
|
|
118388
118464
|
return onEof(code);
|
|
118389
|
-
if (code !==
|
|
118465
|
+
if (code !== codes_codes.slash)
|
|
118390
118466
|
return handleMismatch(code);
|
|
118391
118467
|
effects.consume(code);
|
|
118392
118468
|
return expectB;
|
|
@@ -118394,7 +118470,7 @@ function createClosingMarkerParser(effects, onSuccess, onMismatch, onEof, jsonSt
|
|
|
118394
118470
|
const expectB = (code) => {
|
|
118395
118471
|
if (code === null)
|
|
118396
118472
|
return onEof(code);
|
|
118397
|
-
if (code !==
|
|
118473
|
+
if (code !== codes_codes.lowercaseB)
|
|
118398
118474
|
return handleMismatch(code);
|
|
118399
118475
|
effects.consume(code);
|
|
118400
118476
|
return expectL;
|
|
@@ -118402,7 +118478,7 @@ function createClosingMarkerParser(effects, onSuccess, onMismatch, onEof, jsonSt
|
|
|
118402
118478
|
const expectL = (code) => {
|
|
118403
118479
|
if (code === null)
|
|
118404
118480
|
return onEof(code);
|
|
118405
|
-
if (code !==
|
|
118481
|
+
if (code !== codes_codes.lowercaseL)
|
|
118406
118482
|
return handleMismatch(code);
|
|
118407
118483
|
effects.consume(code);
|
|
118408
118484
|
return expectO;
|
|
@@ -118410,7 +118486,7 @@ function createClosingMarkerParser(effects, onSuccess, onMismatch, onEof, jsonSt
|
|
|
118410
118486
|
const expectO = (code) => {
|
|
118411
118487
|
if (code === null)
|
|
118412
118488
|
return onEof(code);
|
|
118413
|
-
if (code !==
|
|
118489
|
+
if (code !== codes_codes.lowercaseO)
|
|
118414
118490
|
return handleMismatch(code);
|
|
118415
118491
|
effects.consume(code);
|
|
118416
118492
|
return expectC;
|
|
@@ -118418,7 +118494,7 @@ function createClosingMarkerParser(effects, onSuccess, onMismatch, onEof, jsonSt
|
|
|
118418
118494
|
const expectC = (code) => {
|
|
118419
118495
|
if (code === null)
|
|
118420
118496
|
return onEof(code);
|
|
118421
|
-
if (code !==
|
|
118497
|
+
if (code !== codes_codes.lowercaseC)
|
|
118422
118498
|
return handleMismatch(code);
|
|
118423
118499
|
effects.consume(code);
|
|
118424
118500
|
return expectK;
|
|
@@ -118426,7 +118502,7 @@ function createClosingMarkerParser(effects, onSuccess, onMismatch, onEof, jsonSt
|
|
|
118426
118502
|
const expectK = (code) => {
|
|
118427
118503
|
if (code === null)
|
|
118428
118504
|
return onEof(code);
|
|
118429
|
-
if (code !==
|
|
118505
|
+
if (code !== codes_codes.lowercaseK)
|
|
118430
118506
|
return handleMismatch(code);
|
|
118431
118507
|
effects.consume(code);
|
|
118432
118508
|
return expectBracket;
|
|
@@ -118434,7 +118510,7 @@ function createClosingMarkerParser(effects, onSuccess, onMismatch, onEof, jsonSt
|
|
|
118434
118510
|
const expectBracket = (code) => {
|
|
118435
118511
|
if (code === null)
|
|
118436
118512
|
return onEof(code);
|
|
118437
|
-
if (code !==
|
|
118513
|
+
if (code !== codes_codes.rightSquareBracket)
|
|
118438
118514
|
return handleMismatch(code);
|
|
118439
118515
|
effects.consume(code);
|
|
118440
118516
|
return onSuccess;
|
|
@@ -118490,7 +118566,7 @@ function syntax_magicBlock() {
|
|
|
118490
118566
|
// Flow construct - handles block-level magic blocks at document root
|
|
118491
118567
|
// Marked as concrete to prevent interruption by containers
|
|
118492
118568
|
flow: {
|
|
118493
|
-
[
|
|
118569
|
+
[codes_codes.leftSquareBracket]: {
|
|
118494
118570
|
name: 'magicBlock',
|
|
118495
118571
|
concrete: true,
|
|
118496
118572
|
tokenize: tokenizeMagicBlockFlow,
|
|
@@ -118498,7 +118574,7 @@ function syntax_magicBlock() {
|
|
|
118498
118574
|
},
|
|
118499
118575
|
// Text construct - handles magic blocks in inline contexts (lists, paragraphs)
|
|
118500
118576
|
text: {
|
|
118501
|
-
[
|
|
118577
|
+
[codes_codes.leftSquareBracket]: {
|
|
118502
118578
|
name: 'magicBlock',
|
|
118503
118579
|
tokenize: tokenizeMagicBlockText,
|
|
118504
118580
|
},
|
|
@@ -118519,7 +118595,7 @@ function tokenizeMagicBlockFlow(effects, ok, nok) {
|
|
|
118519
118595
|
const openingMarkerParser = createOpeningMarkerParser(effects, nok, typeParser.first);
|
|
118520
118596
|
return start;
|
|
118521
118597
|
function start(code) {
|
|
118522
|
-
if (code !==
|
|
118598
|
+
if (code !== codes_codes.leftSquareBracket)
|
|
118523
118599
|
return nok(code);
|
|
118524
118600
|
effects.enter('magicBlock');
|
|
118525
118601
|
effects.enter('magicBlockMarkerStart');
|
|
@@ -118542,7 +118618,7 @@ function tokenizeMagicBlockFlow(effects, ok, nok) {
|
|
|
118542
118618
|
// Check for closing marker directly (without entering data)
|
|
118543
118619
|
// This handles cases like [block:type]\n{}\n\n[/block] where there are
|
|
118544
118620
|
// newlines after the data object
|
|
118545
|
-
if (code ===
|
|
118621
|
+
if (code === codes_codes.leftSquareBracket) {
|
|
118546
118622
|
effects.enter('magicBlockMarkerEnd');
|
|
118547
118623
|
effects.consume(code);
|
|
118548
118624
|
return expectSlashFromContinuation;
|
|
@@ -118554,11 +118630,11 @@ function tokenizeMagicBlockFlow(effects, ok, nok) {
|
|
|
118554
118630
|
}
|
|
118555
118631
|
// Skip whitespace (spaces/tabs) before the data - stay in beforeData
|
|
118556
118632
|
// Don't enter magicBlockData token yet until we confirm there's a '{'
|
|
118557
|
-
if (code ===
|
|
118633
|
+
if (code === codes_codes.space || code === codes_codes.horizontalTab) {
|
|
118558
118634
|
return beforeDataWhitespace(code);
|
|
118559
118635
|
}
|
|
118560
118636
|
// Data must start with '{' for valid JSON
|
|
118561
|
-
if (code !==
|
|
118637
|
+
if (code !== codes_codes.leftCurlyBrace) {
|
|
118562
118638
|
effects.exit('magicBlock');
|
|
118563
118639
|
return nok(code);
|
|
118564
118640
|
}
|
|
@@ -118579,14 +118655,14 @@ function tokenizeMagicBlockFlow(effects, ok, nok) {
|
|
|
118579
118655
|
if (markdownLineEnding(code)) {
|
|
118580
118656
|
return effects.check(syntax_nonLazyContinuation, continuationOkBeforeData, after)(code);
|
|
118581
118657
|
}
|
|
118582
|
-
if (code ===
|
|
118658
|
+
if (code === codes_codes.space || code === codes_codes.horizontalTab) {
|
|
118583
118659
|
// We need to consume this but can't without a token - use magicBlockData
|
|
118584
118660
|
// and track that we haven't seen '{' yet
|
|
118585
118661
|
effects.enter('magicBlockData');
|
|
118586
118662
|
effects.consume(code);
|
|
118587
118663
|
return beforeDataWhitespaceContinue;
|
|
118588
118664
|
}
|
|
118589
|
-
if (code ===
|
|
118665
|
+
if (code === codes_codes.leftCurlyBrace) {
|
|
118590
118666
|
seenOpenBrace = true;
|
|
118591
118667
|
effects.enter('magicBlockData');
|
|
118592
118668
|
return captureData(code);
|
|
@@ -118607,11 +118683,11 @@ function tokenizeMagicBlockFlow(effects, ok, nok) {
|
|
|
118607
118683
|
effects.exit('magicBlockData');
|
|
118608
118684
|
return effects.check(syntax_nonLazyContinuation, continuationOk, after)(code);
|
|
118609
118685
|
}
|
|
118610
|
-
if (code ===
|
|
118686
|
+
if (code === codes_codes.space || code === codes_codes.horizontalTab) {
|
|
118611
118687
|
effects.consume(code);
|
|
118612
118688
|
return beforeDataWhitespaceContinue;
|
|
118613
118689
|
}
|
|
118614
|
-
if (code ===
|
|
118690
|
+
if (code === codes_codes.leftCurlyBrace) {
|
|
118615
118691
|
seenOpenBrace = true;
|
|
118616
118692
|
return captureData(code);
|
|
118617
118693
|
}
|
|
@@ -118646,23 +118722,23 @@ function tokenizeMagicBlockFlow(effects, ok, nok) {
|
|
|
118646
118722
|
return captureData;
|
|
118647
118723
|
}
|
|
118648
118724
|
if (jsonState.inString) {
|
|
118649
|
-
if (code ===
|
|
118725
|
+
if (code === codes_codes.backslash) {
|
|
118650
118726
|
jsonState.escapeNext = true;
|
|
118651
118727
|
effects.consume(code);
|
|
118652
118728
|
return captureData;
|
|
118653
118729
|
}
|
|
118654
|
-
if (code ===
|
|
118730
|
+
if (code === codes_codes.quotationMark) {
|
|
118655
118731
|
jsonState.inString = false;
|
|
118656
118732
|
}
|
|
118657
118733
|
effects.consume(code);
|
|
118658
118734
|
return captureData;
|
|
118659
118735
|
}
|
|
118660
|
-
if (code ===
|
|
118736
|
+
if (code === codes_codes.quotationMark) {
|
|
118661
118737
|
jsonState.inString = true;
|
|
118662
118738
|
effects.consume(code);
|
|
118663
118739
|
return captureData;
|
|
118664
118740
|
}
|
|
118665
|
-
if (code ===
|
|
118741
|
+
if (code === codes_codes.leftSquareBracket) {
|
|
118666
118742
|
effects.exit('magicBlockData');
|
|
118667
118743
|
effects.enter('magicBlockMarkerEnd');
|
|
118668
118744
|
effects.consume(code);
|
|
@@ -118695,7 +118771,7 @@ function tokenizeMagicBlockFlow(effects, ok, nok) {
|
|
|
118695
118771
|
}
|
|
118696
118772
|
// Check if this is the start of the closing marker [/block]
|
|
118697
118773
|
// If so, handle it directly without entering magicBlockData
|
|
118698
|
-
if (code ===
|
|
118774
|
+
if (code === codes_codes.leftSquareBracket) {
|
|
118699
118775
|
effects.enter('magicBlockMarkerEnd');
|
|
118700
118776
|
effects.consume(code);
|
|
118701
118777
|
return expectSlashFromContinuation;
|
|
@@ -118717,7 +118793,7 @@ function tokenizeMagicBlockFlow(effects, ok, nok) {
|
|
|
118717
118793
|
effects.exit('magicBlockMarkerEnd');
|
|
118718
118794
|
return effects.check(syntax_nonLazyContinuation, continuationOkBeforeData, after)(code);
|
|
118719
118795
|
}
|
|
118720
|
-
if (code ===
|
|
118796
|
+
if (code === codes_codes.slash) {
|
|
118721
118797
|
effects.consume(code);
|
|
118722
118798
|
return expectClosingB;
|
|
118723
118799
|
}
|
|
@@ -118728,7 +118804,7 @@ function tokenizeMagicBlockFlow(effects, ok, nok) {
|
|
|
118728
118804
|
// The [ was consumed by the marker, so we need to conceptually "have it" in our data
|
|
118729
118805
|
// But since we already consumed it into the marker, we need a different approach
|
|
118730
118806
|
// Re-classify: consume this character as data and continue
|
|
118731
|
-
if (code ===
|
|
118807
|
+
if (code === codes_codes.quotationMark)
|
|
118732
118808
|
jsonState.inString = true;
|
|
118733
118809
|
effects.consume(code);
|
|
118734
118810
|
return captureData;
|
|
@@ -118744,10 +118820,10 @@ function tokenizeMagicBlockFlow(effects, ok, nok) {
|
|
|
118744
118820
|
effects.exit('magicBlockMarkerEnd');
|
|
118745
118821
|
return effects.check(syntax_nonLazyContinuation, continuationOk, after)(code);
|
|
118746
118822
|
}
|
|
118747
|
-
if (code !==
|
|
118823
|
+
if (code !== codes_codes.slash) {
|
|
118748
118824
|
effects.exit('magicBlockMarkerEnd');
|
|
118749
118825
|
effects.enter('magicBlockData');
|
|
118750
|
-
if (code ===
|
|
118826
|
+
if (code === codes_codes.quotationMark)
|
|
118751
118827
|
jsonState.inString = true;
|
|
118752
118828
|
effects.consume(code);
|
|
118753
118829
|
return captureData;
|
|
@@ -118761,10 +118837,10 @@ function tokenizeMagicBlockFlow(effects, ok, nok) {
|
|
|
118761
118837
|
effects.exit('magicBlock');
|
|
118762
118838
|
return nok(code);
|
|
118763
118839
|
}
|
|
118764
|
-
if (code !==
|
|
118840
|
+
if (code !== codes_codes.lowercaseB) {
|
|
118765
118841
|
effects.exit('magicBlockMarkerEnd');
|
|
118766
118842
|
effects.enter('magicBlockData');
|
|
118767
|
-
if (code ===
|
|
118843
|
+
if (code === codes_codes.quotationMark)
|
|
118768
118844
|
jsonState.inString = true;
|
|
118769
118845
|
effects.consume(code);
|
|
118770
118846
|
return captureData;
|
|
@@ -118778,10 +118854,10 @@ function tokenizeMagicBlockFlow(effects, ok, nok) {
|
|
|
118778
118854
|
effects.exit('magicBlock');
|
|
118779
118855
|
return nok(code);
|
|
118780
118856
|
}
|
|
118781
|
-
if (code !==
|
|
118857
|
+
if (code !== codes_codes.lowercaseL) {
|
|
118782
118858
|
effects.exit('magicBlockMarkerEnd');
|
|
118783
118859
|
effects.enter('magicBlockData');
|
|
118784
|
-
if (code ===
|
|
118860
|
+
if (code === codes_codes.quotationMark)
|
|
118785
118861
|
jsonState.inString = true;
|
|
118786
118862
|
effects.consume(code);
|
|
118787
118863
|
return captureData;
|
|
@@ -118795,10 +118871,10 @@ function tokenizeMagicBlockFlow(effects, ok, nok) {
|
|
|
118795
118871
|
effects.exit('magicBlock');
|
|
118796
118872
|
return nok(code);
|
|
118797
118873
|
}
|
|
118798
|
-
if (code !==
|
|
118874
|
+
if (code !== codes_codes.lowercaseO) {
|
|
118799
118875
|
effects.exit('magicBlockMarkerEnd');
|
|
118800
118876
|
effects.enter('magicBlockData');
|
|
118801
|
-
if (code ===
|
|
118877
|
+
if (code === codes_codes.quotationMark)
|
|
118802
118878
|
jsonState.inString = true;
|
|
118803
118879
|
effects.consume(code);
|
|
118804
118880
|
return captureData;
|
|
@@ -118812,10 +118888,10 @@ function tokenizeMagicBlockFlow(effects, ok, nok) {
|
|
|
118812
118888
|
effects.exit('magicBlock');
|
|
118813
118889
|
return nok(code);
|
|
118814
118890
|
}
|
|
118815
|
-
if (code !==
|
|
118891
|
+
if (code !== codes_codes.lowercaseC) {
|
|
118816
118892
|
effects.exit('magicBlockMarkerEnd');
|
|
118817
118893
|
effects.enter('magicBlockData');
|
|
118818
|
-
if (code ===
|
|
118894
|
+
if (code === codes_codes.quotationMark)
|
|
118819
118895
|
jsonState.inString = true;
|
|
118820
118896
|
effects.consume(code);
|
|
118821
118897
|
return captureData;
|
|
@@ -118829,10 +118905,10 @@ function tokenizeMagicBlockFlow(effects, ok, nok) {
|
|
|
118829
118905
|
effects.exit('magicBlock');
|
|
118830
118906
|
return nok(code);
|
|
118831
118907
|
}
|
|
118832
|
-
if (code !==
|
|
118908
|
+
if (code !== codes_codes.lowercaseK) {
|
|
118833
118909
|
effects.exit('magicBlockMarkerEnd');
|
|
118834
118910
|
effects.enter('magicBlockData');
|
|
118835
|
-
if (code ===
|
|
118911
|
+
if (code === codes_codes.quotationMark)
|
|
118836
118912
|
jsonState.inString = true;
|
|
118837
118913
|
effects.consume(code);
|
|
118838
118914
|
return captureData;
|
|
@@ -118846,10 +118922,10 @@ function tokenizeMagicBlockFlow(effects, ok, nok) {
|
|
|
118846
118922
|
effects.exit('magicBlock');
|
|
118847
118923
|
return nok(code);
|
|
118848
118924
|
}
|
|
118849
|
-
if (code !==
|
|
118925
|
+
if (code !== codes_codes.rightSquareBracket) {
|
|
118850
118926
|
effects.exit('magicBlockMarkerEnd');
|
|
118851
118927
|
effects.enter('magicBlockData');
|
|
118852
|
-
if (code ===
|
|
118928
|
+
if (code === codes_codes.quotationMark)
|
|
118853
118929
|
jsonState.inString = true;
|
|
118854
118930
|
effects.consume(code);
|
|
118855
118931
|
return captureData;
|
|
@@ -118876,7 +118952,7 @@ function tokenizeMagicBlockFlow(effects, ok, nok) {
|
|
|
118876
118952
|
return ok(code);
|
|
118877
118953
|
}
|
|
118878
118954
|
// Space or tab - consume as trailing whitespace
|
|
118879
|
-
if (code ===
|
|
118955
|
+
if (code === codes_codes.space || code === codes_codes.horizontalTab) {
|
|
118880
118956
|
effects.enter('magicBlockTrailing');
|
|
118881
118957
|
effects.consume(code);
|
|
118882
118958
|
return consumeTrailingContinue;
|
|
@@ -118902,7 +118978,7 @@ function tokenizeMagicBlockFlow(effects, ok, nok) {
|
|
|
118902
118978
|
return ok(code);
|
|
118903
118979
|
}
|
|
118904
118980
|
// More space or tab - keep consuming
|
|
118905
|
-
if (code ===
|
|
118981
|
+
if (code === codes_codes.space || code === codes_codes.horizontalTab) {
|
|
118906
118982
|
effects.consume(code);
|
|
118907
118983
|
return consumeTrailingContinue;
|
|
118908
118984
|
}
|
|
@@ -118942,7 +119018,7 @@ function tokenizeMagicBlockText(effects, ok, nok) {
|
|
|
118942
119018
|
const closingMismatch = (code) => {
|
|
118943
119019
|
effects.exit('magicBlockMarkerEnd');
|
|
118944
119020
|
effects.enter('magicBlockData');
|
|
118945
|
-
if (code ===
|
|
119021
|
+
if (code === codes_codes.quotationMark)
|
|
118946
119022
|
jsonState.inString = true;
|
|
118947
119023
|
effects.consume(code);
|
|
118948
119024
|
return captureData;
|
|
@@ -118954,7 +119030,7 @@ function tokenizeMagicBlockText(effects, ok, nok) {
|
|
|
118954
119030
|
const closingFromData = createClosingMarkerParser(effects, closingSuccess, closingMismatch, closingEof, jsonState);
|
|
118955
119031
|
return start;
|
|
118956
119032
|
function start(code) {
|
|
118957
|
-
if (code !==
|
|
119033
|
+
if (code !== codes_codes.leftSquareBracket)
|
|
118958
119034
|
return nok(code);
|
|
118959
119035
|
effects.enter('magicBlock');
|
|
118960
119036
|
effects.enter('magicBlockMarkerStart');
|
|
@@ -118978,7 +119054,7 @@ function tokenizeMagicBlockText(effects, ok, nok) {
|
|
|
118978
119054
|
return beforeData;
|
|
118979
119055
|
}
|
|
118980
119056
|
// Check for closing marker directly (without entering data)
|
|
118981
|
-
if (code ===
|
|
119057
|
+
if (code === codes_codes.leftSquareBracket) {
|
|
118982
119058
|
effects.enter('magicBlockMarkerEnd');
|
|
118983
119059
|
effects.consume(code);
|
|
118984
119060
|
return closingFromBeforeData.expectSlash;
|
|
@@ -118989,11 +119065,11 @@ function tokenizeMagicBlockText(effects, ok, nok) {
|
|
|
118989
119065
|
return captureData(code);
|
|
118990
119066
|
}
|
|
118991
119067
|
// Skip whitespace (spaces/tabs) before the data
|
|
118992
|
-
if (code ===
|
|
119068
|
+
if (code === codes_codes.space || code === codes_codes.horizontalTab) {
|
|
118993
119069
|
return beforeDataWhitespace(code);
|
|
118994
119070
|
}
|
|
118995
119071
|
// Data must start with '{' for valid JSON
|
|
118996
|
-
if (code !==
|
|
119072
|
+
if (code !== codes_codes.leftCurlyBrace) {
|
|
118997
119073
|
return nok(code);
|
|
118998
119074
|
}
|
|
118999
119075
|
// We have '{' - enter data token and start capturing
|
|
@@ -119014,12 +119090,12 @@ function tokenizeMagicBlockText(effects, ok, nok) {
|
|
|
119014
119090
|
effects.exit('magicBlockLineEnding');
|
|
119015
119091
|
return beforeData;
|
|
119016
119092
|
}
|
|
119017
|
-
if (code ===
|
|
119093
|
+
if (code === codes_codes.space || code === codes_codes.horizontalTab) {
|
|
119018
119094
|
effects.enter('magicBlockData');
|
|
119019
119095
|
effects.consume(code);
|
|
119020
119096
|
return beforeDataWhitespaceContinue;
|
|
119021
119097
|
}
|
|
119022
|
-
if (code ===
|
|
119098
|
+
if (code === codes_codes.leftCurlyBrace) {
|
|
119023
119099
|
seenOpenBrace = true;
|
|
119024
119100
|
effects.enter('magicBlockData');
|
|
119025
119101
|
return captureData(code);
|
|
@@ -119041,11 +119117,11 @@ function tokenizeMagicBlockText(effects, ok, nok) {
|
|
|
119041
119117
|
effects.exit('magicBlockLineEnding');
|
|
119042
119118
|
return beforeData;
|
|
119043
119119
|
}
|
|
119044
|
-
if (code ===
|
|
119120
|
+
if (code === codes_codes.space || code === codes_codes.horizontalTab) {
|
|
119045
119121
|
effects.consume(code);
|
|
119046
119122
|
return beforeDataWhitespaceContinue;
|
|
119047
119123
|
}
|
|
119048
|
-
if (code ===
|
|
119124
|
+
if (code === codes_codes.leftCurlyBrace) {
|
|
119049
119125
|
seenOpenBrace = true;
|
|
119050
119126
|
return captureData(code);
|
|
119051
119127
|
}
|
|
@@ -119073,23 +119149,23 @@ function tokenizeMagicBlockText(effects, ok, nok) {
|
|
|
119073
119149
|
return captureData;
|
|
119074
119150
|
}
|
|
119075
119151
|
if (jsonState.inString) {
|
|
119076
|
-
if (code ===
|
|
119152
|
+
if (code === codes_codes.backslash) {
|
|
119077
119153
|
jsonState.escapeNext = true;
|
|
119078
119154
|
effects.consume(code);
|
|
119079
119155
|
return captureData;
|
|
119080
119156
|
}
|
|
119081
|
-
if (code ===
|
|
119157
|
+
if (code === codes_codes.quotationMark) {
|
|
119082
119158
|
jsonState.inString = false;
|
|
119083
119159
|
}
|
|
119084
119160
|
effects.consume(code);
|
|
119085
119161
|
return captureData;
|
|
119086
119162
|
}
|
|
119087
|
-
if (code ===
|
|
119163
|
+
if (code === codes_codes.quotationMark) {
|
|
119088
119164
|
jsonState.inString = true;
|
|
119089
119165
|
effects.consume(code);
|
|
119090
119166
|
return captureData;
|
|
119091
119167
|
}
|
|
119092
|
-
if (code ===
|
|
119168
|
+
if (code === codes_codes.leftSquareBracket) {
|
|
119093
119169
|
effects.exit('magicBlockData');
|
|
119094
119170
|
effects.enter('magicBlockMarkerEnd');
|
|
119095
119171
|
effects.consume(code);
|
|
@@ -119680,11 +119756,11 @@ function createTokenize(mode) {
|
|
|
119680
119756
|
// When a } brings braceDepth back to a saved value, we return to the
|
|
119681
119757
|
// template literal instead of continuing in the brace expression.
|
|
119682
119758
|
const templateStack = [];
|
|
119683
|
-
const isAlpha = (code) => (code >=
|
|
119684
|
-
(code >=
|
|
119759
|
+
const isAlpha = (code) => (code >= codes_codes.uppercaseA && code <= codes_codes.uppercaseZ) ||
|
|
119760
|
+
(code >= codes_codes.lowercaseA && code <= codes_codes.lowercaseZ);
|
|
119685
119761
|
const isSameCaseAsTag = (code) => isLowercaseTag
|
|
119686
|
-
? code >=
|
|
119687
|
-
: code >=
|
|
119762
|
+
? code >= codes_codes.lowercaseA && code <= codes_codes.lowercaseZ
|
|
119763
|
+
: code >= codes_codes.uppercaseA && code <= codes_codes.uppercaseZ;
|
|
119688
119764
|
// Shared brace-expression state machine. The two call sites differ only in where
|
|
119689
119765
|
// to continue after a line ending and where to return when braceDepth reaches zero.
|
|
119690
119766
|
function createBraceExprStates(continuationStart, afterBraceClose) {
|
|
@@ -119697,22 +119773,22 @@ function createTokenize(mode) {
|
|
|
119697
119773
|
effects.exit('mdxComponentData');
|
|
119698
119774
|
return continuationStart(code);
|
|
119699
119775
|
}
|
|
119700
|
-
if (code ===
|
|
119776
|
+
if (code === codes_codes.quotationMark || code === codes_codes.apostrophe) {
|
|
119701
119777
|
quoteChar = code;
|
|
119702
119778
|
effects.consume(code);
|
|
119703
119779
|
return braceString;
|
|
119704
119780
|
}
|
|
119705
|
-
if (code ===
|
|
119781
|
+
if (code === codes_codes.graveAccent) {
|
|
119706
119782
|
inTemplateLit = true;
|
|
119707
119783
|
effects.consume(code);
|
|
119708
119784
|
return braceTemplateLiteral;
|
|
119709
119785
|
}
|
|
119710
|
-
if (code ===
|
|
119786
|
+
if (code === codes_codes.leftCurlyBrace) {
|
|
119711
119787
|
braceDepth += 1;
|
|
119712
119788
|
effects.consume(code);
|
|
119713
119789
|
return braceExpr;
|
|
119714
119790
|
}
|
|
119715
|
-
if (code ===
|
|
119791
|
+
if (code === codes_codes.rightCurlyBrace) {
|
|
119716
119792
|
braceDepth -= 1;
|
|
119717
119793
|
effects.consume(code);
|
|
119718
119794
|
if (templateStack.length > 0 && braceDepth === templateStack[templateStack.length - 1]) {
|
|
@@ -119737,7 +119813,7 @@ function createTokenize(mode) {
|
|
|
119737
119813
|
effects.exit('mdxComponentData');
|
|
119738
119814
|
return continuationStart(code);
|
|
119739
119815
|
}
|
|
119740
|
-
if (code ===
|
|
119816
|
+
if (code === codes_codes.backslash) {
|
|
119741
119817
|
effects.consume(code);
|
|
119742
119818
|
return braceStringEscape;
|
|
119743
119819
|
}
|
|
@@ -119765,16 +119841,16 @@ function createTokenize(mode) {
|
|
|
119765
119841
|
effects.exit('mdxComponentData');
|
|
119766
119842
|
return continuationStart(code);
|
|
119767
119843
|
}
|
|
119768
|
-
if (code ===
|
|
119844
|
+
if (code === codes_codes.graveAccent) {
|
|
119769
119845
|
inTemplateLit = false;
|
|
119770
119846
|
effects.consume(code);
|
|
119771
119847
|
return braceExpr;
|
|
119772
119848
|
}
|
|
119773
|
-
if (code ===
|
|
119849
|
+
if (code === codes_codes.backslash) {
|
|
119774
119850
|
effects.consume(code);
|
|
119775
119851
|
return braceTemplateLiteralEscape;
|
|
119776
119852
|
}
|
|
119777
|
-
if (code ===
|
|
119853
|
+
if (code === codes_codes.dollarSign) {
|
|
119778
119854
|
effects.consume(code);
|
|
119779
119855
|
return braceTemplateLiteralDollar;
|
|
119780
119856
|
}
|
|
@@ -119789,7 +119865,7 @@ function createTokenize(mode) {
|
|
|
119789
119865
|
return braceTemplateLiteral;
|
|
119790
119866
|
}
|
|
119791
119867
|
function braceTemplateLiteralDollar(code) {
|
|
119792
|
-
if (code ===
|
|
119868
|
+
if (code === codes_codes.leftCurlyBrace) {
|
|
119793
119869
|
templateStack.push(braceDepth);
|
|
119794
119870
|
braceDepth += 1;
|
|
119795
119871
|
inTemplateLit = false;
|
|
@@ -119805,7 +119881,7 @@ function createTokenize(mode) {
|
|
|
119805
119881
|
return start;
|
|
119806
119882
|
// ── Start ──────────────────────────────────────────────────────────────
|
|
119807
119883
|
function start(code) {
|
|
119808
|
-
if (code !==
|
|
119884
|
+
if (code !== codes_codes.lessThan)
|
|
119809
119885
|
return nok(code);
|
|
119810
119886
|
effects.enter('mdxComponent');
|
|
119811
119887
|
effects.enter('mdxComponentData');
|
|
@@ -119817,7 +119893,7 @@ function createTokenize(mode) {
|
|
|
119817
119893
|
// Uppercase A-Z → PascalCase MDX component. Flow mode claims block
|
|
119818
119894
|
// components; text mode only claims inline components (Anchor, Glossary),
|
|
119819
119895
|
// which is enforced once the full name is known in `tagNameRest`.
|
|
119820
|
-
if (code !== null && code >=
|
|
119896
|
+
if (code !== null && code >= codes_codes.uppercaseA && code <= codes_codes.uppercaseZ) {
|
|
119821
119897
|
tagName = String.fromCharCode(code);
|
|
119822
119898
|
isLowercaseTag = false;
|
|
119823
119899
|
sawBraceAttr = false;
|
|
@@ -119827,7 +119903,7 @@ function createTokenize(mode) {
|
|
|
119827
119903
|
// Lowercase a-z → HTML tag (claim only if `{...}` attr appears). In
|
|
119828
119904
|
// flow mode, refuse to interrupt a paragraph — same rule as html-flow
|
|
119829
119905
|
// type-7. The text variant picks these up during inline parsing.
|
|
119830
|
-
if (code !== null && code >=
|
|
119906
|
+
if (code !== null && code >= codes_codes.lowercaseA && code <= codes_codes.lowercaseZ) {
|
|
119831
119907
|
if (isFlow && self.interrupt)
|
|
119832
119908
|
return nok(code);
|
|
119833
119909
|
tagName = String.fromCharCode(code);
|
|
@@ -119840,10 +119916,10 @@ function createTokenize(mode) {
|
|
|
119840
119916
|
}
|
|
119841
119917
|
function tagNameRest(code) {
|
|
119842
119918
|
if (code !== null &&
|
|
119843
|
-
((code >=
|
|
119844
|
-
(code >=
|
|
119845
|
-
(code >=
|
|
119846
|
-
code ===
|
|
119919
|
+
((code >= codes_codes.uppercaseA && code <= codes_codes.uppercaseZ) ||
|
|
119920
|
+
(code >= codes_codes.lowercaseA && code <= codes_codes.lowercaseZ) ||
|
|
119921
|
+
(code >= codes_codes.digit0 && code <= codes_codes.digit9) ||
|
|
119922
|
+
code === codes_codes.underscore)) {
|
|
119847
119923
|
tagName += String.fromCharCode(code);
|
|
119848
119924
|
effects.consume(code);
|
|
119849
119925
|
return tagNameRest;
|
|
@@ -119878,14 +119954,14 @@ function createTokenize(mode) {
|
|
|
119878
119954
|
return openTagContinuationStart(code);
|
|
119879
119955
|
}
|
|
119880
119956
|
// Self-closing />
|
|
119881
|
-
if (code ===
|
|
119957
|
+
if (code === codes_codes.slash) {
|
|
119882
119958
|
if (requiresBraceAttr && !sawBraceAttr)
|
|
119883
119959
|
return nok(code);
|
|
119884
119960
|
effects.consume(code);
|
|
119885
119961
|
return selfCloseGt;
|
|
119886
119962
|
}
|
|
119887
119963
|
// End of opening tag
|
|
119888
|
-
if (code ===
|
|
119964
|
+
if (code === codes_codes.greaterThan) {
|
|
119889
119965
|
if (requiresBraceAttr && !sawBraceAttr) {
|
|
119890
119966
|
// Plain lowercase block tags stay claimable in flow, gated per line by
|
|
119891
119967
|
// `plainClaimLineStart`; everything else falls through to CommonMark.
|
|
@@ -119898,13 +119974,13 @@ function createTokenize(mode) {
|
|
|
119898
119974
|
return body;
|
|
119899
119975
|
}
|
|
119900
119976
|
// Quoted attribute value
|
|
119901
|
-
if (code ===
|
|
119977
|
+
if (code === codes_codes.quotationMark || code === codes_codes.apostrophe) {
|
|
119902
119978
|
quoteChar = code;
|
|
119903
119979
|
effects.consume(code);
|
|
119904
119980
|
return inQuotedAttr;
|
|
119905
119981
|
}
|
|
119906
119982
|
// JSX expression attribute
|
|
119907
|
-
if (code ===
|
|
119983
|
+
if (code === codes_codes.leftCurlyBrace) {
|
|
119908
119984
|
braceDepth = 1;
|
|
119909
119985
|
sawBraceAttr = true;
|
|
119910
119986
|
effects.consume(code);
|
|
@@ -119922,7 +119998,7 @@ function createTokenize(mode) {
|
|
|
119922
119998
|
effects.exit('mdxComponentData');
|
|
119923
119999
|
return openTagContinuationStart(code);
|
|
119924
120000
|
}
|
|
119925
|
-
if (code ===
|
|
120001
|
+
if (code === codes_codes.backslash) {
|
|
119926
120002
|
effects.consume(code);
|
|
119927
120003
|
return inQuotedAttrEscape;
|
|
119928
120004
|
}
|
|
@@ -119942,7 +120018,7 @@ function createTokenize(mode) {
|
|
|
119942
120018
|
return inQuotedAttr;
|
|
119943
120019
|
}
|
|
119944
120020
|
function selfCloseGt(code) {
|
|
119945
|
-
if (code ===
|
|
120021
|
+
if (code === codes_codes.greaterThan) {
|
|
119946
120022
|
effects.consume(code);
|
|
119947
120023
|
// Self-closing tag completes the token
|
|
119948
120024
|
return afterClose;
|
|
@@ -119995,25 +120071,25 @@ function createTokenize(mode) {
|
|
|
119995
120071
|
atLineStart = true;
|
|
119996
120072
|
return bodyContinuationStart(code);
|
|
119997
120073
|
}
|
|
119998
|
-
if (code !==
|
|
120074
|
+
if (code !== codes_codes.space && code !== codes_codes.horizontalTab) {
|
|
119999
120075
|
openerLineHasContent = true;
|
|
120000
120076
|
}
|
|
120001
|
-
if (code ===
|
|
120077
|
+
if (code === codes_codes.backslash) {
|
|
120002
120078
|
effects.consume(code);
|
|
120003
120079
|
return bodyEscapedChar;
|
|
120004
120080
|
}
|
|
120005
|
-
if (code ===
|
|
120081
|
+
if (code === codes_codes.lessThan) {
|
|
120006
120082
|
effects.consume(code);
|
|
120007
120083
|
return bodyLessThan;
|
|
120008
120084
|
}
|
|
120009
120085
|
// Code span tracking
|
|
120010
|
-
if (code ===
|
|
120086
|
+
if (code === codes_codes.graveAccent) {
|
|
120011
120087
|
codeSpanOpenSize = 0;
|
|
120012
120088
|
return countOpenTicks(code);
|
|
120013
120089
|
}
|
|
120014
120090
|
// JSX expression child — track braces/template literals so the closing
|
|
120015
120091
|
// backtick of `{`...`}` is not misread as a code span opener
|
|
120016
|
-
if (code ===
|
|
120092
|
+
if (code === codes_codes.leftCurlyBrace) {
|
|
120017
120093
|
braceDepth = 1;
|
|
120018
120094
|
inTemplateLit = false;
|
|
120019
120095
|
effects.consume(code);
|
|
@@ -120033,14 +120109,14 @@ function createTokenize(mode) {
|
|
|
120033
120109
|
}
|
|
120034
120110
|
// ── Code span handling ─────────────────────────────────────────────────
|
|
120035
120111
|
function countOpenTicks(code) {
|
|
120036
|
-
if (code ===
|
|
120112
|
+
if (code === codes_codes.graveAccent) {
|
|
120037
120113
|
codeSpanOpenSize += 1;
|
|
120038
120114
|
effects.consume(code);
|
|
120039
120115
|
return countOpenTicks;
|
|
120040
120116
|
}
|
|
120041
120117
|
// 3+ backticks at line start = fenced code block
|
|
120042
120118
|
if (atLineStart && codeSpanOpenSize >= 3) {
|
|
120043
|
-
fenceChar =
|
|
120119
|
+
fenceChar = codes_codes.graveAccent;
|
|
120044
120120
|
fenceLength = codeSpanOpenSize;
|
|
120045
120121
|
atLineStart = false;
|
|
120046
120122
|
return inFencedCode(code);
|
|
@@ -120050,7 +120126,7 @@ function createTokenize(mode) {
|
|
|
120050
120126
|
function inCodeSpan(code) {
|
|
120051
120127
|
if (code === null || markdownLineEnding(code))
|
|
120052
120128
|
return body(code);
|
|
120053
|
-
if (code ===
|
|
120129
|
+
if (code === codes_codes.graveAccent) {
|
|
120054
120130
|
codeSpanCloseSize = 0;
|
|
120055
120131
|
return countCloseTicks(code);
|
|
120056
120132
|
}
|
|
@@ -120058,7 +120134,7 @@ function createTokenize(mode) {
|
|
|
120058
120134
|
return inCodeSpan;
|
|
120059
120135
|
}
|
|
120060
120136
|
function countCloseTicks(code) {
|
|
120061
|
-
if (code ===
|
|
120137
|
+
if (code === codes_codes.graveAccent) {
|
|
120062
120138
|
codeSpanCloseSize += 1;
|
|
120063
120139
|
effects.consume(code);
|
|
120064
120140
|
return countCloseTicks;
|
|
@@ -120121,7 +120197,7 @@ function createTokenize(mode) {
|
|
|
120121
120197
|
return body(code);
|
|
120122
120198
|
}
|
|
120123
120199
|
// Only spaces/tabs allowed after closing fence
|
|
120124
|
-
if (code ===
|
|
120200
|
+
if (code === codes_codes.space || code === codes_codes.horizontalTab) {
|
|
120125
120201
|
effects.consume(code);
|
|
120126
120202
|
return fenceCloseTrailing;
|
|
120127
120203
|
}
|
|
@@ -120130,7 +120206,7 @@ function createTokenize(mode) {
|
|
|
120130
120206
|
}
|
|
120131
120207
|
// ── Tilde fenced code detection ────────────────────────────────────────
|
|
120132
120208
|
function bodyAfterLineStart(code) {
|
|
120133
|
-
if (code ===
|
|
120209
|
+
if (code === codes_codes.tilde) {
|
|
120134
120210
|
fenceCloseLength = 1;
|
|
120135
120211
|
effects.consume(code);
|
|
120136
120212
|
return countTildes;
|
|
@@ -120139,13 +120215,13 @@ function createTokenize(mode) {
|
|
|
120139
120215
|
return body(code);
|
|
120140
120216
|
}
|
|
120141
120217
|
function countTildes(code) {
|
|
120142
|
-
if (code ===
|
|
120218
|
+
if (code === codes_codes.tilde) {
|
|
120143
120219
|
fenceCloseLength += 1;
|
|
120144
120220
|
effects.consume(code);
|
|
120145
120221
|
return countTildes;
|
|
120146
120222
|
}
|
|
120147
120223
|
if (fenceCloseLength >= 3) {
|
|
120148
|
-
fenceChar =
|
|
120224
|
+
fenceChar = codes_codes.tilde;
|
|
120149
120225
|
fenceLength = fenceCloseLength;
|
|
120150
120226
|
return inFencedCode(code);
|
|
120151
120227
|
}
|
|
@@ -120155,7 +120231,7 @@ function createTokenize(mode) {
|
|
|
120155
120231
|
}
|
|
120156
120232
|
// ── Tag detection inside body ──────────────────────────────────────────
|
|
120157
120233
|
function bodyLessThan(code) {
|
|
120158
|
-
if (code ===
|
|
120234
|
+
if (code === codes_codes.slash) {
|
|
120159
120235
|
if (onOpenerLine)
|
|
120160
120236
|
openerLineCloses += 1;
|
|
120161
120237
|
effects.consume(code);
|
|
@@ -120182,10 +120258,10 @@ function createTokenize(mode) {
|
|
|
120182
120258
|
// ── Nested opening tag ─────────────────────────────────────────────────
|
|
120183
120259
|
function nestedOpenTagName(code) {
|
|
120184
120260
|
if (code !== null &&
|
|
120185
|
-
((code >=
|
|
120186
|
-
(code >=
|
|
120187
|
-
(code >=
|
|
120188
|
-
code ===
|
|
120261
|
+
((code >= codes_codes.uppercaseA && code <= codes_codes.uppercaseZ) ||
|
|
120262
|
+
(code >= codes_codes.lowercaseA && code <= codes_codes.lowercaseZ) ||
|
|
120263
|
+
(code >= codes_codes.digit0 && code <= codes_codes.digit9) ||
|
|
120264
|
+
code === codes_codes.underscore)) {
|
|
120189
120265
|
closingTagName += String.fromCharCode(code);
|
|
120190
120266
|
effects.consume(code);
|
|
120191
120267
|
return nestedOpenTagName;
|
|
@@ -120193,10 +120269,10 @@ function createTokenize(mode) {
|
|
|
120193
120269
|
// Same-name opener followed by a tag-end char bumps depth. A line ending
|
|
120194
120270
|
// counts too: Prettier puts a newline right after the name (`<div\n …\n>`).
|
|
120195
120271
|
if (closingTagName === tagName &&
|
|
120196
|
-
(code ===
|
|
120197
|
-
code ===
|
|
120198
|
-
code ===
|
|
120199
|
-
code ===
|
|
120272
|
+
(code === codes_codes.greaterThan ||
|
|
120273
|
+
code === codes_codes.slash ||
|
|
120274
|
+
code === codes_codes.space ||
|
|
120275
|
+
code === codes_codes.horizontalTab ||
|
|
120200
120276
|
markdownLineEnding(code))) {
|
|
120201
120277
|
depth += 1;
|
|
120202
120278
|
}
|
|
@@ -120215,15 +120291,15 @@ function createTokenize(mode) {
|
|
|
120215
120291
|
}
|
|
120216
120292
|
function closingTagNameRest(code) {
|
|
120217
120293
|
if (code !== null &&
|
|
120218
|
-
((code >=
|
|
120219
|
-
(code >=
|
|
120220
|
-
(code >=
|
|
120221
|
-
code ===
|
|
120294
|
+
((code >= codes_codes.uppercaseA && code <= codes_codes.uppercaseZ) ||
|
|
120295
|
+
(code >= codes_codes.lowercaseA && code <= codes_codes.lowercaseZ) ||
|
|
120296
|
+
(code >= codes_codes.digit0 && code <= codes_codes.digit9) ||
|
|
120297
|
+
code === codes_codes.underscore)) {
|
|
120222
120298
|
closingTagName += String.fromCharCode(code);
|
|
120223
120299
|
effects.consume(code);
|
|
120224
120300
|
return closingTagNameRest;
|
|
120225
120301
|
}
|
|
120226
|
-
if (closingTagName === tagName && code ===
|
|
120302
|
+
if (closingTagName === tagName && code === codes_codes.greaterThan) {
|
|
120227
120303
|
depth -= 1;
|
|
120228
120304
|
effects.consume(code);
|
|
120229
120305
|
if (depth === 0) {
|
|
@@ -120307,9 +120383,9 @@ function createTokenize(mode) {
|
|
|
120307
120383
|
}
|
|
120308
120384
|
// Dispatch a non-blank continuation line: fenced code at line start, else body.
|
|
120309
120385
|
function bodyLineStart(code) {
|
|
120310
|
-
if (atLineStart && code ===
|
|
120386
|
+
if (atLineStart && code === codes_codes.tilde)
|
|
120311
120387
|
return bodyAfterLineStart(code);
|
|
120312
|
-
if (atLineStart && code ===
|
|
120388
|
+
if (atLineStart && code === codes_codes.graveAccent) {
|
|
120313
120389
|
codeSpanOpenSize = 0;
|
|
120314
120390
|
// Leave `atLineStart` set — `countOpenTicks` needs it to tell a fence from an
|
|
120315
120391
|
// inline code span once the run of backticks is fully counted; it's cleared once
|
|
@@ -120324,7 +120400,7 @@ function createTokenize(mode) {
|
|
|
120324
120400
|
// fence) refuses so CommonMark html-flow reparses it exactly as it does today.
|
|
120325
120401
|
function plainClaimLineStart(code) {
|
|
120326
120402
|
// Leading whitespace only → treat as a blank line, matching CommonMark.
|
|
120327
|
-
if (code ===
|
|
120403
|
+
if (code === codes_codes.space || code === codes_codes.horizontalTab) {
|
|
120328
120404
|
effects.consume(code);
|
|
120329
120405
|
return plainClaimLineStart;
|
|
120330
120406
|
}
|
|
@@ -120337,7 +120413,7 @@ function createTokenize(mode) {
|
|
|
120337
120413
|
// paragraph that merely starts with a tag must fall back so its markdown
|
|
120338
120414
|
// parses and rehype-raw re-nests it into the wrapper.
|
|
120339
120415
|
if (pendingBlankLine) {
|
|
120340
|
-
if (code !==
|
|
120416
|
+
if (code !== codes_codes.lessThan)
|
|
120341
120417
|
return nok(code);
|
|
120342
120418
|
return effects.check(markupOnlyContinuation, plainClaimContinue, nok)(code);
|
|
120343
120419
|
}
|
|
@@ -120390,7 +120466,7 @@ function tokenizeMarkupOnlyContinuation(effects, ok, nok) {
|
|
|
120390
120466
|
return afterLessThan;
|
|
120391
120467
|
}
|
|
120392
120468
|
function afterLessThan(code) {
|
|
120393
|
-
if (code ===
|
|
120469
|
+
if (code === codes_codes.slash) {
|
|
120394
120470
|
effects.consume(code);
|
|
120395
120471
|
return afterSlash;
|
|
120396
120472
|
}
|
|
@@ -120409,7 +120485,7 @@ function tokenizeMarkupOnlyContinuation(effects, ok, nok) {
|
|
|
120409
120485
|
function scanToLineEnd(code) {
|
|
120410
120486
|
if (code === null || markdownLineEnding(code)) {
|
|
120411
120487
|
effects.exit(types_types.data);
|
|
120412
|
-
return lastNonSpace ===
|
|
120488
|
+
return lastNonSpace === codes_codes.greaterThan ? ok(code) : nok(code);
|
|
120413
120489
|
}
|
|
120414
120490
|
if (!markdownSpace(code))
|
|
120415
120491
|
lastNonSpace = code;
|
|
@@ -120442,8 +120518,8 @@ function tokenizeMarkupOnlyContinuation(effects, ok, nok) {
|
|
|
120442
120518
|
*/
|
|
120443
120519
|
function syntax_mdxComponent() {
|
|
120444
120520
|
return {
|
|
120445
|
-
flow: { [
|
|
120446
|
-
text: { [
|
|
120521
|
+
flow: { [codes_codes.lessThan]: [mdxComponentFlowConstruct] },
|
|
120522
|
+
text: { [codes_codes.lessThan]: [mdxComponentTextConstruct] },
|
|
120447
120523
|
};
|
|
120448
120524
|
}
|
|
120449
120525
|
|
|
@@ -122903,21 +122979,21 @@ function resolveEntity(name) {
|
|
|
122903
122979
|
function tokenizeLooseHtmlEntity(effects, ok, nok) {
|
|
122904
122980
|
let length = 0;
|
|
122905
122981
|
const start = (code) => {
|
|
122906
|
-
if (code !==
|
|
122982
|
+
if (code !== codes_codes.ampersand)
|
|
122907
122983
|
return nok(code);
|
|
122908
122984
|
effects.enter('looseHtmlEntity');
|
|
122909
122985
|
effects.consume(code);
|
|
122910
122986
|
return afterAmpersand;
|
|
122911
122987
|
};
|
|
122912
122988
|
const afterAmpersand = (code) => {
|
|
122913
|
-
if (code ===
|
|
122989
|
+
if (code === codes_codes.numberSign) {
|
|
122914
122990
|
effects.consume(code);
|
|
122915
122991
|
return afterHash;
|
|
122916
122992
|
}
|
|
122917
122993
|
return accumulateNamed(code);
|
|
122918
122994
|
};
|
|
122919
122995
|
const afterHash = (code) => {
|
|
122920
|
-
if (code ===
|
|
122996
|
+
if (code === codes_codes.lowercaseX || code === codes_codes.uppercaseX) {
|
|
122921
122997
|
effects.consume(code);
|
|
122922
122998
|
return accumulateHex;
|
|
122923
122999
|
}
|
|
@@ -122931,7 +123007,7 @@ function tokenizeLooseHtmlEntity(effects, ok, nok) {
|
|
|
122931
123007
|
}
|
|
122932
123008
|
if (length === 0)
|
|
122933
123009
|
return nok(code);
|
|
122934
|
-
if (code ===
|
|
123010
|
+
if (code === codes_codes.semicolon)
|
|
122935
123011
|
return nok(code);
|
|
122936
123012
|
effects.exit('looseHtmlEntity');
|
|
122937
123013
|
return ok(code);
|
|
@@ -122944,7 +123020,7 @@ function tokenizeLooseHtmlEntity(effects, ok, nok) {
|
|
|
122944
123020
|
}
|
|
122945
123021
|
if (length === 0)
|
|
122946
123022
|
return nok(code);
|
|
122947
|
-
if (code ===
|
|
123023
|
+
if (code === codes_codes.semicolon)
|
|
122948
123024
|
return nok(code);
|
|
122949
123025
|
effects.exit('looseHtmlEntity');
|
|
122950
123026
|
return ok(code);
|
|
@@ -122957,7 +123033,7 @@ function tokenizeLooseHtmlEntity(effects, ok, nok) {
|
|
|
122957
123033
|
}
|
|
122958
123034
|
if (length === 0)
|
|
122959
123035
|
return nok(code);
|
|
122960
|
-
if (code ===
|
|
123036
|
+
if (code === codes_codes.semicolon)
|
|
122961
123037
|
return nok(code);
|
|
122962
123038
|
effects.exit('looseHtmlEntity');
|
|
122963
123039
|
return ok(code);
|
|
@@ -122992,7 +123068,7 @@ function exitLooseHtmlEntity(token) {
|
|
|
122992
123068
|
}
|
|
122993
123069
|
function looseHtmlEntity() {
|
|
122994
123070
|
return {
|
|
122995
|
-
text: { [
|
|
123071
|
+
text: { [codes_codes.ampersand]: looseHtmlEntityConstruct },
|
|
122996
123072
|
};
|
|
122997
123073
|
}
|
|
122998
123074
|
function looseHtmlEntityFromMarkdown() {
|
|
@@ -125349,7 +125425,7 @@ function jsx_table_jsxTableFromMarkdown() {
|
|
|
125349
125425
|
function tokenizeJsxComment(effects, ok, nok) {
|
|
125350
125426
|
return start;
|
|
125351
125427
|
function start(code) {
|
|
125352
|
-
if (code !==
|
|
125428
|
+
if (code !== codes_codes.leftCurlyBrace)
|
|
125353
125429
|
return nok(code);
|
|
125354
125430
|
effects.enter('mdxFlowExpression');
|
|
125355
125431
|
effects.enter('mdxFlowExpressionMarker');
|
|
@@ -125358,7 +125434,7 @@ function tokenizeJsxComment(effects, ok, nok) {
|
|
|
125358
125434
|
return expectSlash;
|
|
125359
125435
|
}
|
|
125360
125436
|
function expectSlash(code) {
|
|
125361
|
-
if (code !==
|
|
125437
|
+
if (code !== codes_codes.slash) {
|
|
125362
125438
|
effects.exit('mdxFlowExpression');
|
|
125363
125439
|
return nok(code);
|
|
125364
125440
|
}
|
|
@@ -125367,7 +125443,7 @@ function tokenizeJsxComment(effects, ok, nok) {
|
|
|
125367
125443
|
return expectStar;
|
|
125368
125444
|
}
|
|
125369
125445
|
function expectStar(code) {
|
|
125370
|
-
if (code !==
|
|
125446
|
+
if (code !== codes_codes.asterisk) {
|
|
125371
125447
|
effects.exit('mdxFlowExpressionChunk');
|
|
125372
125448
|
effects.exit('mdxFlowExpression');
|
|
125373
125449
|
return nok(code);
|
|
@@ -125394,7 +125470,7 @@ function tokenizeJsxComment(effects, ok, nok) {
|
|
|
125394
125470
|
effects.exit('mdxFlowExpressionChunk');
|
|
125395
125471
|
return before(code);
|
|
125396
125472
|
}
|
|
125397
|
-
if (code ===
|
|
125473
|
+
if (code === codes_codes.asterisk) {
|
|
125398
125474
|
effects.consume(code);
|
|
125399
125475
|
return maybeClosed;
|
|
125400
125476
|
}
|
|
@@ -125406,11 +125482,11 @@ function tokenizeJsxComment(effects, ok, nok) {
|
|
|
125406
125482
|
effects.exit('mdxFlowExpressionChunk');
|
|
125407
125483
|
return before(code);
|
|
125408
125484
|
}
|
|
125409
|
-
if (code ===
|
|
125485
|
+
if (code === codes_codes.slash) {
|
|
125410
125486
|
effects.consume(code);
|
|
125411
125487
|
return expectClosingBrace;
|
|
125412
125488
|
}
|
|
125413
|
-
if (code ===
|
|
125489
|
+
if (code === codes_codes.asterisk) {
|
|
125414
125490
|
effects.consume(code);
|
|
125415
125491
|
return maybeClosed;
|
|
125416
125492
|
}
|
|
@@ -125422,7 +125498,7 @@ function tokenizeJsxComment(effects, ok, nok) {
|
|
|
125422
125498
|
effects.exit('mdxFlowExpressionChunk');
|
|
125423
125499
|
return before(code);
|
|
125424
125500
|
}
|
|
125425
|
-
if (code ===
|
|
125501
|
+
if (code === codes_codes.rightCurlyBrace) {
|
|
125426
125502
|
effects.exit('mdxFlowExpressionChunk');
|
|
125427
125503
|
effects.enter('mdxFlowExpressionMarker');
|
|
125428
125504
|
effects.consume(code);
|
|
@@ -125430,7 +125506,7 @@ function tokenizeJsxComment(effects, ok, nok) {
|
|
|
125430
125506
|
effects.exit('mdxFlowExpression');
|
|
125431
125507
|
return ok;
|
|
125432
125508
|
}
|
|
125433
|
-
if (code ===
|
|
125509
|
+
if (code === codes_codes.asterisk) {
|
|
125434
125510
|
effects.consume(code);
|
|
125435
125511
|
return maybeClosed;
|
|
125436
125512
|
}
|
|
@@ -125441,7 +125517,7 @@ function tokenizeJsxComment(effects, ok, nok) {
|
|
|
125441
125517
|
function jsxComment() {
|
|
125442
125518
|
return {
|
|
125443
125519
|
flow: {
|
|
125444
|
-
[
|
|
125520
|
+
[codes_codes.leftCurlyBrace]: {
|
|
125445
125521
|
name: 'jsxComment',
|
|
125446
125522
|
concrete: true,
|
|
125447
125523
|
tokenize: tokenizeJsxComment,
|
|
@@ -125482,7 +125558,7 @@ function tokenizeJsxTable(effects, ok, nok) {
|
|
|
125482
125558
|
let codeSpanOpenSize = 0;
|
|
125483
125559
|
let codeSpanCloseSize = 0;
|
|
125484
125560
|
let depth = 1;
|
|
125485
|
-
const ABLE_SUFFIX = [
|
|
125561
|
+
const ABLE_SUFFIX = [codes_codes.lowercaseA, codes_codes.lowercaseB, codes_codes.lowercaseL, codes_codes.lowercaseE];
|
|
125486
125562
|
/** Build a state chain that matches a sequence of character codes. */
|
|
125487
125563
|
function matchChars(chars, onMatch, onFail) {
|
|
125488
125564
|
if (chars.length === 0)
|
|
@@ -125497,7 +125573,7 @@ function tokenizeJsxTable(effects, ok, nok) {
|
|
|
125497
125573
|
}
|
|
125498
125574
|
return start;
|
|
125499
125575
|
function start(code) {
|
|
125500
|
-
if (code !==
|
|
125576
|
+
if (code !== codes_codes.lessThan)
|
|
125501
125577
|
return nok(code);
|
|
125502
125578
|
effects.enter('jsxTable');
|
|
125503
125579
|
effects.enter('jsxTableData');
|
|
@@ -125505,14 +125581,14 @@ function tokenizeJsxTable(effects, ok, nok) {
|
|
|
125505
125581
|
return afterLessThan;
|
|
125506
125582
|
}
|
|
125507
125583
|
function afterLessThan(code) {
|
|
125508
|
-
if (code ===
|
|
125584
|
+
if (code === codes_codes.uppercaseT || code === codes_codes.lowercaseT) {
|
|
125509
125585
|
effects.consume(code);
|
|
125510
125586
|
return matchChars(ABLE_SUFFIX, afterTagName, nok);
|
|
125511
125587
|
}
|
|
125512
125588
|
return nok(code);
|
|
125513
125589
|
}
|
|
125514
125590
|
function afterTagName(code) {
|
|
125515
|
-
if (code ===
|
|
125591
|
+
if (code === codes_codes.greaterThan || code === codes_codes.slash || code === codes_codes.space || code === codes_codes.horizontalTab) {
|
|
125516
125592
|
effects.consume(code);
|
|
125517
125593
|
return body;
|
|
125518
125594
|
}
|
|
@@ -125528,17 +125604,17 @@ function tokenizeJsxTable(effects, ok, nok) {
|
|
|
125528
125604
|
effects.exit('jsxTableData');
|
|
125529
125605
|
return continuationStart(code);
|
|
125530
125606
|
}
|
|
125531
|
-
if (code ===
|
|
125607
|
+
if (code === codes_codes.backslash) {
|
|
125532
125608
|
effects.consume(code);
|
|
125533
125609
|
return escapedChar;
|
|
125534
125610
|
}
|
|
125535
|
-
if (code ===
|
|
125611
|
+
if (code === codes_codes.lessThan) {
|
|
125536
125612
|
effects.consume(code);
|
|
125537
125613
|
return closeSlash;
|
|
125538
125614
|
}
|
|
125539
125615
|
// Skip over backtick code spans so `</Table>` in inline code isn't
|
|
125540
125616
|
// treated as the closing tag
|
|
125541
|
-
if (code ===
|
|
125617
|
+
if (code === codes_codes.graveAccent) {
|
|
125542
125618
|
codeSpanOpenSize = 0;
|
|
125543
125619
|
return countOpenTicks(code);
|
|
125544
125620
|
}
|
|
@@ -125546,7 +125622,7 @@ function tokenizeJsxTable(effects, ok, nok) {
|
|
|
125546
125622
|
return body;
|
|
125547
125623
|
}
|
|
125548
125624
|
function countOpenTicks(code) {
|
|
125549
|
-
if (code ===
|
|
125625
|
+
if (code === codes_codes.graveAccent) {
|
|
125550
125626
|
codeSpanOpenSize += 1;
|
|
125551
125627
|
effects.consume(code);
|
|
125552
125628
|
return countOpenTicks;
|
|
@@ -125556,7 +125632,7 @@ function tokenizeJsxTable(effects, ok, nok) {
|
|
|
125556
125632
|
function inCodeSpan(code) {
|
|
125557
125633
|
if (code === null || markdownLineEnding(code))
|
|
125558
125634
|
return body(code);
|
|
125559
|
-
if (code ===
|
|
125635
|
+
if (code === codes_codes.graveAccent) {
|
|
125560
125636
|
codeSpanCloseSize = 0;
|
|
125561
125637
|
return countCloseTicks(code);
|
|
125562
125638
|
}
|
|
@@ -125564,7 +125640,7 @@ function tokenizeJsxTable(effects, ok, nok) {
|
|
|
125564
125640
|
return inCodeSpan;
|
|
125565
125641
|
}
|
|
125566
125642
|
function countCloseTicks(code) {
|
|
125567
|
-
if (code ===
|
|
125643
|
+
if (code === codes_codes.graveAccent) {
|
|
125568
125644
|
codeSpanCloseSize += 1;
|
|
125569
125645
|
effects.consume(code);
|
|
125570
125646
|
return countCloseTicks;
|
|
@@ -125579,25 +125655,25 @@ function tokenizeJsxTable(effects, ok, nok) {
|
|
|
125579
125655
|
return body;
|
|
125580
125656
|
}
|
|
125581
125657
|
function closeSlash(code) {
|
|
125582
|
-
if (code ===
|
|
125658
|
+
if (code === codes_codes.slash) {
|
|
125583
125659
|
effects.consume(code);
|
|
125584
125660
|
return closeTagFirstChar;
|
|
125585
125661
|
}
|
|
125586
|
-
if (code ===
|
|
125662
|
+
if (code === codes_codes.uppercaseT || code === codes_codes.lowercaseT) {
|
|
125587
125663
|
effects.consume(code);
|
|
125588
125664
|
return matchChars(ABLE_SUFFIX, openAfterTagName, body);
|
|
125589
125665
|
}
|
|
125590
125666
|
return body(code);
|
|
125591
125667
|
}
|
|
125592
125668
|
function closeTagFirstChar(code) {
|
|
125593
|
-
if (code ===
|
|
125669
|
+
if (code === codes_codes.uppercaseT || code === codes_codes.lowercaseT) {
|
|
125594
125670
|
effects.consume(code);
|
|
125595
125671
|
return matchChars(ABLE_SUFFIX, closeGt, body);
|
|
125596
125672
|
}
|
|
125597
125673
|
return body(code);
|
|
125598
125674
|
}
|
|
125599
125675
|
function openAfterTagName(code) {
|
|
125600
|
-
if (code ===
|
|
125676
|
+
if (code === codes_codes.greaterThan || code === codes_codes.slash || code === codes_codes.space || code === codes_codes.horizontalTab) {
|
|
125601
125677
|
depth += 1;
|
|
125602
125678
|
effects.consume(code);
|
|
125603
125679
|
return body;
|
|
@@ -125605,7 +125681,7 @@ function tokenizeJsxTable(effects, ok, nok) {
|
|
|
125605
125681
|
return body(code);
|
|
125606
125682
|
}
|
|
125607
125683
|
function closeGt(code) {
|
|
125608
|
-
if (code ===
|
|
125684
|
+
if (code === codes_codes.greaterThan) {
|
|
125609
125685
|
depth -= 1;
|
|
125610
125686
|
effects.consume(code);
|
|
125611
125687
|
if (depth === 0) {
|
|
@@ -125679,7 +125755,7 @@ function jsx_table_syntax_tokenizeNonLazyContinuationStart(effects, ok, nok) {
|
|
|
125679
125755
|
function syntax_jsxTable() {
|
|
125680
125756
|
return {
|
|
125681
125757
|
flow: {
|
|
125682
|
-
[
|
|
125758
|
+
[codes_codes.lessThan]: [jsxTableConstruct],
|
|
125683
125759
|
},
|
|
125684
125760
|
};
|
|
125685
125761
|
}
|
|
@@ -125706,7 +125782,7 @@ function tokenizeTextExpression(effects, ok, nok) {
|
|
|
125706
125782
|
let depth = 0;
|
|
125707
125783
|
return start;
|
|
125708
125784
|
function start(code) {
|
|
125709
|
-
if (code !==
|
|
125785
|
+
if (code !== codes_codes.leftCurlyBrace)
|
|
125710
125786
|
return nok(code);
|
|
125711
125787
|
effects.enter('mdxTextExpression');
|
|
125712
125788
|
effects.enter('mdxTextExpressionMarker');
|
|
@@ -125715,7 +125791,7 @@ function tokenizeTextExpression(effects, ok, nok) {
|
|
|
125715
125791
|
return before;
|
|
125716
125792
|
}
|
|
125717
125793
|
function before(code) {
|
|
125718
|
-
if (code ===
|
|
125794
|
+
if (code === codes_codes.eof) {
|
|
125719
125795
|
effects.exit('mdxTextExpression');
|
|
125720
125796
|
return nok(code);
|
|
125721
125797
|
}
|
|
@@ -125725,24 +125801,24 @@ function tokenizeTextExpression(effects, ok, nok) {
|
|
|
125725
125801
|
effects.exit('lineEnding');
|
|
125726
125802
|
return before;
|
|
125727
125803
|
}
|
|
125728
|
-
if (code ===
|
|
125804
|
+
if (code === codes_codes.rightCurlyBrace && depth === 0) {
|
|
125729
125805
|
return close(code);
|
|
125730
125806
|
}
|
|
125731
125807
|
effects.enter('mdxTextExpressionChunk');
|
|
125732
125808
|
return inside(code);
|
|
125733
125809
|
}
|
|
125734
125810
|
function inside(code) {
|
|
125735
|
-
if (code ===
|
|
125811
|
+
if (code === codes_codes.eof || markdownLineEnding(code)) {
|
|
125736
125812
|
effects.exit('mdxTextExpressionChunk');
|
|
125737
125813
|
return before(code);
|
|
125738
125814
|
}
|
|
125739
|
-
if (code ===
|
|
125815
|
+
if (code === codes_codes.rightCurlyBrace && depth === 0) {
|
|
125740
125816
|
effects.exit('mdxTextExpressionChunk');
|
|
125741
125817
|
return close(code);
|
|
125742
125818
|
}
|
|
125743
|
-
if (code ===
|
|
125819
|
+
if (code === codes_codes.leftCurlyBrace)
|
|
125744
125820
|
depth += 1;
|
|
125745
|
-
else if (code ===
|
|
125821
|
+
else if (code === codes_codes.rightCurlyBrace)
|
|
125746
125822
|
depth -= 1;
|
|
125747
125823
|
effects.consume(code);
|
|
125748
125824
|
return inside;
|
|
@@ -125758,7 +125834,7 @@ function tokenizeTextExpression(effects, ok, nok) {
|
|
|
125758
125834
|
function mdxExpressionLenient() {
|
|
125759
125835
|
return {
|
|
125760
125836
|
text: {
|
|
125761
|
-
[
|
|
125837
|
+
[codes_codes.leftCurlyBrace]: {
|
|
125762
125838
|
name: 'mdxTextExpression',
|
|
125763
125839
|
tokenize: tokenizeTextExpression,
|
|
125764
125840
|
},
|
|
@@ -126472,6 +126548,332 @@ const mdxishTags_tags = (doc) => {
|
|
|
126472
126548
|
};
|
|
126473
126549
|
/* harmony default export */ const mdxishTags = ((/* unused pure expression or super */ null && (mdxishTags_tags)));
|
|
126474
126550
|
|
|
126551
|
+
;// ./lib/mdast-util/html-block-component/index.ts
|
|
126552
|
+
const html_block_component_contextMap = new WeakMap();
|
|
126553
|
+
function findHtmlBlockComponentToken() {
|
|
126554
|
+
const events = this.tokenStack;
|
|
126555
|
+
for (let i = events.length - 1; i >= 0; i -= 1) {
|
|
126556
|
+
if (events[i][0].type === 'htmlBlockComponent')
|
|
126557
|
+
return events[i][0];
|
|
126558
|
+
}
|
|
126559
|
+
return undefined;
|
|
126560
|
+
}
|
|
126561
|
+
function enterHtmlBlockComponent(token) {
|
|
126562
|
+
html_block_component_contextMap.set(token, { chunks: [], lastEndLine: token.start.line });
|
|
126563
|
+
this.enter({ type: 'html', value: '' }, token);
|
|
126564
|
+
}
|
|
126565
|
+
function exitHtmlBlockComponentData(token) {
|
|
126566
|
+
const componentToken = findHtmlBlockComponentToken.call(this);
|
|
126567
|
+
if (!componentToken)
|
|
126568
|
+
return;
|
|
126569
|
+
const ctx = html_block_component_contextMap.get(componentToken);
|
|
126570
|
+
if (ctx) {
|
|
126571
|
+
const gap = token.start.line - ctx.lastEndLine;
|
|
126572
|
+
if (ctx.chunks.length > 0 && gap > 0) {
|
|
126573
|
+
ctx.chunks.push('\n'.repeat(gap));
|
|
126574
|
+
}
|
|
126575
|
+
ctx.chunks.push(this.sliceSerialize(token));
|
|
126576
|
+
ctx.lastEndLine = token.end.line;
|
|
126577
|
+
}
|
|
126578
|
+
}
|
|
126579
|
+
function exitHtmlBlockComponent(token) {
|
|
126580
|
+
const ctx = html_block_component_contextMap.get(token);
|
|
126581
|
+
const node = this.stack[this.stack.length - 1];
|
|
126582
|
+
if (ctx) {
|
|
126583
|
+
node.value = ctx.chunks.join('');
|
|
126584
|
+
html_block_component_contextMap.delete(token);
|
|
126585
|
+
}
|
|
126586
|
+
this.exit(token);
|
|
126587
|
+
}
|
|
126588
|
+
function html_block_component_htmlBlockComponentFromMarkdown() {
|
|
126589
|
+
return {
|
|
126590
|
+
enter: {
|
|
126591
|
+
htmlBlockComponent: enterHtmlBlockComponent,
|
|
126592
|
+
},
|
|
126593
|
+
exit: {
|
|
126594
|
+
htmlBlockComponentData: exitHtmlBlockComponentData,
|
|
126595
|
+
htmlBlockComponent: exitHtmlBlockComponent,
|
|
126596
|
+
},
|
|
126597
|
+
};
|
|
126598
|
+
}
|
|
126599
|
+
|
|
126600
|
+
;// ./lib/micromark/html-block-component/syntax.ts
|
|
126601
|
+
|
|
126602
|
+
|
|
126603
|
+
const TAG_SUFFIX = [
|
|
126604
|
+
codes_codes.uppercaseT,
|
|
126605
|
+
codes_codes.uppercaseM,
|
|
126606
|
+
codes_codes.uppercaseL,
|
|
126607
|
+
codes_codes.uppercaseB,
|
|
126608
|
+
codes_codes.lowercaseL,
|
|
126609
|
+
codes_codes.lowercaseO,
|
|
126610
|
+
codes_codes.lowercaseC,
|
|
126611
|
+
codes_codes.lowercaseK,
|
|
126612
|
+
];
|
|
126613
|
+
// ---------------------------------------------------------------------------
|
|
126614
|
+
// Shared tokenizer factory
|
|
126615
|
+
// ---------------------------------------------------------------------------
|
|
126616
|
+
/**
|
|
126617
|
+
* Creates a tokenize function for `<HTMLBlock>...</HTMLBlock>`.
|
|
126618
|
+
*
|
|
126619
|
+
* - **flow** (block-level): supports multiline content via line continuations,
|
|
126620
|
+
* consumes trailing whitespace after the closing tag.
|
|
126621
|
+
* - **text** (inline): single-line only, exits immediately after the closing tag.
|
|
126622
|
+
*/
|
|
126623
|
+
function syntax_createTokenize(mode) {
|
|
126624
|
+
return function tokenize(effects, ok, nok) {
|
|
126625
|
+
let depth = 1;
|
|
126626
|
+
function matchChars(chars, onMatch, onFail) {
|
|
126627
|
+
if (chars.length === 0)
|
|
126628
|
+
return onMatch;
|
|
126629
|
+
const next = (code) => {
|
|
126630
|
+
if (code === chars[0]) {
|
|
126631
|
+
effects.consume(code);
|
|
126632
|
+
return matchChars(chars.slice(1), onMatch, onFail);
|
|
126633
|
+
}
|
|
126634
|
+
return onFail(code);
|
|
126635
|
+
};
|
|
126636
|
+
return next;
|
|
126637
|
+
}
|
|
126638
|
+
function matchTagName(onMatch, onFail) {
|
|
126639
|
+
const next = (code) => {
|
|
126640
|
+
if (code === codes_codes.uppercaseH) {
|
|
126641
|
+
effects.consume(code);
|
|
126642
|
+
return matchChars(TAG_SUFFIX, onMatch, onFail);
|
|
126643
|
+
}
|
|
126644
|
+
return onFail(code);
|
|
126645
|
+
};
|
|
126646
|
+
return next;
|
|
126647
|
+
}
|
|
126648
|
+
return start;
|
|
126649
|
+
function start(code) {
|
|
126650
|
+
if (code !== codes_codes.lessThan)
|
|
126651
|
+
return nok(code);
|
|
126652
|
+
effects.enter('htmlBlockComponent');
|
|
126653
|
+
effects.enter('htmlBlockComponentData');
|
|
126654
|
+
effects.consume(code);
|
|
126655
|
+
return matchTagName(afterTagName, nok);
|
|
126656
|
+
}
|
|
126657
|
+
function afterTagName(code) {
|
|
126658
|
+
if (code === codes_codes.greaterThan) {
|
|
126659
|
+
effects.consume(code);
|
|
126660
|
+
return body;
|
|
126661
|
+
}
|
|
126662
|
+
if (code === codes_codes.space || code === codes_codes.horizontalTab) {
|
|
126663
|
+
effects.consume(code);
|
|
126664
|
+
return inAttributes;
|
|
126665
|
+
}
|
|
126666
|
+
if (mode === 'flow' && markdownLineEnding(code)) {
|
|
126667
|
+
effects.exit('htmlBlockComponentData');
|
|
126668
|
+
return attributeContinuationStart(code);
|
|
126669
|
+
}
|
|
126670
|
+
if (code === codes_codes.slash) {
|
|
126671
|
+
effects.consume(code);
|
|
126672
|
+
return selfClose;
|
|
126673
|
+
}
|
|
126674
|
+
return nok(code);
|
|
126675
|
+
}
|
|
126676
|
+
function inAttributes(code) {
|
|
126677
|
+
if (code === codes_codes.greaterThan) {
|
|
126678
|
+
effects.consume(code);
|
|
126679
|
+
return body;
|
|
126680
|
+
}
|
|
126681
|
+
if (code === null) {
|
|
126682
|
+
return nok(code);
|
|
126683
|
+
}
|
|
126684
|
+
if (markdownLineEnding(code)) {
|
|
126685
|
+
if (mode === 'text')
|
|
126686
|
+
return nok(code);
|
|
126687
|
+
effects.exit('htmlBlockComponentData');
|
|
126688
|
+
return attributeContinuationStart(code);
|
|
126689
|
+
}
|
|
126690
|
+
effects.consume(code);
|
|
126691
|
+
return inAttributes;
|
|
126692
|
+
}
|
|
126693
|
+
function attributeContinuationStart(code) {
|
|
126694
|
+
return effects.check(html_block_component_syntax_nonLazyContinuationStart, attributeContinuationNonLazy, continuationAfter)(code);
|
|
126695
|
+
}
|
|
126696
|
+
function attributeContinuationNonLazy(code) {
|
|
126697
|
+
effects.enter(types_types.lineEnding);
|
|
126698
|
+
effects.consume(code);
|
|
126699
|
+
effects.exit(types_types.lineEnding);
|
|
126700
|
+
return attributeContinuationBefore;
|
|
126701
|
+
}
|
|
126702
|
+
function attributeContinuationBefore(code) {
|
|
126703
|
+
if (code === null || markdownLineEnding(code)) {
|
|
126704
|
+
return attributeContinuationStart(code);
|
|
126705
|
+
}
|
|
126706
|
+
effects.enter('htmlBlockComponentData');
|
|
126707
|
+
return inAttributes(code);
|
|
126708
|
+
}
|
|
126709
|
+
function selfClose(code) {
|
|
126710
|
+
if (code === codes_codes.greaterThan) {
|
|
126711
|
+
effects.consume(code);
|
|
126712
|
+
return mode === 'flow' ? afterClose : done(code);
|
|
126713
|
+
}
|
|
126714
|
+
return nok(code);
|
|
126715
|
+
}
|
|
126716
|
+
function body(code) {
|
|
126717
|
+
if (code === null)
|
|
126718
|
+
return nok(code);
|
|
126719
|
+
if (markdownLineEnding(code)) {
|
|
126720
|
+
if (mode === 'text') {
|
|
126721
|
+
// Text constructs operate on paragraph content which spans lines
|
|
126722
|
+
effects.consume(code);
|
|
126723
|
+
return body;
|
|
126724
|
+
}
|
|
126725
|
+
effects.exit('htmlBlockComponentData');
|
|
126726
|
+
return continuationStart(code);
|
|
126727
|
+
}
|
|
126728
|
+
if (code === codes_codes.lessThan) {
|
|
126729
|
+
effects.consume(code);
|
|
126730
|
+
return closeSlash;
|
|
126731
|
+
}
|
|
126732
|
+
effects.consume(code);
|
|
126733
|
+
return body;
|
|
126734
|
+
}
|
|
126735
|
+
function closeSlash(code) {
|
|
126736
|
+
if (code === codes_codes.slash) {
|
|
126737
|
+
effects.consume(code);
|
|
126738
|
+
return matchTagName(closeGt, body);
|
|
126739
|
+
}
|
|
126740
|
+
return matchTagName(openAfterTagName, body)(code);
|
|
126741
|
+
}
|
|
126742
|
+
function openAfterTagName(code) {
|
|
126743
|
+
if (code === codes_codes.greaterThan || code === codes_codes.space || code === codes_codes.horizontalTab) {
|
|
126744
|
+
depth += 1;
|
|
126745
|
+
effects.consume(code);
|
|
126746
|
+
return body;
|
|
126747
|
+
}
|
|
126748
|
+
return body(code);
|
|
126749
|
+
}
|
|
126750
|
+
function closeGt(code) {
|
|
126751
|
+
if (code === codes_codes.greaterThan) {
|
|
126752
|
+
depth -= 1;
|
|
126753
|
+
effects.consume(code);
|
|
126754
|
+
if (depth === 0) {
|
|
126755
|
+
return mode === 'flow' ? afterClose : done(code);
|
|
126756
|
+
}
|
|
126757
|
+
return body;
|
|
126758
|
+
}
|
|
126759
|
+
return body(code);
|
|
126760
|
+
}
|
|
126761
|
+
// -- flow-only states ---------------------------------------------------
|
|
126762
|
+
function afterClose(code) {
|
|
126763
|
+
if (code === null || markdownLineEnding(code)) {
|
|
126764
|
+
return done(code);
|
|
126765
|
+
}
|
|
126766
|
+
if (code === codes_codes.space || code === codes_codes.horizontalTab) {
|
|
126767
|
+
effects.consume(code);
|
|
126768
|
+
return afterClose;
|
|
126769
|
+
}
|
|
126770
|
+
// Reject so the block re-parses as a paragraph, deferring to the
|
|
126771
|
+
// text tokenizer which preserves trailing content in the same line.
|
|
126772
|
+
return nok(code);
|
|
126773
|
+
}
|
|
126774
|
+
// -- flow-only: line continuation ---------------------------------------
|
|
126775
|
+
function continuationStart(code) {
|
|
126776
|
+
return effects.check(html_block_component_syntax_nonLazyContinuationStart, continuationStartNonLazy, continuationAfter)(code);
|
|
126777
|
+
}
|
|
126778
|
+
function continuationStartNonLazy(code) {
|
|
126779
|
+
effects.enter(types_types.lineEnding);
|
|
126780
|
+
effects.consume(code);
|
|
126781
|
+
effects.exit(types_types.lineEnding);
|
|
126782
|
+
return continuationBefore;
|
|
126783
|
+
}
|
|
126784
|
+
function continuationBefore(code) {
|
|
126785
|
+
if (code === null || markdownLineEnding(code)) {
|
|
126786
|
+
return continuationStart(code);
|
|
126787
|
+
}
|
|
126788
|
+
effects.enter('htmlBlockComponentData');
|
|
126789
|
+
return body(code);
|
|
126790
|
+
}
|
|
126791
|
+
function continuationAfter(code) {
|
|
126792
|
+
if (code === null)
|
|
126793
|
+
return nok(code);
|
|
126794
|
+
effects.exit('htmlBlockComponent');
|
|
126795
|
+
return ok(code);
|
|
126796
|
+
}
|
|
126797
|
+
// -- shared exit --------------------------------------------------------
|
|
126798
|
+
function done(_code) {
|
|
126799
|
+
effects.exit('htmlBlockComponentData');
|
|
126800
|
+
effects.exit('htmlBlockComponent');
|
|
126801
|
+
return ok(_code);
|
|
126802
|
+
}
|
|
126803
|
+
};
|
|
126804
|
+
}
|
|
126805
|
+
// ---------------------------------------------------------------------------
|
|
126806
|
+
// Flow construct (block-level)
|
|
126807
|
+
// ---------------------------------------------------------------------------
|
|
126808
|
+
const html_block_component_syntax_nonLazyContinuationStart = {
|
|
126809
|
+
tokenize: html_block_component_syntax_tokenizeNonLazyContinuationStart,
|
|
126810
|
+
partial: true,
|
|
126811
|
+
};
|
|
126812
|
+
function resolveToHtmlBlockComponent(events) {
|
|
126813
|
+
let index = events.length;
|
|
126814
|
+
while (index > 0) {
|
|
126815
|
+
index -= 1;
|
|
126816
|
+
if (events[index][0] === 'enter' && events[index][1].type === 'htmlBlockComponent') {
|
|
126817
|
+
break;
|
|
126818
|
+
}
|
|
126819
|
+
}
|
|
126820
|
+
if (index > 1 && events[index - 2][1].type === types_types.linePrefix) {
|
|
126821
|
+
events[index][1].start = events[index - 2][1].start;
|
|
126822
|
+
events[index + 1][1].start = events[index - 2][1].start;
|
|
126823
|
+
events.splice(index - 2, 2);
|
|
126824
|
+
}
|
|
126825
|
+
return events;
|
|
126826
|
+
}
|
|
126827
|
+
const htmlBlockComponentFlowConstruct = {
|
|
126828
|
+
name: 'htmlBlockComponent',
|
|
126829
|
+
tokenize: syntax_createTokenize('flow'),
|
|
126830
|
+
resolveTo: resolveToHtmlBlockComponent,
|
|
126831
|
+
concrete: true,
|
|
126832
|
+
};
|
|
126833
|
+
function html_block_component_syntax_tokenizeNonLazyContinuationStart(effects, ok, nok) {
|
|
126834
|
+
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
126835
|
+
const self = this;
|
|
126836
|
+
return start;
|
|
126837
|
+
function start(code) {
|
|
126838
|
+
if (markdownLineEnding(code)) {
|
|
126839
|
+
effects.enter(types_types.lineEnding);
|
|
126840
|
+
effects.consume(code);
|
|
126841
|
+
effects.exit(types_types.lineEnding);
|
|
126842
|
+
return after;
|
|
126843
|
+
}
|
|
126844
|
+
return nok(code);
|
|
126845
|
+
}
|
|
126846
|
+
function after(code) {
|
|
126847
|
+
if (self.parser.lazy[self.now().line]) {
|
|
126848
|
+
return nok(code);
|
|
126849
|
+
}
|
|
126850
|
+
return ok(code);
|
|
126851
|
+
}
|
|
126852
|
+
}
|
|
126853
|
+
// ---------------------------------------------------------------------------
|
|
126854
|
+
// Text construct (inline)
|
|
126855
|
+
// ---------------------------------------------------------------------------
|
|
126856
|
+
const htmlBlockComponentTextConstruct = {
|
|
126857
|
+
name: 'htmlBlockComponent',
|
|
126858
|
+
tokenize: syntax_createTokenize('text'),
|
|
126859
|
+
};
|
|
126860
|
+
// ---------------------------------------------------------------------------
|
|
126861
|
+
// Extension
|
|
126862
|
+
// ---------------------------------------------------------------------------
|
|
126863
|
+
function syntax_htmlBlockComponent() {
|
|
126864
|
+
return {
|
|
126865
|
+
flow: {
|
|
126866
|
+
[codes.lessThan]: [htmlBlockComponentFlowConstruct],
|
|
126867
|
+
},
|
|
126868
|
+
text: {
|
|
126869
|
+
[codes.lessThan]: [htmlBlockComponentTextConstruct],
|
|
126870
|
+
},
|
|
126871
|
+
};
|
|
126872
|
+
}
|
|
126873
|
+
|
|
126874
|
+
;// ./lib/micromark/html-block-component/index.ts
|
|
126875
|
+
|
|
126876
|
+
|
|
126475
126877
|
;// ./lib/stripComments.ts
|
|
126476
126878
|
|
|
126477
126879
|
|
|
@@ -126486,19 +126888,22 @@ const mdxishTags_tags = (doc) => {
|
|
|
126486
126888
|
|
|
126487
126889
|
|
|
126488
126890
|
|
|
126891
|
+
|
|
126892
|
+
|
|
126489
126893
|
/**
|
|
126490
126894
|
* Removes Markdown and MDX comments.
|
|
126491
126895
|
*/
|
|
126492
126896
|
async function stripComments(doc, { mdx, mdxish } = {}) {
|
|
126493
126897
|
const { replaced, blocks } = extractMagicBlocks(doc);
|
|
126494
126898
|
const processor = unified();
|
|
126495
|
-
// we still require these
|
|
126899
|
+
// we still require these extensions because:
|
|
126496
126900
|
// 1. we can rely on remarkMdx to parse MDXish
|
|
126497
126901
|
// 2. we need to parse JSX comments into mdxTextExpression nodes so that the transformers can pick them up
|
|
126902
|
+
// 3. we need to claim <HTMLBlock> before htmlFlow intercepts its inner HTML tags
|
|
126498
126903
|
if (mdxish) {
|
|
126499
126904
|
processor
|
|
126500
|
-
.data('micromarkExtensions', [jsxTable(), mdxExpression({ allowEmpty: true })])
|
|
126501
|
-
.data('fromMarkdownExtensions', [jsxTableFromMarkdown(), mdxExpressionFromMarkdown()])
|
|
126905
|
+
.data('micromarkExtensions', [htmlBlockComponent(), jsxTable(), mdxExpression({ allowEmpty: true })])
|
|
126906
|
+
.data('fromMarkdownExtensions', [htmlBlockComponentFromMarkdown(), jsxTableFromMarkdown(), mdxExpressionFromMarkdown()])
|
|
126502
126907
|
.data('toMarkdownExtensions', [mdxExpressionToMarkdown()]);
|
|
126503
126908
|
}
|
|
126504
126909
|
processor
|