@readme/markdown 14.11.5 → 14.12.0
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/HTMLBlock/index.tsx +12 -10
- package/dist/main.js +1883 -1748
- package/dist/main.node.js +1882 -1747
- package/dist/main.node.js.map +1 -1
- package/dist/processor/transform/mdxish/components/mdx-blocks.d.ts +4 -0
- package/dist/processor/transform/mdxish/components/utils.d.ts +13 -1
- package/dist/processor/transform/mdxish/mdxish-html-blocks.d.ts +7 -6
- package/dist/processor/transform/mdxish/normalize-closing-tag-whitespace.d.ts +13 -0
- package/dist/render-fixture.node.js +1417 -1282
- package/dist/render-fixture.node.js.map +1 -1
- package/package.json +2 -2
|
@@ -91765,17 +91765,12 @@ const extractScripts = (html = '') => {
|
|
|
91765
91765
|
return [cleaned, () => scripts.map(js => window.eval(js))];
|
|
91766
91766
|
};
|
|
91767
91767
|
const HTMLBlock = ({ children = '', html: htmlProp, runScripts, safeMode: safeModeRaw = false }) => {
|
|
91768
|
-
// Determine HTML source: MDXish uses html prop (from HAST), MDX uses children
|
|
91769
|
-
|
|
91770
|
-
|
|
91771
|
-
|
|
91772
|
-
|
|
91773
|
-
|
|
91774
|
-
if (typeof children !== 'string') {
|
|
91775
|
-
throw new TypeError('HTMLBlock: children must be a string');
|
|
91776
|
-
}
|
|
91777
|
-
html = children;
|
|
91778
|
-
}
|
|
91768
|
+
// Determine HTML source: MDXish uses html prop (from HAST), MDX uses children.
|
|
91769
|
+
// A non-string child (no html prop) can't be injected as raw HTML — see the
|
|
91770
|
+
// fail-soft fallback below.
|
|
91771
|
+
const htmlSource = htmlProp !== undefined ? htmlProp : children;
|
|
91772
|
+
const nonStringChildren = typeof htmlSource !== 'string';
|
|
91773
|
+
const html = nonStringChildren ? '' : htmlSource;
|
|
91779
91774
|
// eslint-disable-next-line no-param-reassign
|
|
91780
91775
|
runScripts = typeof runScripts !== 'boolean' ? runScripts === 'true' : runScripts;
|
|
91781
91776
|
// In MDX mode, safeMode is passed in as a boolean from JSX parsing
|
|
@@ -91786,6 +91781,11 @@ const HTMLBlock = ({ children = '', html: htmlProp, runScripts, safeMode: safeMo
|
|
|
91786
91781
|
if (typeof window !== 'undefined' && typeof runScripts === 'boolean' && runScripts)
|
|
91787
91782
|
exec();
|
|
91788
91783
|
}, [runScripts, exec]);
|
|
91784
|
+
if (nonStringChildren) {
|
|
91785
|
+
// Fail soft: a non-string child (e.g. JSX that wasn't serialized back to a
|
|
91786
|
+
// raw string) should never throw, so render the child nodes directly
|
|
91787
|
+
return external_react_default().createElement("div", { className: "rdmd-html" }, children);
|
|
91788
|
+
}
|
|
91789
91789
|
if (safeMode) {
|
|
91790
91790
|
return (external_react_default().createElement("pre", { className: "html-unsafe" },
|
|
91791
91791
|
external_react_default().createElement("code", null, html)));
|
|
@@ -92855,7 +92855,7 @@ function legacyVariableFromMarkdown() {
|
|
|
92855
92855
|
*
|
|
92856
92856
|
* Unicode basic latin block.
|
|
92857
92857
|
*/
|
|
92858
|
-
const
|
|
92858
|
+
const codes = /** @type {const} */ ({
|
|
92859
92859
|
carriageReturn: -5,
|
|
92860
92860
|
lineFeed: -4,
|
|
92861
92861
|
carriageReturnLineFeed: -3,
|
|
@@ -93003,11 +93003,11 @@ const codes_codes = /** @type {const} */ ({
|
|
|
93003
93003
|
function isNameChar(code) {
|
|
93004
93004
|
if (code === null)
|
|
93005
93005
|
return false;
|
|
93006
|
-
return ((code >=
|
|
93007
|
-
(code >=
|
|
93008
|
-
(code >=
|
|
93009
|
-
code ===
|
|
93010
|
-
code ===
|
|
93006
|
+
return ((code >= codes.lowercaseA && code <= codes.lowercaseZ) ||
|
|
93007
|
+
(code >= codes.uppercaseA && code <= codes.uppercaseZ) ||
|
|
93008
|
+
(code >= codes.digit0 && code <= codes.digit9) ||
|
|
93009
|
+
code === codes.dash ||
|
|
93010
|
+
code === codes.underscore);
|
|
93011
93011
|
}
|
|
93012
93012
|
const gemojiConstruct = {
|
|
93013
93013
|
name: 'gemoji',
|
|
@@ -93017,7 +93017,7 @@ function tokenize(effects, ok, nok) {
|
|
|
93017
93017
|
let hasName = false;
|
|
93018
93018
|
// Entry point — expect opening `:`
|
|
93019
93019
|
const start = (code) => {
|
|
93020
|
-
if (code !==
|
|
93020
|
+
if (code !== codes.colon)
|
|
93021
93021
|
return nok(code);
|
|
93022
93022
|
effects.enter('gemoji');
|
|
93023
93023
|
effects.enter('gemojiMarker');
|
|
@@ -93028,7 +93028,7 @@ function tokenize(effects, ok, nok) {
|
|
|
93028
93028
|
};
|
|
93029
93029
|
// First char after `:`, branch on `+` for :+1:, otherwise start normal name
|
|
93030
93030
|
const nameStart = (code) => {
|
|
93031
|
-
if (code ===
|
|
93031
|
+
if (code === codes.plusSign) {
|
|
93032
93032
|
effects.consume(code); // +
|
|
93033
93033
|
return plusOne;
|
|
93034
93034
|
}
|
|
@@ -93043,7 +93043,7 @@ function tokenize(effects, ok, nok) {
|
|
|
93043
93043
|
// After `+`, only `1` is valid (for :+1:), anything else rejects
|
|
93044
93044
|
// this is a special case for :+1: 👍 since + isnt a normal name character
|
|
93045
93045
|
const plusOne = (code) => {
|
|
93046
|
-
if (code ===
|
|
93046
|
+
if (code === codes.digit1) {
|
|
93047
93047
|
hasName = true;
|
|
93048
93048
|
effects.consume(code); // 1
|
|
93049
93049
|
return nameEnd;
|
|
@@ -93052,7 +93052,7 @@ function tokenize(effects, ok, nok) {
|
|
|
93052
93052
|
};
|
|
93053
93053
|
// Consume name characters until we hit closing `:` or an invalid char
|
|
93054
93054
|
const name = (code) => {
|
|
93055
|
-
if (code ===
|
|
93055
|
+
if (code === codes.colon) {
|
|
93056
93056
|
if (!hasName)
|
|
93057
93057
|
return nok(code);
|
|
93058
93058
|
return nameEnd(code);
|
|
@@ -93066,7 +93066,7 @@ function tokenize(effects, ok, nok) {
|
|
|
93066
93066
|
};
|
|
93067
93067
|
// Expect closing `:`
|
|
93068
93068
|
const nameEnd = (code) => {
|
|
93069
|
-
if (code !==
|
|
93069
|
+
if (code !== codes.colon)
|
|
93070
93070
|
return nok(code);
|
|
93071
93071
|
effects.exit('gemojiName');
|
|
93072
93072
|
effects.enter('gemojiMarker');
|
|
@@ -93079,7 +93079,7 @@ function tokenize(effects, ok, nok) {
|
|
|
93079
93079
|
}
|
|
93080
93080
|
function syntax_gemoji() {
|
|
93081
93081
|
return {
|
|
93082
|
-
text: { [
|
|
93082
|
+
text: { [codes.colon]: gemojiConstruct },
|
|
93083
93083
|
};
|
|
93084
93084
|
}
|
|
93085
93085
|
|
|
@@ -93094,8 +93094,8 @@ function syntax_gemoji() {
|
|
|
93094
93094
|
|
|
93095
93095
|
function isAllowedValueChar(code) {
|
|
93096
93096
|
return (code !== null &&
|
|
93097
|
-
code !==
|
|
93098
|
-
code !==
|
|
93097
|
+
code !== codes.lessThan &&
|
|
93098
|
+
code !== codes.greaterThan &&
|
|
93099
93099
|
!markdownLineEnding(code));
|
|
93100
93100
|
}
|
|
93101
93101
|
const legacyVariableConstruct = {
|
|
@@ -93105,7 +93105,7 @@ const legacyVariableConstruct = {
|
|
|
93105
93105
|
function syntax_tokenize(effects, ok, nok) {
|
|
93106
93106
|
let hasValue = false;
|
|
93107
93107
|
const start = (code) => {
|
|
93108
|
-
if (code !==
|
|
93108
|
+
if (code !== codes.lessThan)
|
|
93109
93109
|
return nok(code);
|
|
93110
93110
|
effects.enter('legacyVariable');
|
|
93111
93111
|
effects.enter('legacyVariableMarkerStart');
|
|
@@ -93113,7 +93113,7 @@ function syntax_tokenize(effects, ok, nok) {
|
|
|
93113
93113
|
return open2;
|
|
93114
93114
|
};
|
|
93115
93115
|
const open2 = (code) => {
|
|
93116
|
-
if (code !==
|
|
93116
|
+
if (code !== codes.lessThan)
|
|
93117
93117
|
return nok(code);
|
|
93118
93118
|
effects.consume(code); // <<
|
|
93119
93119
|
effects.exit('legacyVariableMarkerStart');
|
|
@@ -93121,7 +93121,7 @@ function syntax_tokenize(effects, ok, nok) {
|
|
|
93121
93121
|
return value;
|
|
93122
93122
|
};
|
|
93123
93123
|
const value = (code) => {
|
|
93124
|
-
if (code ===
|
|
93124
|
+
if (code === codes.greaterThan) {
|
|
93125
93125
|
if (!hasValue)
|
|
93126
93126
|
return nok(code);
|
|
93127
93127
|
effects.exit('legacyVariableValue');
|
|
@@ -93136,7 +93136,7 @@ function syntax_tokenize(effects, ok, nok) {
|
|
|
93136
93136
|
return value;
|
|
93137
93137
|
};
|
|
93138
93138
|
const close2 = (code) => {
|
|
93139
|
-
if (code !==
|
|
93139
|
+
if (code !== codes.greaterThan)
|
|
93140
93140
|
return nok(code);
|
|
93141
93141
|
effects.consume(code); // >>
|
|
93142
93142
|
effects.exit('legacyVariableMarkerEnd');
|
|
@@ -93147,7 +93147,7 @@ function syntax_tokenize(effects, ok, nok) {
|
|
|
93147
93147
|
}
|
|
93148
93148
|
function legacyVariable() {
|
|
93149
93149
|
return {
|
|
93150
|
-
text: { [
|
|
93150
|
+
text: { [codes.lessThan]: legacyVariableConstruct },
|
|
93151
93151
|
};
|
|
93152
93152
|
}
|
|
93153
93153
|
|
|
@@ -96621,6 +96621,9 @@ const TOP_LEVEL_TABLE_TAG_RE = /^<(?:table|Table)(?=[\s/>])/;
|
|
|
96621
96621
|
* Uses `walkTags` so `<table>`s inside code spans / fenced blocks (masked away)
|
|
96622
96622
|
* are never matched.
|
|
96623
96623
|
*
|
|
96624
|
+
* `<table>`s inside an `<HTMLBlock>` body are also ignored: that body is opaque
|
|
96625
|
+
* raw HTML, so lifting a table out of it would corrupt the block.
|
|
96626
|
+
*
|
|
96624
96627
|
* Note: An implicitly-closed table (no `</table>`, so htmlparser2 synthesizes the
|
|
96625
96628
|
* close at a later tag) is skipped: splitting there would swallow whatever
|
|
96626
96629
|
* followed the table into the fragment and drop it, so we leave such a node
|
|
@@ -96628,21 +96631,35 @@ const TOP_LEVEL_TABLE_TAG_RE = /^<(?:table|Table)(?=[\s/>])/;
|
|
|
96628
96631
|
*/
|
|
96629
96632
|
const findTableRanges = (html) => {
|
|
96630
96633
|
const ranges = [];
|
|
96631
|
-
let
|
|
96634
|
+
let tableDepth = 0;
|
|
96635
|
+
let htmlBlockDepth = 0;
|
|
96632
96636
|
let start = 0;
|
|
96633
96637
|
walkTags(html, {
|
|
96634
|
-
onOpen: ({ name, start: openStart, isStrayCloser }) => {
|
|
96635
|
-
if (
|
|
96638
|
+
onOpen: ({ name, start: openStart, isSelfClosing, isStrayCloser }) => {
|
|
96639
|
+
if (isStrayCloser)
|
|
96636
96640
|
return;
|
|
96637
|
-
|
|
96641
|
+
// `<HTMLBlock/>` has no body to protect; only a real open enters one.
|
|
96642
|
+
if (name === 'HTMLBlock') {
|
|
96643
|
+
if (!isSelfClosing)
|
|
96644
|
+
htmlBlockDepth += 1;
|
|
96645
|
+
return;
|
|
96646
|
+
}
|
|
96647
|
+
if (htmlBlockDepth > 0 || name.toLowerCase() !== 'table')
|
|
96648
|
+
return;
|
|
96649
|
+
if (tableDepth === 0)
|
|
96638
96650
|
start = openStart;
|
|
96639
|
-
|
|
96651
|
+
tableDepth += 1;
|
|
96640
96652
|
},
|
|
96641
96653
|
onClose: ({ name, end, implicit }) => {
|
|
96642
|
-
if (
|
|
96654
|
+
if (name === 'HTMLBlock') {
|
|
96655
|
+
if (!implicit && htmlBlockDepth > 0)
|
|
96656
|
+
htmlBlockDepth -= 1;
|
|
96643
96657
|
return;
|
|
96644
|
-
|
|
96645
|
-
if (
|
|
96658
|
+
}
|
|
96659
|
+
if (implicit || htmlBlockDepth > 0 || name.toLowerCase() !== 'table' || tableDepth === 0)
|
|
96660
|
+
return;
|
|
96661
|
+
tableDepth -= 1;
|
|
96662
|
+
if (tableDepth === 0)
|
|
96646
96663
|
ranges.push({ start, end });
|
|
96647
96664
|
},
|
|
96648
96665
|
});
|
|
@@ -96662,7 +96679,9 @@ const splitHtmlWithNestedTables = (node) => {
|
|
|
96662
96679
|
// This is a top-level table, so we don't need to split it
|
|
96663
96680
|
if (TOP_LEVEL_TABLE_TAG_RE.test(value))
|
|
96664
96681
|
return null;
|
|
96665
|
-
// No table text anywhere
|
|
96682
|
+
// No table text anywhere → skip the htmlparser2 walk entirely. (A `<table>` that
|
|
96683
|
+
// only appears inside an `<HTMLBlock>` body still yields no ranges below, so it's
|
|
96684
|
+
// left whole for `mdxishHtmlBlocks` to convert to an html-block next.)
|
|
96666
96685
|
if (!/<\/?table/i.test(value))
|
|
96667
96686
|
return null;
|
|
96668
96687
|
const ranges = findTableRanges(value);
|
|
@@ -118404,6 +118423,55 @@ function emptyTaskListItemFromMarkdown() {
|
|
|
118404
118423
|
};
|
|
118405
118424
|
}
|
|
118406
118425
|
|
|
118426
|
+
;// ./lib/mdast-util/jsx-table/index.ts
|
|
118427
|
+
const jsx_table_contextMap = new WeakMap();
|
|
118428
|
+
function findJsxTableToken() {
|
|
118429
|
+
const events = this.tokenStack;
|
|
118430
|
+
for (let i = events.length - 1; i >= 0; i -= 1) {
|
|
118431
|
+
if (events[i][0].type === 'jsxTable')
|
|
118432
|
+
return events[i][0];
|
|
118433
|
+
}
|
|
118434
|
+
return undefined;
|
|
118435
|
+
}
|
|
118436
|
+
function enterJsxTable(token) {
|
|
118437
|
+
jsx_table_contextMap.set(token, { chunks: [], lastEndLine: token.start.line });
|
|
118438
|
+
this.enter({ type: 'html', value: '' }, token);
|
|
118439
|
+
}
|
|
118440
|
+
function exitJsxTableData(token) {
|
|
118441
|
+
const tableToken = findJsxTableToken.call(this);
|
|
118442
|
+
if (!tableToken)
|
|
118443
|
+
return;
|
|
118444
|
+
const ctx = jsx_table_contextMap.get(tableToken);
|
|
118445
|
+
if (ctx) {
|
|
118446
|
+
const gap = token.start.line - ctx.lastEndLine;
|
|
118447
|
+
if (ctx.chunks.length > 0 && gap > 0) {
|
|
118448
|
+
ctx.chunks.push('\n'.repeat(gap));
|
|
118449
|
+
}
|
|
118450
|
+
ctx.chunks.push(this.sliceSerialize(token));
|
|
118451
|
+
ctx.lastEndLine = token.end.line;
|
|
118452
|
+
}
|
|
118453
|
+
}
|
|
118454
|
+
function exitJsxTable(token) {
|
|
118455
|
+
const ctx = jsx_table_contextMap.get(token);
|
|
118456
|
+
const node = this.stack[this.stack.length - 1];
|
|
118457
|
+
if (ctx) {
|
|
118458
|
+
node.value = ctx.chunks.join('');
|
|
118459
|
+
jsx_table_contextMap.delete(token);
|
|
118460
|
+
}
|
|
118461
|
+
this.exit(token);
|
|
118462
|
+
}
|
|
118463
|
+
function jsx_table_jsxTableFromMarkdown() {
|
|
118464
|
+
return {
|
|
118465
|
+
enter: {
|
|
118466
|
+
jsxTable: enterJsxTable,
|
|
118467
|
+
},
|
|
118468
|
+
exit: {
|
|
118469
|
+
jsxTableData: exitJsxTableData,
|
|
118470
|
+
jsxTable: exitJsxTable,
|
|
118471
|
+
},
|
|
118472
|
+
};
|
|
118473
|
+
}
|
|
118474
|
+
|
|
118407
118475
|
;// ./lib/mdast-util/magic-block/index.ts
|
|
118408
118476
|
const magic_block_contextMap = new WeakMap();
|
|
118409
118477
|
/**
|
|
@@ -118593,6 +118661,698 @@ function mdx_component_mdxComponentFromMarkdown() {
|
|
|
118593
118661
|
};
|
|
118594
118662
|
}
|
|
118595
118663
|
|
|
118664
|
+
;// ./node_modules/micromark-util-symbol/lib/types.js
|
|
118665
|
+
/**
|
|
118666
|
+
* This module is compiled away!
|
|
118667
|
+
*
|
|
118668
|
+
* Here is the list of all types of tokens exposed by micromark, with a short
|
|
118669
|
+
* explanation of what they include and where they are found.
|
|
118670
|
+
* In picking names, generally, the rule is to be as explicit as possible
|
|
118671
|
+
* instead of reusing names.
|
|
118672
|
+
* For example, there is a `definitionDestination` and a `resourceDestination`,
|
|
118673
|
+
* instead of one shared name.
|
|
118674
|
+
*/
|
|
118675
|
+
|
|
118676
|
+
// Note: when changing the next record, you must also change `TokenTypeMap`
|
|
118677
|
+
// in `micromark-util-types/index.d.ts`.
|
|
118678
|
+
const types_types = /** @type {const} */ ({
|
|
118679
|
+
// Generic type for data, such as in a title, a destination, etc.
|
|
118680
|
+
data: 'data',
|
|
118681
|
+
|
|
118682
|
+
// Generic type for syntactic whitespace (tabs, virtual spaces, spaces).
|
|
118683
|
+
// Such as, between a fenced code fence and an info string.
|
|
118684
|
+
whitespace: 'whitespace',
|
|
118685
|
+
|
|
118686
|
+
// Generic type for line endings (line feed, carriage return, carriage return +
|
|
118687
|
+
// line feed).
|
|
118688
|
+
lineEnding: 'lineEnding',
|
|
118689
|
+
|
|
118690
|
+
// A line ending, but ending a blank line.
|
|
118691
|
+
lineEndingBlank: 'lineEndingBlank',
|
|
118692
|
+
|
|
118693
|
+
// Generic type for whitespace (tabs, virtual spaces, spaces) at the start of a
|
|
118694
|
+
// line.
|
|
118695
|
+
linePrefix: 'linePrefix',
|
|
118696
|
+
|
|
118697
|
+
// Generic type for whitespace (tabs, virtual spaces, spaces) at the end of a
|
|
118698
|
+
// line.
|
|
118699
|
+
lineSuffix: 'lineSuffix',
|
|
118700
|
+
|
|
118701
|
+
// Whole ATX heading:
|
|
118702
|
+
//
|
|
118703
|
+
// ```markdown
|
|
118704
|
+
// #
|
|
118705
|
+
// ## Alpha
|
|
118706
|
+
// ### Bravo ###
|
|
118707
|
+
// ```
|
|
118708
|
+
//
|
|
118709
|
+
// Includes `atxHeadingSequence`, `whitespace`, `atxHeadingText`.
|
|
118710
|
+
atxHeading: 'atxHeading',
|
|
118711
|
+
|
|
118712
|
+
// Sequence of number signs in an ATX heading (`###`).
|
|
118713
|
+
atxHeadingSequence: 'atxHeadingSequence',
|
|
118714
|
+
|
|
118715
|
+
// Content in an ATX heading (`alpha`).
|
|
118716
|
+
// Includes text.
|
|
118717
|
+
atxHeadingText: 'atxHeadingText',
|
|
118718
|
+
|
|
118719
|
+
// Whole autolink (`<https://example.com>` or `<admin@example.com>`)
|
|
118720
|
+
// Includes `autolinkMarker` and `autolinkProtocol` or `autolinkEmail`.
|
|
118721
|
+
autolink: 'autolink',
|
|
118722
|
+
|
|
118723
|
+
// Email autolink w/o markers (`admin@example.com`)
|
|
118724
|
+
autolinkEmail: 'autolinkEmail',
|
|
118725
|
+
|
|
118726
|
+
// Marker around an `autolinkProtocol` or `autolinkEmail` (`<` or `>`).
|
|
118727
|
+
autolinkMarker: 'autolinkMarker',
|
|
118728
|
+
|
|
118729
|
+
// Protocol autolink w/o markers (`https://example.com`)
|
|
118730
|
+
autolinkProtocol: 'autolinkProtocol',
|
|
118731
|
+
|
|
118732
|
+
// A whole character escape (`\-`).
|
|
118733
|
+
// Includes `escapeMarker` and `characterEscapeValue`.
|
|
118734
|
+
characterEscape: 'characterEscape',
|
|
118735
|
+
|
|
118736
|
+
// The escaped character (`-`).
|
|
118737
|
+
characterEscapeValue: 'characterEscapeValue',
|
|
118738
|
+
|
|
118739
|
+
// A whole character reference (`&`, `≠`, or `𝌆`).
|
|
118740
|
+
// Includes `characterReferenceMarker`, an optional
|
|
118741
|
+
// `characterReferenceMarkerNumeric`, in which case an optional
|
|
118742
|
+
// `characterReferenceMarkerHexadecimal`, and a `characterReferenceValue`.
|
|
118743
|
+
characterReference: 'characterReference',
|
|
118744
|
+
|
|
118745
|
+
// The start or end marker (`&` or `;`).
|
|
118746
|
+
characterReferenceMarker: 'characterReferenceMarker',
|
|
118747
|
+
|
|
118748
|
+
// Mark reference as numeric (`#`).
|
|
118749
|
+
characterReferenceMarkerNumeric: 'characterReferenceMarkerNumeric',
|
|
118750
|
+
|
|
118751
|
+
// Mark reference as numeric (`x` or `X`).
|
|
118752
|
+
characterReferenceMarkerHexadecimal: 'characterReferenceMarkerHexadecimal',
|
|
118753
|
+
|
|
118754
|
+
// Value of character reference w/o markers (`amp`, `8800`, or `1D306`).
|
|
118755
|
+
characterReferenceValue: 'characterReferenceValue',
|
|
118756
|
+
|
|
118757
|
+
// Whole fenced code:
|
|
118758
|
+
//
|
|
118759
|
+
// ````markdown
|
|
118760
|
+
// ```js
|
|
118761
|
+
// alert(1)
|
|
118762
|
+
// ```
|
|
118763
|
+
// ````
|
|
118764
|
+
codeFenced: 'codeFenced',
|
|
118765
|
+
|
|
118766
|
+
// A fenced code fence, including whitespace, sequence, info, and meta
|
|
118767
|
+
// (` ```js `).
|
|
118768
|
+
codeFencedFence: 'codeFencedFence',
|
|
118769
|
+
|
|
118770
|
+
// Sequence of grave accent or tilde characters (` ``` `) in a fence.
|
|
118771
|
+
codeFencedFenceSequence: 'codeFencedFenceSequence',
|
|
118772
|
+
|
|
118773
|
+
// Info word (`js`) in a fence.
|
|
118774
|
+
// Includes string.
|
|
118775
|
+
codeFencedFenceInfo: 'codeFencedFenceInfo',
|
|
118776
|
+
|
|
118777
|
+
// Meta words (`highlight="1"`) in a fence.
|
|
118778
|
+
// Includes string.
|
|
118779
|
+
codeFencedFenceMeta: 'codeFencedFenceMeta',
|
|
118780
|
+
|
|
118781
|
+
// A line of code.
|
|
118782
|
+
codeFlowValue: 'codeFlowValue',
|
|
118783
|
+
|
|
118784
|
+
// Whole indented code:
|
|
118785
|
+
//
|
|
118786
|
+
// ```markdown
|
|
118787
|
+
// alert(1)
|
|
118788
|
+
// ```
|
|
118789
|
+
//
|
|
118790
|
+
// Includes `lineEnding`, `linePrefix`, and `codeFlowValue`.
|
|
118791
|
+
codeIndented: 'codeIndented',
|
|
118792
|
+
|
|
118793
|
+
// A text code (``` `alpha` ```).
|
|
118794
|
+
// Includes `codeTextSequence`, `codeTextData`, `lineEnding`, and can include
|
|
118795
|
+
// `codeTextPadding`.
|
|
118796
|
+
codeText: 'codeText',
|
|
118797
|
+
|
|
118798
|
+
codeTextData: 'codeTextData',
|
|
118799
|
+
|
|
118800
|
+
// A space or line ending right after or before a tick.
|
|
118801
|
+
codeTextPadding: 'codeTextPadding',
|
|
118802
|
+
|
|
118803
|
+
// A text code fence (` `` `).
|
|
118804
|
+
codeTextSequence: 'codeTextSequence',
|
|
118805
|
+
|
|
118806
|
+
// Whole content:
|
|
118807
|
+
//
|
|
118808
|
+
// ```markdown
|
|
118809
|
+
// [a]: b
|
|
118810
|
+
// c
|
|
118811
|
+
// =
|
|
118812
|
+
// d
|
|
118813
|
+
// ```
|
|
118814
|
+
//
|
|
118815
|
+
// Includes `paragraph` and `definition`.
|
|
118816
|
+
content: 'content',
|
|
118817
|
+
// Whole definition:
|
|
118818
|
+
//
|
|
118819
|
+
// ```markdown
|
|
118820
|
+
// [micromark]: https://github.com/micromark/micromark
|
|
118821
|
+
// ```
|
|
118822
|
+
//
|
|
118823
|
+
// Includes `definitionLabel`, `definitionMarker`, `whitespace`,
|
|
118824
|
+
// `definitionDestination`, and optionally `lineEnding` and `definitionTitle`.
|
|
118825
|
+
definition: 'definition',
|
|
118826
|
+
|
|
118827
|
+
// Destination of a definition (`https://github.com/micromark/micromark` or
|
|
118828
|
+
// `<https://github.com/micromark/micromark>`).
|
|
118829
|
+
// Includes `definitionDestinationLiteral` or `definitionDestinationRaw`.
|
|
118830
|
+
definitionDestination: 'definitionDestination',
|
|
118831
|
+
|
|
118832
|
+
// Enclosed destination of a definition
|
|
118833
|
+
// (`<https://github.com/micromark/micromark>`).
|
|
118834
|
+
// Includes `definitionDestinationLiteralMarker` and optionally
|
|
118835
|
+
// `definitionDestinationString`.
|
|
118836
|
+
definitionDestinationLiteral: 'definitionDestinationLiteral',
|
|
118837
|
+
|
|
118838
|
+
// Markers of an enclosed definition destination (`<` or `>`).
|
|
118839
|
+
definitionDestinationLiteralMarker: 'definitionDestinationLiteralMarker',
|
|
118840
|
+
|
|
118841
|
+
// Unenclosed destination of a definition
|
|
118842
|
+
// (`https://github.com/micromark/micromark`).
|
|
118843
|
+
// Includes `definitionDestinationString`.
|
|
118844
|
+
definitionDestinationRaw: 'definitionDestinationRaw',
|
|
118845
|
+
|
|
118846
|
+
// Text in an destination (`https://github.com/micromark/micromark`).
|
|
118847
|
+
// Includes string.
|
|
118848
|
+
definitionDestinationString: 'definitionDestinationString',
|
|
118849
|
+
|
|
118850
|
+
// Label of a definition (`[micromark]`).
|
|
118851
|
+
// Includes `definitionLabelMarker` and `definitionLabelString`.
|
|
118852
|
+
definitionLabel: 'definitionLabel',
|
|
118853
|
+
|
|
118854
|
+
// Markers of a definition label (`[` or `]`).
|
|
118855
|
+
definitionLabelMarker: 'definitionLabelMarker',
|
|
118856
|
+
|
|
118857
|
+
// Value of a definition label (`micromark`).
|
|
118858
|
+
// Includes string.
|
|
118859
|
+
definitionLabelString: 'definitionLabelString',
|
|
118860
|
+
|
|
118861
|
+
// Marker between a label and a destination (`:`).
|
|
118862
|
+
definitionMarker: 'definitionMarker',
|
|
118863
|
+
|
|
118864
|
+
// Title of a definition (`"x"`, `'y'`, or `(z)`).
|
|
118865
|
+
// Includes `definitionTitleMarker` and optionally `definitionTitleString`.
|
|
118866
|
+
definitionTitle: 'definitionTitle',
|
|
118867
|
+
|
|
118868
|
+
// Marker around a title of a definition (`"`, `'`, `(`, or `)`).
|
|
118869
|
+
definitionTitleMarker: 'definitionTitleMarker',
|
|
118870
|
+
|
|
118871
|
+
// Data without markers in a title (`z`).
|
|
118872
|
+
// Includes string.
|
|
118873
|
+
definitionTitleString: 'definitionTitleString',
|
|
118874
|
+
|
|
118875
|
+
// Emphasis (`*alpha*`).
|
|
118876
|
+
// Includes `emphasisSequence` and `emphasisText`.
|
|
118877
|
+
emphasis: 'emphasis',
|
|
118878
|
+
|
|
118879
|
+
// Sequence of emphasis markers (`*` or `_`).
|
|
118880
|
+
emphasisSequence: 'emphasisSequence',
|
|
118881
|
+
|
|
118882
|
+
// Emphasis text (`alpha`).
|
|
118883
|
+
// Includes text.
|
|
118884
|
+
emphasisText: 'emphasisText',
|
|
118885
|
+
|
|
118886
|
+
// The character escape marker (`\`).
|
|
118887
|
+
escapeMarker: 'escapeMarker',
|
|
118888
|
+
|
|
118889
|
+
// A hard break created with a backslash (`\\n`).
|
|
118890
|
+
// Note: does not include the line ending.
|
|
118891
|
+
hardBreakEscape: 'hardBreakEscape',
|
|
118892
|
+
|
|
118893
|
+
// A hard break created with trailing spaces (` \n`).
|
|
118894
|
+
// Does not include the line ending.
|
|
118895
|
+
hardBreakTrailing: 'hardBreakTrailing',
|
|
118896
|
+
|
|
118897
|
+
// Flow HTML:
|
|
118898
|
+
//
|
|
118899
|
+
// ```markdown
|
|
118900
|
+
// <div
|
|
118901
|
+
// ```
|
|
118902
|
+
//
|
|
118903
|
+
// Inlcudes `lineEnding`, `htmlFlowData`.
|
|
118904
|
+
htmlFlow: 'htmlFlow',
|
|
118905
|
+
|
|
118906
|
+
htmlFlowData: 'htmlFlowData',
|
|
118907
|
+
|
|
118908
|
+
// HTML in text (the tag in `a <i> b`).
|
|
118909
|
+
// Includes `lineEnding`, `htmlTextData`.
|
|
118910
|
+
htmlText: 'htmlText',
|
|
118911
|
+
|
|
118912
|
+
htmlTextData: 'htmlTextData',
|
|
118913
|
+
|
|
118914
|
+
// Whole image (``, `![alpha][bravo]`, `![alpha][]`, or
|
|
118915
|
+
// `![alpha]`).
|
|
118916
|
+
// Includes `label` and an optional `resource` or `reference`.
|
|
118917
|
+
image: 'image',
|
|
118918
|
+
|
|
118919
|
+
// Whole link label (`[*alpha*]`).
|
|
118920
|
+
// Includes `labelLink` or `labelImage`, `labelText`, and `labelEnd`.
|
|
118921
|
+
label: 'label',
|
|
118922
|
+
|
|
118923
|
+
// Text in an label (`*alpha*`).
|
|
118924
|
+
// Includes text.
|
|
118925
|
+
labelText: 'labelText',
|
|
118926
|
+
|
|
118927
|
+
// Start a link label (`[`).
|
|
118928
|
+
// Includes a `labelMarker`.
|
|
118929
|
+
labelLink: 'labelLink',
|
|
118930
|
+
|
|
118931
|
+
// Start an image label (`![`).
|
|
118932
|
+
// Includes `labelImageMarker` and `labelMarker`.
|
|
118933
|
+
labelImage: 'labelImage',
|
|
118934
|
+
|
|
118935
|
+
// Marker of a label (`[` or `]`).
|
|
118936
|
+
labelMarker: 'labelMarker',
|
|
118937
|
+
|
|
118938
|
+
// Marker to start an image (`!`).
|
|
118939
|
+
labelImageMarker: 'labelImageMarker',
|
|
118940
|
+
|
|
118941
|
+
// End a label (`]`).
|
|
118942
|
+
// Includes `labelMarker`.
|
|
118943
|
+
labelEnd: 'labelEnd',
|
|
118944
|
+
|
|
118945
|
+
// Whole link (`[alpha](bravo)`, `[alpha][bravo]`, `[alpha][]`, or `[alpha]`).
|
|
118946
|
+
// Includes `label` and an optional `resource` or `reference`.
|
|
118947
|
+
link: 'link',
|
|
118948
|
+
|
|
118949
|
+
// Whole paragraph:
|
|
118950
|
+
//
|
|
118951
|
+
// ```markdown
|
|
118952
|
+
// alpha
|
|
118953
|
+
// bravo.
|
|
118954
|
+
// ```
|
|
118955
|
+
//
|
|
118956
|
+
// Includes text.
|
|
118957
|
+
paragraph: 'paragraph',
|
|
118958
|
+
|
|
118959
|
+
// A reference (`[alpha]` or `[]`).
|
|
118960
|
+
// Includes `referenceMarker` and an optional `referenceString`.
|
|
118961
|
+
reference: 'reference',
|
|
118962
|
+
|
|
118963
|
+
// A reference marker (`[` or `]`).
|
|
118964
|
+
referenceMarker: 'referenceMarker',
|
|
118965
|
+
|
|
118966
|
+
// Reference text (`alpha`).
|
|
118967
|
+
// Includes string.
|
|
118968
|
+
referenceString: 'referenceString',
|
|
118969
|
+
|
|
118970
|
+
// A resource (`(https://example.com "alpha")`).
|
|
118971
|
+
// Includes `resourceMarker`, an optional `resourceDestination` with an optional
|
|
118972
|
+
// `whitespace` and `resourceTitle`.
|
|
118973
|
+
resource: 'resource',
|
|
118974
|
+
|
|
118975
|
+
// A resource destination (`https://example.com`).
|
|
118976
|
+
// Includes `resourceDestinationLiteral` or `resourceDestinationRaw`.
|
|
118977
|
+
resourceDestination: 'resourceDestination',
|
|
118978
|
+
|
|
118979
|
+
// A literal resource destination (`<https://example.com>`).
|
|
118980
|
+
// Includes `resourceDestinationLiteralMarker` and optionally
|
|
118981
|
+
// `resourceDestinationString`.
|
|
118982
|
+
resourceDestinationLiteral: 'resourceDestinationLiteral',
|
|
118983
|
+
|
|
118984
|
+
// A resource destination marker (`<` or `>`).
|
|
118985
|
+
resourceDestinationLiteralMarker: 'resourceDestinationLiteralMarker',
|
|
118986
|
+
|
|
118987
|
+
// A raw resource destination (`https://example.com`).
|
|
118988
|
+
// Includes `resourceDestinationString`.
|
|
118989
|
+
resourceDestinationRaw: 'resourceDestinationRaw',
|
|
118990
|
+
|
|
118991
|
+
// Resource destination text (`https://example.com`).
|
|
118992
|
+
// Includes string.
|
|
118993
|
+
resourceDestinationString: 'resourceDestinationString',
|
|
118994
|
+
|
|
118995
|
+
// A resource marker (`(` or `)`).
|
|
118996
|
+
resourceMarker: 'resourceMarker',
|
|
118997
|
+
|
|
118998
|
+
// A resource title (`"alpha"`, `'alpha'`, or `(alpha)`).
|
|
118999
|
+
// Includes `resourceTitleMarker` and optionally `resourceTitleString`.
|
|
119000
|
+
resourceTitle: 'resourceTitle',
|
|
119001
|
+
|
|
119002
|
+
// A resource title marker (`"`, `'`, `(`, or `)`).
|
|
119003
|
+
resourceTitleMarker: 'resourceTitleMarker',
|
|
119004
|
+
|
|
119005
|
+
// Resource destination title (`alpha`).
|
|
119006
|
+
// Includes string.
|
|
119007
|
+
resourceTitleString: 'resourceTitleString',
|
|
119008
|
+
|
|
119009
|
+
// Whole setext heading:
|
|
119010
|
+
//
|
|
119011
|
+
// ```markdown
|
|
119012
|
+
// alpha
|
|
119013
|
+
// bravo
|
|
119014
|
+
// =====
|
|
119015
|
+
// ```
|
|
119016
|
+
//
|
|
119017
|
+
// Includes `setextHeadingText`, `lineEnding`, `linePrefix`, and
|
|
119018
|
+
// `setextHeadingLine`.
|
|
119019
|
+
setextHeading: 'setextHeading',
|
|
119020
|
+
|
|
119021
|
+
// Content in a setext heading (`alpha\nbravo`).
|
|
119022
|
+
// Includes text.
|
|
119023
|
+
setextHeadingText: 'setextHeadingText',
|
|
119024
|
+
|
|
119025
|
+
// Underline in a setext heading, including whitespace suffix (`==`).
|
|
119026
|
+
// Includes `setextHeadingLineSequence`.
|
|
119027
|
+
setextHeadingLine: 'setextHeadingLine',
|
|
119028
|
+
|
|
119029
|
+
// Sequence of equals or dash characters in underline in a setext heading (`-`).
|
|
119030
|
+
setextHeadingLineSequence: 'setextHeadingLineSequence',
|
|
119031
|
+
|
|
119032
|
+
// Strong (`**alpha**`).
|
|
119033
|
+
// Includes `strongSequence` and `strongText`.
|
|
119034
|
+
strong: 'strong',
|
|
119035
|
+
|
|
119036
|
+
// Sequence of strong markers (`**` or `__`).
|
|
119037
|
+
strongSequence: 'strongSequence',
|
|
119038
|
+
|
|
119039
|
+
// Strong text (`alpha`).
|
|
119040
|
+
// Includes text.
|
|
119041
|
+
strongText: 'strongText',
|
|
119042
|
+
|
|
119043
|
+
// Whole thematic break:
|
|
119044
|
+
//
|
|
119045
|
+
// ```markdown
|
|
119046
|
+
// * * *
|
|
119047
|
+
// ```
|
|
119048
|
+
//
|
|
119049
|
+
// Includes `thematicBreakSequence` and `whitespace`.
|
|
119050
|
+
thematicBreak: 'thematicBreak',
|
|
119051
|
+
|
|
119052
|
+
// A sequence of one or more thematic break markers (`***`).
|
|
119053
|
+
thematicBreakSequence: 'thematicBreakSequence',
|
|
119054
|
+
|
|
119055
|
+
// Whole block quote:
|
|
119056
|
+
//
|
|
119057
|
+
// ```markdown
|
|
119058
|
+
// > a
|
|
119059
|
+
// >
|
|
119060
|
+
// > b
|
|
119061
|
+
// ```
|
|
119062
|
+
//
|
|
119063
|
+
// Includes `blockQuotePrefix` and flow.
|
|
119064
|
+
blockQuote: 'blockQuote',
|
|
119065
|
+
// The `>` or `> ` of a block quote.
|
|
119066
|
+
blockQuotePrefix: 'blockQuotePrefix',
|
|
119067
|
+
// The `>` of a block quote prefix.
|
|
119068
|
+
blockQuoteMarker: 'blockQuoteMarker',
|
|
119069
|
+
// The optional ` ` of a block quote prefix.
|
|
119070
|
+
blockQuotePrefixWhitespace: 'blockQuotePrefixWhitespace',
|
|
119071
|
+
|
|
119072
|
+
// Whole ordered list:
|
|
119073
|
+
//
|
|
119074
|
+
// ```markdown
|
|
119075
|
+
// 1. a
|
|
119076
|
+
// b
|
|
119077
|
+
// ```
|
|
119078
|
+
//
|
|
119079
|
+
// Includes `listItemPrefix`, flow, and optionally `listItemIndent` on further
|
|
119080
|
+
// lines.
|
|
119081
|
+
listOrdered: 'listOrdered',
|
|
119082
|
+
|
|
119083
|
+
// Whole unordered list:
|
|
119084
|
+
//
|
|
119085
|
+
// ```markdown
|
|
119086
|
+
// - a
|
|
119087
|
+
// b
|
|
119088
|
+
// ```
|
|
119089
|
+
//
|
|
119090
|
+
// Includes `listItemPrefix`, flow, and optionally `listItemIndent` on further
|
|
119091
|
+
// lines.
|
|
119092
|
+
listUnordered: 'listUnordered',
|
|
119093
|
+
|
|
119094
|
+
// The indent of further list item lines.
|
|
119095
|
+
listItemIndent: 'listItemIndent',
|
|
119096
|
+
|
|
119097
|
+
// A marker, as in, `*`, `+`, `-`, `.`, or `)`.
|
|
119098
|
+
listItemMarker: 'listItemMarker',
|
|
119099
|
+
|
|
119100
|
+
// The thing that starts a list item, such as `1. `.
|
|
119101
|
+
// Includes `listItemValue` if ordered, `listItemMarker`, and
|
|
119102
|
+
// `listItemPrefixWhitespace` (unless followed by a line ending).
|
|
119103
|
+
listItemPrefix: 'listItemPrefix',
|
|
119104
|
+
|
|
119105
|
+
// The whitespace after a marker.
|
|
119106
|
+
listItemPrefixWhitespace: 'listItemPrefixWhitespace',
|
|
119107
|
+
|
|
119108
|
+
// The numerical value of an ordered item.
|
|
119109
|
+
listItemValue: 'listItemValue',
|
|
119110
|
+
|
|
119111
|
+
// Internal types used for subtokenizers, compiled away
|
|
119112
|
+
chunkDocument: 'chunkDocument',
|
|
119113
|
+
chunkContent: 'chunkContent',
|
|
119114
|
+
chunkFlow: 'chunkFlow',
|
|
119115
|
+
chunkText: 'chunkText',
|
|
119116
|
+
chunkString: 'chunkString'
|
|
119117
|
+
})
|
|
119118
|
+
|
|
119119
|
+
;// ./lib/micromark/jsx-table/syntax.ts
|
|
119120
|
+
|
|
119121
|
+
|
|
119122
|
+
const syntax_nonLazyContinuationStart = {
|
|
119123
|
+
tokenize: syntax_tokenizeNonLazyContinuationStart,
|
|
119124
|
+
partial: true,
|
|
119125
|
+
};
|
|
119126
|
+
function resolveToJsxTable(events) {
|
|
119127
|
+
let index = events.length;
|
|
119128
|
+
while (index > 0) {
|
|
119129
|
+
index -= 1;
|
|
119130
|
+
if (events[index][0] === 'enter' && events[index][1].type === 'jsxTable') {
|
|
119131
|
+
break;
|
|
119132
|
+
}
|
|
119133
|
+
}
|
|
119134
|
+
if (index > 1 && events[index - 2][1].type === types_types.linePrefix) {
|
|
119135
|
+
events[index][1].start = events[index - 2][1].start;
|
|
119136
|
+
events[index + 1][1].start = events[index - 2][1].start;
|
|
119137
|
+
events.splice(index - 2, 2);
|
|
119138
|
+
}
|
|
119139
|
+
return events;
|
|
119140
|
+
}
|
|
119141
|
+
const jsxTableConstruct = {
|
|
119142
|
+
name: 'jsxTable',
|
|
119143
|
+
tokenize: tokenizeJsxTable,
|
|
119144
|
+
resolveTo: resolveToJsxTable,
|
|
119145
|
+
concrete: true,
|
|
119146
|
+
};
|
|
119147
|
+
function tokenizeJsxTable(effects, ok, nok) {
|
|
119148
|
+
let codeSpanOpenSize = 0;
|
|
119149
|
+
let codeSpanCloseSize = 0;
|
|
119150
|
+
let depth = 1;
|
|
119151
|
+
const ABLE_SUFFIX = [codes.lowercaseA, codes.lowercaseB, codes.lowercaseL, codes.lowercaseE];
|
|
119152
|
+
/** Build a state chain that matches a sequence of character codes. */
|
|
119153
|
+
function matchChars(chars, onMatch, onFail) {
|
|
119154
|
+
if (chars.length === 0)
|
|
119155
|
+
return onMatch;
|
|
119156
|
+
return ((code) => {
|
|
119157
|
+
if (code === chars[0]) {
|
|
119158
|
+
effects.consume(code);
|
|
119159
|
+
return matchChars(chars.slice(1), onMatch, onFail);
|
|
119160
|
+
}
|
|
119161
|
+
return onFail(code);
|
|
119162
|
+
});
|
|
119163
|
+
}
|
|
119164
|
+
return start;
|
|
119165
|
+
function start(code) {
|
|
119166
|
+
if (code !== codes.lessThan)
|
|
119167
|
+
return nok(code);
|
|
119168
|
+
effects.enter('jsxTable');
|
|
119169
|
+
effects.enter('jsxTableData');
|
|
119170
|
+
effects.consume(code);
|
|
119171
|
+
return afterLessThan;
|
|
119172
|
+
}
|
|
119173
|
+
function afterLessThan(code) {
|
|
119174
|
+
if (code === codes.uppercaseT || code === codes.lowercaseT) {
|
|
119175
|
+
effects.consume(code);
|
|
119176
|
+
return matchChars(ABLE_SUFFIX, afterTagName, nok);
|
|
119177
|
+
}
|
|
119178
|
+
return nok(code);
|
|
119179
|
+
}
|
|
119180
|
+
function afterTagName(code) {
|
|
119181
|
+
if (code === codes.greaterThan || code === codes.slash || code === codes.space || code === codes.horizontalTab) {
|
|
119182
|
+
effects.consume(code);
|
|
119183
|
+
return body;
|
|
119184
|
+
}
|
|
119185
|
+
return nok(code);
|
|
119186
|
+
}
|
|
119187
|
+
function body(code) {
|
|
119188
|
+
// Reject unclosed <Table> so it falls back to normal HTML block parsing
|
|
119189
|
+
// instead of swallowing all subsequent content to EOF
|
|
119190
|
+
if (code === null) {
|
|
119191
|
+
return nok(code);
|
|
119192
|
+
}
|
|
119193
|
+
if (markdownLineEnding(code)) {
|
|
119194
|
+
effects.exit('jsxTableData');
|
|
119195
|
+
return continuationStart(code);
|
|
119196
|
+
}
|
|
119197
|
+
if (code === codes.backslash) {
|
|
119198
|
+
effects.consume(code);
|
|
119199
|
+
return escapedChar;
|
|
119200
|
+
}
|
|
119201
|
+
if (code === codes.lessThan) {
|
|
119202
|
+
effects.consume(code);
|
|
119203
|
+
return closeSlash;
|
|
119204
|
+
}
|
|
119205
|
+
// Skip over backtick code spans so `</Table>` in inline code isn't
|
|
119206
|
+
// treated as the closing tag
|
|
119207
|
+
if (code === codes.graveAccent) {
|
|
119208
|
+
codeSpanOpenSize = 0;
|
|
119209
|
+
return countOpenTicks(code);
|
|
119210
|
+
}
|
|
119211
|
+
effects.consume(code);
|
|
119212
|
+
return body;
|
|
119213
|
+
}
|
|
119214
|
+
function countOpenTicks(code) {
|
|
119215
|
+
if (code === codes.graveAccent) {
|
|
119216
|
+
codeSpanOpenSize += 1;
|
|
119217
|
+
effects.consume(code);
|
|
119218
|
+
return countOpenTicks;
|
|
119219
|
+
}
|
|
119220
|
+
return inCodeSpan(code);
|
|
119221
|
+
}
|
|
119222
|
+
function inCodeSpan(code) {
|
|
119223
|
+
if (code === null || markdownLineEnding(code))
|
|
119224
|
+
return body(code);
|
|
119225
|
+
if (code === codes.graveAccent) {
|
|
119226
|
+
codeSpanCloseSize = 0;
|
|
119227
|
+
return countCloseTicks(code);
|
|
119228
|
+
}
|
|
119229
|
+
effects.consume(code);
|
|
119230
|
+
return inCodeSpan;
|
|
119231
|
+
}
|
|
119232
|
+
function countCloseTicks(code) {
|
|
119233
|
+
if (code === codes.graveAccent) {
|
|
119234
|
+
codeSpanCloseSize += 1;
|
|
119235
|
+
effects.consume(code);
|
|
119236
|
+
return countCloseTicks;
|
|
119237
|
+
}
|
|
119238
|
+
return codeSpanCloseSize === codeSpanOpenSize ? body(code) : inCodeSpan(code);
|
|
119239
|
+
}
|
|
119240
|
+
function escapedChar(code) {
|
|
119241
|
+
if (code === null || markdownLineEnding(code)) {
|
|
119242
|
+
return body(code);
|
|
119243
|
+
}
|
|
119244
|
+
effects.consume(code);
|
|
119245
|
+
return body;
|
|
119246
|
+
}
|
|
119247
|
+
function closeSlash(code) {
|
|
119248
|
+
if (code === codes.slash) {
|
|
119249
|
+
effects.consume(code);
|
|
119250
|
+
return closeTagFirstChar;
|
|
119251
|
+
}
|
|
119252
|
+
if (code === codes.uppercaseT || code === codes.lowercaseT) {
|
|
119253
|
+
effects.consume(code);
|
|
119254
|
+
return matchChars(ABLE_SUFFIX, openAfterTagName, body);
|
|
119255
|
+
}
|
|
119256
|
+
return body(code);
|
|
119257
|
+
}
|
|
119258
|
+
function closeTagFirstChar(code) {
|
|
119259
|
+
if (code === codes.uppercaseT || code === codes.lowercaseT) {
|
|
119260
|
+
effects.consume(code);
|
|
119261
|
+
return matchChars(ABLE_SUFFIX, closeGt, body);
|
|
119262
|
+
}
|
|
119263
|
+
return body(code);
|
|
119264
|
+
}
|
|
119265
|
+
function openAfterTagName(code) {
|
|
119266
|
+
if (code === codes.greaterThan || code === codes.slash || code === codes.space || code === codes.horizontalTab) {
|
|
119267
|
+
depth += 1;
|
|
119268
|
+
effects.consume(code);
|
|
119269
|
+
return body;
|
|
119270
|
+
}
|
|
119271
|
+
return body(code);
|
|
119272
|
+
}
|
|
119273
|
+
function closeGt(code) {
|
|
119274
|
+
if (code === codes.greaterThan) {
|
|
119275
|
+
depth -= 1;
|
|
119276
|
+
effects.consume(code);
|
|
119277
|
+
if (depth === 0) {
|
|
119278
|
+
return afterClose;
|
|
119279
|
+
}
|
|
119280
|
+
return body;
|
|
119281
|
+
}
|
|
119282
|
+
return body(code);
|
|
119283
|
+
}
|
|
119284
|
+
function afterClose(code) {
|
|
119285
|
+
if (code === null || markdownLineEnding(code)) {
|
|
119286
|
+
effects.exit('jsxTableData');
|
|
119287
|
+
effects.exit('jsxTable');
|
|
119288
|
+
return ok(code);
|
|
119289
|
+
}
|
|
119290
|
+
effects.consume(code);
|
|
119291
|
+
return afterClose;
|
|
119292
|
+
}
|
|
119293
|
+
// Line ending handling — follows the htmlFlow pattern
|
|
119294
|
+
function continuationStart(code) {
|
|
119295
|
+
return effects.check(syntax_nonLazyContinuationStart, continuationStartNonLazy, continuationAfter)(code);
|
|
119296
|
+
}
|
|
119297
|
+
function continuationStartNonLazy(code) {
|
|
119298
|
+
effects.enter(types_types.lineEnding);
|
|
119299
|
+
effects.consume(code);
|
|
119300
|
+
effects.exit(types_types.lineEnding);
|
|
119301
|
+
return continuationBefore;
|
|
119302
|
+
}
|
|
119303
|
+
function continuationBefore(code) {
|
|
119304
|
+
if (code === null || markdownLineEnding(code)) {
|
|
119305
|
+
return continuationStart(code);
|
|
119306
|
+
}
|
|
119307
|
+
effects.enter('jsxTableData');
|
|
119308
|
+
return body(code);
|
|
119309
|
+
}
|
|
119310
|
+
function continuationAfter(code) {
|
|
119311
|
+
// At EOF without </Table>, reject so content isn't swallowed
|
|
119312
|
+
if (code === null) {
|
|
119313
|
+
return nok(code);
|
|
119314
|
+
}
|
|
119315
|
+
effects.exit('jsxTable');
|
|
119316
|
+
return ok(code);
|
|
119317
|
+
}
|
|
119318
|
+
}
|
|
119319
|
+
function syntax_tokenizeNonLazyContinuationStart(effects, ok, nok) {
|
|
119320
|
+
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
119321
|
+
const self = this;
|
|
119322
|
+
return start;
|
|
119323
|
+
function start(code) {
|
|
119324
|
+
if (markdownLineEnding(code)) {
|
|
119325
|
+
effects.enter(types_types.lineEnding);
|
|
119326
|
+
effects.consume(code);
|
|
119327
|
+
effects.exit(types_types.lineEnding);
|
|
119328
|
+
return after;
|
|
119329
|
+
}
|
|
119330
|
+
return nok(code);
|
|
119331
|
+
}
|
|
119332
|
+
function after(code) {
|
|
119333
|
+
if (self.parser.lazy[self.now().line]) {
|
|
119334
|
+
return nok(code);
|
|
119335
|
+
}
|
|
119336
|
+
return ok(code);
|
|
119337
|
+
}
|
|
119338
|
+
}
|
|
119339
|
+
/**
|
|
119340
|
+
* Micromark extension that tokenizes `<Table>...</Table>` and `<table>...</table>`
|
|
119341
|
+
* as a single flow block.
|
|
119342
|
+
*
|
|
119343
|
+
* Prevents CommonMark HTML block type 6 from fragmenting table blocks at blank lines.
|
|
119344
|
+
*/
|
|
119345
|
+
function syntax_jsxTable() {
|
|
119346
|
+
return {
|
|
119347
|
+
flow: {
|
|
119348
|
+
[codes.lessThan]: [jsxTableConstruct],
|
|
119349
|
+
},
|
|
119350
|
+
};
|
|
119351
|
+
}
|
|
119352
|
+
|
|
119353
|
+
;// ./lib/micromark/jsx-table/index.ts
|
|
119354
|
+
|
|
119355
|
+
|
|
118596
119356
|
;// ./lib/micromark/magic-block/syntax.ts
|
|
118597
119357
|
|
|
118598
119358
|
|
|
@@ -118617,7 +119377,7 @@ const KNOWN_BLOCK_TYPES = new Set([
|
|
|
118617
119377
|
* Types can contain alphanumeric characters and hyphens (e.g., "api-header", "tutorial-tile")
|
|
118618
119378
|
*/
|
|
118619
119379
|
function isTypeChar(code) {
|
|
118620
|
-
return asciiAlphanumeric(code) || code ===
|
|
119380
|
+
return asciiAlphanumeric(code) || code === codes.dash;
|
|
118621
119381
|
}
|
|
118622
119382
|
/**
|
|
118623
119383
|
* Creates the opening marker state machine: [block:
|
|
@@ -118625,37 +119385,37 @@ function isTypeChar(code) {
|
|
|
118625
119385
|
*/
|
|
118626
119386
|
function createOpeningMarkerParser(effects, nok, onComplete) {
|
|
118627
119387
|
const expectB = (code) => {
|
|
118628
|
-
if (code !==
|
|
119388
|
+
if (code !== codes.lowercaseB)
|
|
118629
119389
|
return nok(code);
|
|
118630
119390
|
effects.consume(code);
|
|
118631
119391
|
return expectL;
|
|
118632
119392
|
};
|
|
118633
119393
|
const expectL = (code) => {
|
|
118634
|
-
if (code !==
|
|
119394
|
+
if (code !== codes.lowercaseL)
|
|
118635
119395
|
return nok(code);
|
|
118636
119396
|
effects.consume(code);
|
|
118637
119397
|
return expectO;
|
|
118638
119398
|
};
|
|
118639
119399
|
const expectO = (code) => {
|
|
118640
|
-
if (code !==
|
|
119400
|
+
if (code !== codes.lowercaseO)
|
|
118641
119401
|
return nok(code);
|
|
118642
119402
|
effects.consume(code);
|
|
118643
119403
|
return expectC;
|
|
118644
119404
|
};
|
|
118645
119405
|
const expectC = (code) => {
|
|
118646
|
-
if (code !==
|
|
119406
|
+
if (code !== codes.lowercaseC)
|
|
118647
119407
|
return nok(code);
|
|
118648
119408
|
effects.consume(code);
|
|
118649
119409
|
return expectK;
|
|
118650
119410
|
};
|
|
118651
119411
|
const expectK = (code) => {
|
|
118652
|
-
if (code !==
|
|
119412
|
+
if (code !== codes.lowercaseK)
|
|
118653
119413
|
return nok(code);
|
|
118654
119414
|
effects.consume(code);
|
|
118655
119415
|
return expectColon;
|
|
118656
119416
|
};
|
|
118657
119417
|
const expectColon = (code) => {
|
|
118658
|
-
if (code !==
|
|
119418
|
+
if (code !== codes.colon)
|
|
118659
119419
|
return nok(code);
|
|
118660
119420
|
effects.consume(code);
|
|
118661
119421
|
effects.exit('magicBlockMarkerStart');
|
|
@@ -118671,7 +119431,7 @@ function createOpeningMarkerParser(effects, nok, onComplete) {
|
|
|
118671
119431
|
function createTypeCaptureParser(effects, nok, onComplete, blockTypeRef) {
|
|
118672
119432
|
const captureTypeFirst = (code) => {
|
|
118673
119433
|
// Reject empty type name [block:]
|
|
118674
|
-
if (code ===
|
|
119434
|
+
if (code === codes.rightSquareBracket) {
|
|
118675
119435
|
return nok(code);
|
|
118676
119436
|
}
|
|
118677
119437
|
if (isTypeChar(code)) {
|
|
@@ -118682,7 +119442,7 @@ function createTypeCaptureParser(effects, nok, onComplete, blockTypeRef) {
|
|
|
118682
119442
|
return nok(code);
|
|
118683
119443
|
};
|
|
118684
119444
|
const captureType = (code) => {
|
|
118685
|
-
if (code ===
|
|
119445
|
+
if (code === codes.rightSquareBracket) {
|
|
118686
119446
|
if (!KNOWN_BLOCK_TYPES.has(blockTypeRef.value)) {
|
|
118687
119447
|
return nok(code);
|
|
118688
119448
|
}
|
|
@@ -118707,7 +119467,7 @@ function createTypeCaptureParser(effects, nok, onComplete, blockTypeRef) {
|
|
|
118707
119467
|
*/
|
|
118708
119468
|
function createClosingMarkerParser(effects, onSuccess, onMismatch, onEof, jsonState) {
|
|
118709
119469
|
const handleMismatch = (code) => {
|
|
118710
|
-
if (jsonState && code ===
|
|
119470
|
+
if (jsonState && code === codes.quotationMark) {
|
|
118711
119471
|
jsonState.inString = true;
|
|
118712
119472
|
}
|
|
118713
119473
|
return onMismatch(code);
|
|
@@ -118715,7 +119475,7 @@ function createClosingMarkerParser(effects, onSuccess, onMismatch, onEof, jsonSt
|
|
|
118715
119475
|
const expectSlash = (code) => {
|
|
118716
119476
|
if (code === null)
|
|
118717
119477
|
return onEof(code);
|
|
118718
|
-
if (code !==
|
|
119478
|
+
if (code !== codes.slash)
|
|
118719
119479
|
return handleMismatch(code);
|
|
118720
119480
|
effects.consume(code);
|
|
118721
119481
|
return expectB;
|
|
@@ -118723,7 +119483,7 @@ function createClosingMarkerParser(effects, onSuccess, onMismatch, onEof, jsonSt
|
|
|
118723
119483
|
const expectB = (code) => {
|
|
118724
119484
|
if (code === null)
|
|
118725
119485
|
return onEof(code);
|
|
118726
|
-
if (code !==
|
|
119486
|
+
if (code !== codes.lowercaseB)
|
|
118727
119487
|
return handleMismatch(code);
|
|
118728
119488
|
effects.consume(code);
|
|
118729
119489
|
return expectL;
|
|
@@ -118731,7 +119491,7 @@ function createClosingMarkerParser(effects, onSuccess, onMismatch, onEof, jsonSt
|
|
|
118731
119491
|
const expectL = (code) => {
|
|
118732
119492
|
if (code === null)
|
|
118733
119493
|
return onEof(code);
|
|
118734
|
-
if (code !==
|
|
119494
|
+
if (code !== codes.lowercaseL)
|
|
118735
119495
|
return handleMismatch(code);
|
|
118736
119496
|
effects.consume(code);
|
|
118737
119497
|
return expectO;
|
|
@@ -118739,7 +119499,7 @@ function createClosingMarkerParser(effects, onSuccess, onMismatch, onEof, jsonSt
|
|
|
118739
119499
|
const expectO = (code) => {
|
|
118740
119500
|
if (code === null)
|
|
118741
119501
|
return onEof(code);
|
|
118742
|
-
if (code !==
|
|
119502
|
+
if (code !== codes.lowercaseO)
|
|
118743
119503
|
return handleMismatch(code);
|
|
118744
119504
|
effects.consume(code);
|
|
118745
119505
|
return expectC;
|
|
@@ -118747,7 +119507,7 @@ function createClosingMarkerParser(effects, onSuccess, onMismatch, onEof, jsonSt
|
|
|
118747
119507
|
const expectC = (code) => {
|
|
118748
119508
|
if (code === null)
|
|
118749
119509
|
return onEof(code);
|
|
118750
|
-
if (code !==
|
|
119510
|
+
if (code !== codes.lowercaseC)
|
|
118751
119511
|
return handleMismatch(code);
|
|
118752
119512
|
effects.consume(code);
|
|
118753
119513
|
return expectK;
|
|
@@ -118755,7 +119515,7 @@ function createClosingMarkerParser(effects, onSuccess, onMismatch, onEof, jsonSt
|
|
|
118755
119515
|
const expectK = (code) => {
|
|
118756
119516
|
if (code === null)
|
|
118757
119517
|
return onEof(code);
|
|
118758
|
-
if (code !==
|
|
119518
|
+
if (code !== codes.lowercaseK)
|
|
118759
119519
|
return handleMismatch(code);
|
|
118760
119520
|
effects.consume(code);
|
|
118761
119521
|
return expectBracket;
|
|
@@ -118763,7 +119523,7 @@ function createClosingMarkerParser(effects, onSuccess, onMismatch, onEof, jsonSt
|
|
|
118763
119523
|
const expectBracket = (code) => {
|
|
118764
119524
|
if (code === null)
|
|
118765
119525
|
return onEof(code);
|
|
118766
|
-
if (code !==
|
|
119526
|
+
if (code !== codes.rightSquareBracket)
|
|
118767
119527
|
return handleMismatch(code);
|
|
118768
119528
|
effects.consume(code);
|
|
118769
119529
|
return onSuccess;
|
|
@@ -118819,7 +119579,7 @@ function syntax_magicBlock() {
|
|
|
118819
119579
|
// Flow construct - handles block-level magic blocks at document root
|
|
118820
119580
|
// Marked as concrete to prevent interruption by containers
|
|
118821
119581
|
flow: {
|
|
118822
|
-
[
|
|
119582
|
+
[codes.leftSquareBracket]: {
|
|
118823
119583
|
name: 'magicBlock',
|
|
118824
119584
|
concrete: true,
|
|
118825
119585
|
tokenize: tokenizeMagicBlockFlow,
|
|
@@ -118827,7 +119587,7 @@ function syntax_magicBlock() {
|
|
|
118827
119587
|
},
|
|
118828
119588
|
// Text construct - handles magic blocks in inline contexts (lists, paragraphs)
|
|
118829
119589
|
text: {
|
|
118830
|
-
[
|
|
119590
|
+
[codes.leftSquareBracket]: {
|
|
118831
119591
|
name: 'magicBlock',
|
|
118832
119592
|
tokenize: tokenizeMagicBlockText,
|
|
118833
119593
|
},
|
|
@@ -118848,7 +119608,7 @@ function tokenizeMagicBlockFlow(effects, ok, nok) {
|
|
|
118848
119608
|
const openingMarkerParser = createOpeningMarkerParser(effects, nok, typeParser.first);
|
|
118849
119609
|
return start;
|
|
118850
119610
|
function start(code) {
|
|
118851
|
-
if (code !==
|
|
119611
|
+
if (code !== codes.leftSquareBracket)
|
|
118852
119612
|
return nok(code);
|
|
118853
119613
|
effects.enter('magicBlock');
|
|
118854
119614
|
effects.enter('magicBlockMarkerStart');
|
|
@@ -118871,7 +119631,7 @@ function tokenizeMagicBlockFlow(effects, ok, nok) {
|
|
|
118871
119631
|
// Check for closing marker directly (without entering data)
|
|
118872
119632
|
// This handles cases like [block:type]\n{}\n\n[/block] where there are
|
|
118873
119633
|
// newlines after the data object
|
|
118874
|
-
if (code ===
|
|
119634
|
+
if (code === codes.leftSquareBracket) {
|
|
118875
119635
|
effects.enter('magicBlockMarkerEnd');
|
|
118876
119636
|
effects.consume(code);
|
|
118877
119637
|
return expectSlashFromContinuation;
|
|
@@ -118883,11 +119643,11 @@ function tokenizeMagicBlockFlow(effects, ok, nok) {
|
|
|
118883
119643
|
}
|
|
118884
119644
|
// Skip whitespace (spaces/tabs) before the data - stay in beforeData
|
|
118885
119645
|
// Don't enter magicBlockData token yet until we confirm there's a '{'
|
|
118886
|
-
if (code ===
|
|
119646
|
+
if (code === codes.space || code === codes.horizontalTab) {
|
|
118887
119647
|
return beforeDataWhitespace(code);
|
|
118888
119648
|
}
|
|
118889
119649
|
// Data must start with '{' for valid JSON
|
|
118890
|
-
if (code !==
|
|
119650
|
+
if (code !== codes.leftCurlyBrace) {
|
|
118891
119651
|
effects.exit('magicBlock');
|
|
118892
119652
|
return nok(code);
|
|
118893
119653
|
}
|
|
@@ -118908,14 +119668,14 @@ function tokenizeMagicBlockFlow(effects, ok, nok) {
|
|
|
118908
119668
|
if (markdownLineEnding(code)) {
|
|
118909
119669
|
return effects.check(syntax_nonLazyContinuation, continuationOkBeforeData, after)(code);
|
|
118910
119670
|
}
|
|
118911
|
-
if (code ===
|
|
119671
|
+
if (code === codes.space || code === codes.horizontalTab) {
|
|
118912
119672
|
// We need to consume this but can't without a token - use magicBlockData
|
|
118913
119673
|
// and track that we haven't seen '{' yet
|
|
118914
119674
|
effects.enter('magicBlockData');
|
|
118915
119675
|
effects.consume(code);
|
|
118916
119676
|
return beforeDataWhitespaceContinue;
|
|
118917
119677
|
}
|
|
118918
|
-
if (code ===
|
|
119678
|
+
if (code === codes.leftCurlyBrace) {
|
|
118919
119679
|
seenOpenBrace = true;
|
|
118920
119680
|
effects.enter('magicBlockData');
|
|
118921
119681
|
return captureData(code);
|
|
@@ -118936,11 +119696,11 @@ function tokenizeMagicBlockFlow(effects, ok, nok) {
|
|
|
118936
119696
|
effects.exit('magicBlockData');
|
|
118937
119697
|
return effects.check(syntax_nonLazyContinuation, continuationOk, after)(code);
|
|
118938
119698
|
}
|
|
118939
|
-
if (code ===
|
|
119699
|
+
if (code === codes.space || code === codes.horizontalTab) {
|
|
118940
119700
|
effects.consume(code);
|
|
118941
119701
|
return beforeDataWhitespaceContinue;
|
|
118942
119702
|
}
|
|
118943
|
-
if (code ===
|
|
119703
|
+
if (code === codes.leftCurlyBrace) {
|
|
118944
119704
|
seenOpenBrace = true;
|
|
118945
119705
|
return captureData(code);
|
|
118946
119706
|
}
|
|
@@ -118975,23 +119735,23 @@ function tokenizeMagicBlockFlow(effects, ok, nok) {
|
|
|
118975
119735
|
return captureData;
|
|
118976
119736
|
}
|
|
118977
119737
|
if (jsonState.inString) {
|
|
118978
|
-
if (code ===
|
|
119738
|
+
if (code === codes.backslash) {
|
|
118979
119739
|
jsonState.escapeNext = true;
|
|
118980
119740
|
effects.consume(code);
|
|
118981
119741
|
return captureData;
|
|
118982
119742
|
}
|
|
118983
|
-
if (code ===
|
|
119743
|
+
if (code === codes.quotationMark) {
|
|
118984
119744
|
jsonState.inString = false;
|
|
118985
119745
|
}
|
|
118986
119746
|
effects.consume(code);
|
|
118987
119747
|
return captureData;
|
|
118988
119748
|
}
|
|
118989
|
-
if (code ===
|
|
119749
|
+
if (code === codes.quotationMark) {
|
|
118990
119750
|
jsonState.inString = true;
|
|
118991
119751
|
effects.consume(code);
|
|
118992
119752
|
return captureData;
|
|
118993
119753
|
}
|
|
118994
|
-
if (code ===
|
|
119754
|
+
if (code === codes.leftSquareBracket) {
|
|
118995
119755
|
effects.exit('magicBlockData');
|
|
118996
119756
|
effects.enter('magicBlockMarkerEnd');
|
|
118997
119757
|
effects.consume(code);
|
|
@@ -119024,7 +119784,7 @@ function tokenizeMagicBlockFlow(effects, ok, nok) {
|
|
|
119024
119784
|
}
|
|
119025
119785
|
// Check if this is the start of the closing marker [/block]
|
|
119026
119786
|
// If so, handle it directly without entering magicBlockData
|
|
119027
|
-
if (code ===
|
|
119787
|
+
if (code === codes.leftSquareBracket) {
|
|
119028
119788
|
effects.enter('magicBlockMarkerEnd');
|
|
119029
119789
|
effects.consume(code);
|
|
119030
119790
|
return expectSlashFromContinuation;
|
|
@@ -119046,7 +119806,7 @@ function tokenizeMagicBlockFlow(effects, ok, nok) {
|
|
|
119046
119806
|
effects.exit('magicBlockMarkerEnd');
|
|
119047
119807
|
return effects.check(syntax_nonLazyContinuation, continuationOkBeforeData, after)(code);
|
|
119048
119808
|
}
|
|
119049
|
-
if (code ===
|
|
119809
|
+
if (code === codes.slash) {
|
|
119050
119810
|
effects.consume(code);
|
|
119051
119811
|
return expectClosingB;
|
|
119052
119812
|
}
|
|
@@ -119057,7 +119817,7 @@ function tokenizeMagicBlockFlow(effects, ok, nok) {
|
|
|
119057
119817
|
// The [ was consumed by the marker, so we need to conceptually "have it" in our data
|
|
119058
119818
|
// But since we already consumed it into the marker, we need a different approach
|
|
119059
119819
|
// Re-classify: consume this character as data and continue
|
|
119060
|
-
if (code ===
|
|
119820
|
+
if (code === codes.quotationMark)
|
|
119061
119821
|
jsonState.inString = true;
|
|
119062
119822
|
effects.consume(code);
|
|
119063
119823
|
return captureData;
|
|
@@ -119073,10 +119833,10 @@ function tokenizeMagicBlockFlow(effects, ok, nok) {
|
|
|
119073
119833
|
effects.exit('magicBlockMarkerEnd');
|
|
119074
119834
|
return effects.check(syntax_nonLazyContinuation, continuationOk, after)(code);
|
|
119075
119835
|
}
|
|
119076
|
-
if (code !==
|
|
119836
|
+
if (code !== codes.slash) {
|
|
119077
119837
|
effects.exit('magicBlockMarkerEnd');
|
|
119078
119838
|
effects.enter('magicBlockData');
|
|
119079
|
-
if (code ===
|
|
119839
|
+
if (code === codes.quotationMark)
|
|
119080
119840
|
jsonState.inString = true;
|
|
119081
119841
|
effects.consume(code);
|
|
119082
119842
|
return captureData;
|
|
@@ -119090,10 +119850,10 @@ function tokenizeMagicBlockFlow(effects, ok, nok) {
|
|
|
119090
119850
|
effects.exit('magicBlock');
|
|
119091
119851
|
return nok(code);
|
|
119092
119852
|
}
|
|
119093
|
-
if (code !==
|
|
119853
|
+
if (code !== codes.lowercaseB) {
|
|
119094
119854
|
effects.exit('magicBlockMarkerEnd');
|
|
119095
119855
|
effects.enter('magicBlockData');
|
|
119096
|
-
if (code ===
|
|
119856
|
+
if (code === codes.quotationMark)
|
|
119097
119857
|
jsonState.inString = true;
|
|
119098
119858
|
effects.consume(code);
|
|
119099
119859
|
return captureData;
|
|
@@ -119107,10 +119867,10 @@ function tokenizeMagicBlockFlow(effects, ok, nok) {
|
|
|
119107
119867
|
effects.exit('magicBlock');
|
|
119108
119868
|
return nok(code);
|
|
119109
119869
|
}
|
|
119110
|
-
if (code !==
|
|
119870
|
+
if (code !== codes.lowercaseL) {
|
|
119111
119871
|
effects.exit('magicBlockMarkerEnd');
|
|
119112
119872
|
effects.enter('magicBlockData');
|
|
119113
|
-
if (code ===
|
|
119873
|
+
if (code === codes.quotationMark)
|
|
119114
119874
|
jsonState.inString = true;
|
|
119115
119875
|
effects.consume(code);
|
|
119116
119876
|
return captureData;
|
|
@@ -119124,10 +119884,10 @@ function tokenizeMagicBlockFlow(effects, ok, nok) {
|
|
|
119124
119884
|
effects.exit('magicBlock');
|
|
119125
119885
|
return nok(code);
|
|
119126
119886
|
}
|
|
119127
|
-
if (code !==
|
|
119887
|
+
if (code !== codes.lowercaseO) {
|
|
119128
119888
|
effects.exit('magicBlockMarkerEnd');
|
|
119129
119889
|
effects.enter('magicBlockData');
|
|
119130
|
-
if (code ===
|
|
119890
|
+
if (code === codes.quotationMark)
|
|
119131
119891
|
jsonState.inString = true;
|
|
119132
119892
|
effects.consume(code);
|
|
119133
119893
|
return captureData;
|
|
@@ -119141,10 +119901,10 @@ function tokenizeMagicBlockFlow(effects, ok, nok) {
|
|
|
119141
119901
|
effects.exit('magicBlock');
|
|
119142
119902
|
return nok(code);
|
|
119143
119903
|
}
|
|
119144
|
-
if (code !==
|
|
119904
|
+
if (code !== codes.lowercaseC) {
|
|
119145
119905
|
effects.exit('magicBlockMarkerEnd');
|
|
119146
119906
|
effects.enter('magicBlockData');
|
|
119147
|
-
if (code ===
|
|
119907
|
+
if (code === codes.quotationMark)
|
|
119148
119908
|
jsonState.inString = true;
|
|
119149
119909
|
effects.consume(code);
|
|
119150
119910
|
return captureData;
|
|
@@ -119158,10 +119918,10 @@ function tokenizeMagicBlockFlow(effects, ok, nok) {
|
|
|
119158
119918
|
effects.exit('magicBlock');
|
|
119159
119919
|
return nok(code);
|
|
119160
119920
|
}
|
|
119161
|
-
if (code !==
|
|
119921
|
+
if (code !== codes.lowercaseK) {
|
|
119162
119922
|
effects.exit('magicBlockMarkerEnd');
|
|
119163
119923
|
effects.enter('magicBlockData');
|
|
119164
|
-
if (code ===
|
|
119924
|
+
if (code === codes.quotationMark)
|
|
119165
119925
|
jsonState.inString = true;
|
|
119166
119926
|
effects.consume(code);
|
|
119167
119927
|
return captureData;
|
|
@@ -119175,10 +119935,10 @@ function tokenizeMagicBlockFlow(effects, ok, nok) {
|
|
|
119175
119935
|
effects.exit('magicBlock');
|
|
119176
119936
|
return nok(code);
|
|
119177
119937
|
}
|
|
119178
|
-
if (code !==
|
|
119938
|
+
if (code !== codes.rightSquareBracket) {
|
|
119179
119939
|
effects.exit('magicBlockMarkerEnd');
|
|
119180
119940
|
effects.enter('magicBlockData');
|
|
119181
|
-
if (code ===
|
|
119941
|
+
if (code === codes.quotationMark)
|
|
119182
119942
|
jsonState.inString = true;
|
|
119183
119943
|
effects.consume(code);
|
|
119184
119944
|
return captureData;
|
|
@@ -119205,7 +119965,7 @@ function tokenizeMagicBlockFlow(effects, ok, nok) {
|
|
|
119205
119965
|
return ok(code);
|
|
119206
119966
|
}
|
|
119207
119967
|
// Space or tab - consume as trailing whitespace
|
|
119208
|
-
if (code ===
|
|
119968
|
+
if (code === codes.space || code === codes.horizontalTab) {
|
|
119209
119969
|
effects.enter('magicBlockTrailing');
|
|
119210
119970
|
effects.consume(code);
|
|
119211
119971
|
return consumeTrailingContinue;
|
|
@@ -119231,7 +119991,7 @@ function tokenizeMagicBlockFlow(effects, ok, nok) {
|
|
|
119231
119991
|
return ok(code);
|
|
119232
119992
|
}
|
|
119233
119993
|
// More space or tab - keep consuming
|
|
119234
|
-
if (code ===
|
|
119994
|
+
if (code === codes.space || code === codes.horizontalTab) {
|
|
119235
119995
|
effects.consume(code);
|
|
119236
119996
|
return consumeTrailingContinue;
|
|
119237
119997
|
}
|
|
@@ -119271,7 +120031,7 @@ function tokenizeMagicBlockText(effects, ok, nok) {
|
|
|
119271
120031
|
const closingMismatch = (code) => {
|
|
119272
120032
|
effects.exit('magicBlockMarkerEnd');
|
|
119273
120033
|
effects.enter('magicBlockData');
|
|
119274
|
-
if (code ===
|
|
120034
|
+
if (code === codes.quotationMark)
|
|
119275
120035
|
jsonState.inString = true;
|
|
119276
120036
|
effects.consume(code);
|
|
119277
120037
|
return captureData;
|
|
@@ -119283,7 +120043,7 @@ function tokenizeMagicBlockText(effects, ok, nok) {
|
|
|
119283
120043
|
const closingFromData = createClosingMarkerParser(effects, closingSuccess, closingMismatch, closingEof, jsonState);
|
|
119284
120044
|
return start;
|
|
119285
120045
|
function start(code) {
|
|
119286
|
-
if (code !==
|
|
120046
|
+
if (code !== codes.leftSquareBracket)
|
|
119287
120047
|
return nok(code);
|
|
119288
120048
|
effects.enter('magicBlock');
|
|
119289
120049
|
effects.enter('magicBlockMarkerStart');
|
|
@@ -119307,7 +120067,7 @@ function tokenizeMagicBlockText(effects, ok, nok) {
|
|
|
119307
120067
|
return beforeData;
|
|
119308
120068
|
}
|
|
119309
120069
|
// Check for closing marker directly (without entering data)
|
|
119310
|
-
if (code ===
|
|
120070
|
+
if (code === codes.leftSquareBracket) {
|
|
119311
120071
|
effects.enter('magicBlockMarkerEnd');
|
|
119312
120072
|
effects.consume(code);
|
|
119313
120073
|
return closingFromBeforeData.expectSlash;
|
|
@@ -119318,11 +120078,11 @@ function tokenizeMagicBlockText(effects, ok, nok) {
|
|
|
119318
120078
|
return captureData(code);
|
|
119319
120079
|
}
|
|
119320
120080
|
// Skip whitespace (spaces/tabs) before the data
|
|
119321
|
-
if (code ===
|
|
120081
|
+
if (code === codes.space || code === codes.horizontalTab) {
|
|
119322
120082
|
return beforeDataWhitespace(code);
|
|
119323
120083
|
}
|
|
119324
120084
|
// Data must start with '{' for valid JSON
|
|
119325
|
-
if (code !==
|
|
120085
|
+
if (code !== codes.leftCurlyBrace) {
|
|
119326
120086
|
return nok(code);
|
|
119327
120087
|
}
|
|
119328
120088
|
// We have '{' - enter data token and start capturing
|
|
@@ -119343,12 +120103,12 @@ function tokenizeMagicBlockText(effects, ok, nok) {
|
|
|
119343
120103
|
effects.exit('magicBlockLineEnding');
|
|
119344
120104
|
return beforeData;
|
|
119345
120105
|
}
|
|
119346
|
-
if (code ===
|
|
120106
|
+
if (code === codes.space || code === codes.horizontalTab) {
|
|
119347
120107
|
effects.enter('magicBlockData');
|
|
119348
120108
|
effects.consume(code);
|
|
119349
120109
|
return beforeDataWhitespaceContinue;
|
|
119350
120110
|
}
|
|
119351
|
-
if (code ===
|
|
120111
|
+
if (code === codes.leftCurlyBrace) {
|
|
119352
120112
|
seenOpenBrace = true;
|
|
119353
120113
|
effects.enter('magicBlockData');
|
|
119354
120114
|
return captureData(code);
|
|
@@ -119370,11 +120130,11 @@ function tokenizeMagicBlockText(effects, ok, nok) {
|
|
|
119370
120130
|
effects.exit('magicBlockLineEnding');
|
|
119371
120131
|
return beforeData;
|
|
119372
120132
|
}
|
|
119373
|
-
if (code ===
|
|
120133
|
+
if (code === codes.space || code === codes.horizontalTab) {
|
|
119374
120134
|
effects.consume(code);
|
|
119375
120135
|
return beforeDataWhitespaceContinue;
|
|
119376
120136
|
}
|
|
119377
|
-
if (code ===
|
|
120137
|
+
if (code === codes.leftCurlyBrace) {
|
|
119378
120138
|
seenOpenBrace = true;
|
|
119379
120139
|
return captureData(code);
|
|
119380
120140
|
}
|
|
@@ -119402,23 +120162,23 @@ function tokenizeMagicBlockText(effects, ok, nok) {
|
|
|
119402
120162
|
return captureData;
|
|
119403
120163
|
}
|
|
119404
120164
|
if (jsonState.inString) {
|
|
119405
|
-
if (code ===
|
|
120165
|
+
if (code === codes.backslash) {
|
|
119406
120166
|
jsonState.escapeNext = true;
|
|
119407
120167
|
effects.consume(code);
|
|
119408
120168
|
return captureData;
|
|
119409
120169
|
}
|
|
119410
|
-
if (code ===
|
|
120170
|
+
if (code === codes.quotationMark) {
|
|
119411
120171
|
jsonState.inString = false;
|
|
119412
120172
|
}
|
|
119413
120173
|
effects.consume(code);
|
|
119414
120174
|
return captureData;
|
|
119415
120175
|
}
|
|
119416
|
-
if (code ===
|
|
120176
|
+
if (code === codes.quotationMark) {
|
|
119417
120177
|
jsonState.inString = true;
|
|
119418
120178
|
effects.consume(code);
|
|
119419
120179
|
return captureData;
|
|
119420
120180
|
}
|
|
119421
|
-
if (code ===
|
|
120181
|
+
if (code === codes.leftSquareBracket) {
|
|
119422
120182
|
effects.exit('magicBlockData');
|
|
119423
120183
|
effects.enter('magicBlockMarkerEnd');
|
|
119424
120184
|
effects.consume(code);
|
|
@@ -119444,461 +120204,6 @@ function tokenizeMagicBlockText(effects, ok, nok) {
|
|
|
119444
120204
|
*/
|
|
119445
120205
|
|
|
119446
120206
|
|
|
119447
|
-
;// ./node_modules/micromark-util-symbol/lib/types.js
|
|
119448
|
-
/**
|
|
119449
|
-
* This module is compiled away!
|
|
119450
|
-
*
|
|
119451
|
-
* Here is the list of all types of tokens exposed by micromark, with a short
|
|
119452
|
-
* explanation of what they include and where they are found.
|
|
119453
|
-
* In picking names, generally, the rule is to be as explicit as possible
|
|
119454
|
-
* instead of reusing names.
|
|
119455
|
-
* For example, there is a `definitionDestination` and a `resourceDestination`,
|
|
119456
|
-
* instead of one shared name.
|
|
119457
|
-
*/
|
|
119458
|
-
|
|
119459
|
-
// Note: when changing the next record, you must also change `TokenTypeMap`
|
|
119460
|
-
// in `micromark-util-types/index.d.ts`.
|
|
119461
|
-
const types_types = /** @type {const} */ ({
|
|
119462
|
-
// Generic type for data, such as in a title, a destination, etc.
|
|
119463
|
-
data: 'data',
|
|
119464
|
-
|
|
119465
|
-
// Generic type for syntactic whitespace (tabs, virtual spaces, spaces).
|
|
119466
|
-
// Such as, between a fenced code fence and an info string.
|
|
119467
|
-
whitespace: 'whitespace',
|
|
119468
|
-
|
|
119469
|
-
// Generic type for line endings (line feed, carriage return, carriage return +
|
|
119470
|
-
// line feed).
|
|
119471
|
-
lineEnding: 'lineEnding',
|
|
119472
|
-
|
|
119473
|
-
// A line ending, but ending a blank line.
|
|
119474
|
-
lineEndingBlank: 'lineEndingBlank',
|
|
119475
|
-
|
|
119476
|
-
// Generic type for whitespace (tabs, virtual spaces, spaces) at the start of a
|
|
119477
|
-
// line.
|
|
119478
|
-
linePrefix: 'linePrefix',
|
|
119479
|
-
|
|
119480
|
-
// Generic type for whitespace (tabs, virtual spaces, spaces) at the end of a
|
|
119481
|
-
// line.
|
|
119482
|
-
lineSuffix: 'lineSuffix',
|
|
119483
|
-
|
|
119484
|
-
// Whole ATX heading:
|
|
119485
|
-
//
|
|
119486
|
-
// ```markdown
|
|
119487
|
-
// #
|
|
119488
|
-
// ## Alpha
|
|
119489
|
-
// ### Bravo ###
|
|
119490
|
-
// ```
|
|
119491
|
-
//
|
|
119492
|
-
// Includes `atxHeadingSequence`, `whitespace`, `atxHeadingText`.
|
|
119493
|
-
atxHeading: 'atxHeading',
|
|
119494
|
-
|
|
119495
|
-
// Sequence of number signs in an ATX heading (`###`).
|
|
119496
|
-
atxHeadingSequence: 'atxHeadingSequence',
|
|
119497
|
-
|
|
119498
|
-
// Content in an ATX heading (`alpha`).
|
|
119499
|
-
// Includes text.
|
|
119500
|
-
atxHeadingText: 'atxHeadingText',
|
|
119501
|
-
|
|
119502
|
-
// Whole autolink (`<https://example.com>` or `<admin@example.com>`)
|
|
119503
|
-
// Includes `autolinkMarker` and `autolinkProtocol` or `autolinkEmail`.
|
|
119504
|
-
autolink: 'autolink',
|
|
119505
|
-
|
|
119506
|
-
// Email autolink w/o markers (`admin@example.com`)
|
|
119507
|
-
autolinkEmail: 'autolinkEmail',
|
|
119508
|
-
|
|
119509
|
-
// Marker around an `autolinkProtocol` or `autolinkEmail` (`<` or `>`).
|
|
119510
|
-
autolinkMarker: 'autolinkMarker',
|
|
119511
|
-
|
|
119512
|
-
// Protocol autolink w/o markers (`https://example.com`)
|
|
119513
|
-
autolinkProtocol: 'autolinkProtocol',
|
|
119514
|
-
|
|
119515
|
-
// A whole character escape (`\-`).
|
|
119516
|
-
// Includes `escapeMarker` and `characterEscapeValue`.
|
|
119517
|
-
characterEscape: 'characterEscape',
|
|
119518
|
-
|
|
119519
|
-
// The escaped character (`-`).
|
|
119520
|
-
characterEscapeValue: 'characterEscapeValue',
|
|
119521
|
-
|
|
119522
|
-
// A whole character reference (`&`, `≠`, or `𝌆`).
|
|
119523
|
-
// Includes `characterReferenceMarker`, an optional
|
|
119524
|
-
// `characterReferenceMarkerNumeric`, in which case an optional
|
|
119525
|
-
// `characterReferenceMarkerHexadecimal`, and a `characterReferenceValue`.
|
|
119526
|
-
characterReference: 'characterReference',
|
|
119527
|
-
|
|
119528
|
-
// The start or end marker (`&` or `;`).
|
|
119529
|
-
characterReferenceMarker: 'characterReferenceMarker',
|
|
119530
|
-
|
|
119531
|
-
// Mark reference as numeric (`#`).
|
|
119532
|
-
characterReferenceMarkerNumeric: 'characterReferenceMarkerNumeric',
|
|
119533
|
-
|
|
119534
|
-
// Mark reference as numeric (`x` or `X`).
|
|
119535
|
-
characterReferenceMarkerHexadecimal: 'characterReferenceMarkerHexadecimal',
|
|
119536
|
-
|
|
119537
|
-
// Value of character reference w/o markers (`amp`, `8800`, or `1D306`).
|
|
119538
|
-
characterReferenceValue: 'characterReferenceValue',
|
|
119539
|
-
|
|
119540
|
-
// Whole fenced code:
|
|
119541
|
-
//
|
|
119542
|
-
// ````markdown
|
|
119543
|
-
// ```js
|
|
119544
|
-
// alert(1)
|
|
119545
|
-
// ```
|
|
119546
|
-
// ````
|
|
119547
|
-
codeFenced: 'codeFenced',
|
|
119548
|
-
|
|
119549
|
-
// A fenced code fence, including whitespace, sequence, info, and meta
|
|
119550
|
-
// (` ```js `).
|
|
119551
|
-
codeFencedFence: 'codeFencedFence',
|
|
119552
|
-
|
|
119553
|
-
// Sequence of grave accent or tilde characters (` ``` `) in a fence.
|
|
119554
|
-
codeFencedFenceSequence: 'codeFencedFenceSequence',
|
|
119555
|
-
|
|
119556
|
-
// Info word (`js`) in a fence.
|
|
119557
|
-
// Includes string.
|
|
119558
|
-
codeFencedFenceInfo: 'codeFencedFenceInfo',
|
|
119559
|
-
|
|
119560
|
-
// Meta words (`highlight="1"`) in a fence.
|
|
119561
|
-
// Includes string.
|
|
119562
|
-
codeFencedFenceMeta: 'codeFencedFenceMeta',
|
|
119563
|
-
|
|
119564
|
-
// A line of code.
|
|
119565
|
-
codeFlowValue: 'codeFlowValue',
|
|
119566
|
-
|
|
119567
|
-
// Whole indented code:
|
|
119568
|
-
//
|
|
119569
|
-
// ```markdown
|
|
119570
|
-
// alert(1)
|
|
119571
|
-
// ```
|
|
119572
|
-
//
|
|
119573
|
-
// Includes `lineEnding`, `linePrefix`, and `codeFlowValue`.
|
|
119574
|
-
codeIndented: 'codeIndented',
|
|
119575
|
-
|
|
119576
|
-
// A text code (``` `alpha` ```).
|
|
119577
|
-
// Includes `codeTextSequence`, `codeTextData`, `lineEnding`, and can include
|
|
119578
|
-
// `codeTextPadding`.
|
|
119579
|
-
codeText: 'codeText',
|
|
119580
|
-
|
|
119581
|
-
codeTextData: 'codeTextData',
|
|
119582
|
-
|
|
119583
|
-
// A space or line ending right after or before a tick.
|
|
119584
|
-
codeTextPadding: 'codeTextPadding',
|
|
119585
|
-
|
|
119586
|
-
// A text code fence (` `` `).
|
|
119587
|
-
codeTextSequence: 'codeTextSequence',
|
|
119588
|
-
|
|
119589
|
-
// Whole content:
|
|
119590
|
-
//
|
|
119591
|
-
// ```markdown
|
|
119592
|
-
// [a]: b
|
|
119593
|
-
// c
|
|
119594
|
-
// =
|
|
119595
|
-
// d
|
|
119596
|
-
// ```
|
|
119597
|
-
//
|
|
119598
|
-
// Includes `paragraph` and `definition`.
|
|
119599
|
-
content: 'content',
|
|
119600
|
-
// Whole definition:
|
|
119601
|
-
//
|
|
119602
|
-
// ```markdown
|
|
119603
|
-
// [micromark]: https://github.com/micromark/micromark
|
|
119604
|
-
// ```
|
|
119605
|
-
//
|
|
119606
|
-
// Includes `definitionLabel`, `definitionMarker`, `whitespace`,
|
|
119607
|
-
// `definitionDestination`, and optionally `lineEnding` and `definitionTitle`.
|
|
119608
|
-
definition: 'definition',
|
|
119609
|
-
|
|
119610
|
-
// Destination of a definition (`https://github.com/micromark/micromark` or
|
|
119611
|
-
// `<https://github.com/micromark/micromark>`).
|
|
119612
|
-
// Includes `definitionDestinationLiteral` or `definitionDestinationRaw`.
|
|
119613
|
-
definitionDestination: 'definitionDestination',
|
|
119614
|
-
|
|
119615
|
-
// Enclosed destination of a definition
|
|
119616
|
-
// (`<https://github.com/micromark/micromark>`).
|
|
119617
|
-
// Includes `definitionDestinationLiteralMarker` and optionally
|
|
119618
|
-
// `definitionDestinationString`.
|
|
119619
|
-
definitionDestinationLiteral: 'definitionDestinationLiteral',
|
|
119620
|
-
|
|
119621
|
-
// Markers of an enclosed definition destination (`<` or `>`).
|
|
119622
|
-
definitionDestinationLiteralMarker: 'definitionDestinationLiteralMarker',
|
|
119623
|
-
|
|
119624
|
-
// Unenclosed destination of a definition
|
|
119625
|
-
// (`https://github.com/micromark/micromark`).
|
|
119626
|
-
// Includes `definitionDestinationString`.
|
|
119627
|
-
definitionDestinationRaw: 'definitionDestinationRaw',
|
|
119628
|
-
|
|
119629
|
-
// Text in an destination (`https://github.com/micromark/micromark`).
|
|
119630
|
-
// Includes string.
|
|
119631
|
-
definitionDestinationString: 'definitionDestinationString',
|
|
119632
|
-
|
|
119633
|
-
// Label of a definition (`[micromark]`).
|
|
119634
|
-
// Includes `definitionLabelMarker` and `definitionLabelString`.
|
|
119635
|
-
definitionLabel: 'definitionLabel',
|
|
119636
|
-
|
|
119637
|
-
// Markers of a definition label (`[` or `]`).
|
|
119638
|
-
definitionLabelMarker: 'definitionLabelMarker',
|
|
119639
|
-
|
|
119640
|
-
// Value of a definition label (`micromark`).
|
|
119641
|
-
// Includes string.
|
|
119642
|
-
definitionLabelString: 'definitionLabelString',
|
|
119643
|
-
|
|
119644
|
-
// Marker between a label and a destination (`:`).
|
|
119645
|
-
definitionMarker: 'definitionMarker',
|
|
119646
|
-
|
|
119647
|
-
// Title of a definition (`"x"`, `'y'`, or `(z)`).
|
|
119648
|
-
// Includes `definitionTitleMarker` and optionally `definitionTitleString`.
|
|
119649
|
-
definitionTitle: 'definitionTitle',
|
|
119650
|
-
|
|
119651
|
-
// Marker around a title of a definition (`"`, `'`, `(`, or `)`).
|
|
119652
|
-
definitionTitleMarker: 'definitionTitleMarker',
|
|
119653
|
-
|
|
119654
|
-
// Data without markers in a title (`z`).
|
|
119655
|
-
// Includes string.
|
|
119656
|
-
definitionTitleString: 'definitionTitleString',
|
|
119657
|
-
|
|
119658
|
-
// Emphasis (`*alpha*`).
|
|
119659
|
-
// Includes `emphasisSequence` and `emphasisText`.
|
|
119660
|
-
emphasis: 'emphasis',
|
|
119661
|
-
|
|
119662
|
-
// Sequence of emphasis markers (`*` or `_`).
|
|
119663
|
-
emphasisSequence: 'emphasisSequence',
|
|
119664
|
-
|
|
119665
|
-
// Emphasis text (`alpha`).
|
|
119666
|
-
// Includes text.
|
|
119667
|
-
emphasisText: 'emphasisText',
|
|
119668
|
-
|
|
119669
|
-
// The character escape marker (`\`).
|
|
119670
|
-
escapeMarker: 'escapeMarker',
|
|
119671
|
-
|
|
119672
|
-
// A hard break created with a backslash (`\\n`).
|
|
119673
|
-
// Note: does not include the line ending.
|
|
119674
|
-
hardBreakEscape: 'hardBreakEscape',
|
|
119675
|
-
|
|
119676
|
-
// A hard break created with trailing spaces (` \n`).
|
|
119677
|
-
// Does not include the line ending.
|
|
119678
|
-
hardBreakTrailing: 'hardBreakTrailing',
|
|
119679
|
-
|
|
119680
|
-
// Flow HTML:
|
|
119681
|
-
//
|
|
119682
|
-
// ```markdown
|
|
119683
|
-
// <div
|
|
119684
|
-
// ```
|
|
119685
|
-
//
|
|
119686
|
-
// Inlcudes `lineEnding`, `htmlFlowData`.
|
|
119687
|
-
htmlFlow: 'htmlFlow',
|
|
119688
|
-
|
|
119689
|
-
htmlFlowData: 'htmlFlowData',
|
|
119690
|
-
|
|
119691
|
-
// HTML in text (the tag in `a <i> b`).
|
|
119692
|
-
// Includes `lineEnding`, `htmlTextData`.
|
|
119693
|
-
htmlText: 'htmlText',
|
|
119694
|
-
|
|
119695
|
-
htmlTextData: 'htmlTextData',
|
|
119696
|
-
|
|
119697
|
-
// Whole image (``, `![alpha][bravo]`, `![alpha][]`, or
|
|
119698
|
-
// `![alpha]`).
|
|
119699
|
-
// Includes `label` and an optional `resource` or `reference`.
|
|
119700
|
-
image: 'image',
|
|
119701
|
-
|
|
119702
|
-
// Whole link label (`[*alpha*]`).
|
|
119703
|
-
// Includes `labelLink` or `labelImage`, `labelText`, and `labelEnd`.
|
|
119704
|
-
label: 'label',
|
|
119705
|
-
|
|
119706
|
-
// Text in an label (`*alpha*`).
|
|
119707
|
-
// Includes text.
|
|
119708
|
-
labelText: 'labelText',
|
|
119709
|
-
|
|
119710
|
-
// Start a link label (`[`).
|
|
119711
|
-
// Includes a `labelMarker`.
|
|
119712
|
-
labelLink: 'labelLink',
|
|
119713
|
-
|
|
119714
|
-
// Start an image label (`![`).
|
|
119715
|
-
// Includes `labelImageMarker` and `labelMarker`.
|
|
119716
|
-
labelImage: 'labelImage',
|
|
119717
|
-
|
|
119718
|
-
// Marker of a label (`[` or `]`).
|
|
119719
|
-
labelMarker: 'labelMarker',
|
|
119720
|
-
|
|
119721
|
-
// Marker to start an image (`!`).
|
|
119722
|
-
labelImageMarker: 'labelImageMarker',
|
|
119723
|
-
|
|
119724
|
-
// End a label (`]`).
|
|
119725
|
-
// Includes `labelMarker`.
|
|
119726
|
-
labelEnd: 'labelEnd',
|
|
119727
|
-
|
|
119728
|
-
// Whole link (`[alpha](bravo)`, `[alpha][bravo]`, `[alpha][]`, or `[alpha]`).
|
|
119729
|
-
// Includes `label` and an optional `resource` or `reference`.
|
|
119730
|
-
link: 'link',
|
|
119731
|
-
|
|
119732
|
-
// Whole paragraph:
|
|
119733
|
-
//
|
|
119734
|
-
// ```markdown
|
|
119735
|
-
// alpha
|
|
119736
|
-
// bravo.
|
|
119737
|
-
// ```
|
|
119738
|
-
//
|
|
119739
|
-
// Includes text.
|
|
119740
|
-
paragraph: 'paragraph',
|
|
119741
|
-
|
|
119742
|
-
// A reference (`[alpha]` or `[]`).
|
|
119743
|
-
// Includes `referenceMarker` and an optional `referenceString`.
|
|
119744
|
-
reference: 'reference',
|
|
119745
|
-
|
|
119746
|
-
// A reference marker (`[` or `]`).
|
|
119747
|
-
referenceMarker: 'referenceMarker',
|
|
119748
|
-
|
|
119749
|
-
// Reference text (`alpha`).
|
|
119750
|
-
// Includes string.
|
|
119751
|
-
referenceString: 'referenceString',
|
|
119752
|
-
|
|
119753
|
-
// A resource (`(https://example.com "alpha")`).
|
|
119754
|
-
// Includes `resourceMarker`, an optional `resourceDestination` with an optional
|
|
119755
|
-
// `whitespace` and `resourceTitle`.
|
|
119756
|
-
resource: 'resource',
|
|
119757
|
-
|
|
119758
|
-
// A resource destination (`https://example.com`).
|
|
119759
|
-
// Includes `resourceDestinationLiteral` or `resourceDestinationRaw`.
|
|
119760
|
-
resourceDestination: 'resourceDestination',
|
|
119761
|
-
|
|
119762
|
-
// A literal resource destination (`<https://example.com>`).
|
|
119763
|
-
// Includes `resourceDestinationLiteralMarker` and optionally
|
|
119764
|
-
// `resourceDestinationString`.
|
|
119765
|
-
resourceDestinationLiteral: 'resourceDestinationLiteral',
|
|
119766
|
-
|
|
119767
|
-
// A resource destination marker (`<` or `>`).
|
|
119768
|
-
resourceDestinationLiteralMarker: 'resourceDestinationLiteralMarker',
|
|
119769
|
-
|
|
119770
|
-
// A raw resource destination (`https://example.com`).
|
|
119771
|
-
// Includes `resourceDestinationString`.
|
|
119772
|
-
resourceDestinationRaw: 'resourceDestinationRaw',
|
|
119773
|
-
|
|
119774
|
-
// Resource destination text (`https://example.com`).
|
|
119775
|
-
// Includes string.
|
|
119776
|
-
resourceDestinationString: 'resourceDestinationString',
|
|
119777
|
-
|
|
119778
|
-
// A resource marker (`(` or `)`).
|
|
119779
|
-
resourceMarker: 'resourceMarker',
|
|
119780
|
-
|
|
119781
|
-
// A resource title (`"alpha"`, `'alpha'`, or `(alpha)`).
|
|
119782
|
-
// Includes `resourceTitleMarker` and optionally `resourceTitleString`.
|
|
119783
|
-
resourceTitle: 'resourceTitle',
|
|
119784
|
-
|
|
119785
|
-
// A resource title marker (`"`, `'`, `(`, or `)`).
|
|
119786
|
-
resourceTitleMarker: 'resourceTitleMarker',
|
|
119787
|
-
|
|
119788
|
-
// Resource destination title (`alpha`).
|
|
119789
|
-
// Includes string.
|
|
119790
|
-
resourceTitleString: 'resourceTitleString',
|
|
119791
|
-
|
|
119792
|
-
// Whole setext heading:
|
|
119793
|
-
//
|
|
119794
|
-
// ```markdown
|
|
119795
|
-
// alpha
|
|
119796
|
-
// bravo
|
|
119797
|
-
// =====
|
|
119798
|
-
// ```
|
|
119799
|
-
//
|
|
119800
|
-
// Includes `setextHeadingText`, `lineEnding`, `linePrefix`, and
|
|
119801
|
-
// `setextHeadingLine`.
|
|
119802
|
-
setextHeading: 'setextHeading',
|
|
119803
|
-
|
|
119804
|
-
// Content in a setext heading (`alpha\nbravo`).
|
|
119805
|
-
// Includes text.
|
|
119806
|
-
setextHeadingText: 'setextHeadingText',
|
|
119807
|
-
|
|
119808
|
-
// Underline in a setext heading, including whitespace suffix (`==`).
|
|
119809
|
-
// Includes `setextHeadingLineSequence`.
|
|
119810
|
-
setextHeadingLine: 'setextHeadingLine',
|
|
119811
|
-
|
|
119812
|
-
// Sequence of equals or dash characters in underline in a setext heading (`-`).
|
|
119813
|
-
setextHeadingLineSequence: 'setextHeadingLineSequence',
|
|
119814
|
-
|
|
119815
|
-
// Strong (`**alpha**`).
|
|
119816
|
-
// Includes `strongSequence` and `strongText`.
|
|
119817
|
-
strong: 'strong',
|
|
119818
|
-
|
|
119819
|
-
// Sequence of strong markers (`**` or `__`).
|
|
119820
|
-
strongSequence: 'strongSequence',
|
|
119821
|
-
|
|
119822
|
-
// Strong text (`alpha`).
|
|
119823
|
-
// Includes text.
|
|
119824
|
-
strongText: 'strongText',
|
|
119825
|
-
|
|
119826
|
-
// Whole thematic break:
|
|
119827
|
-
//
|
|
119828
|
-
// ```markdown
|
|
119829
|
-
// * * *
|
|
119830
|
-
// ```
|
|
119831
|
-
//
|
|
119832
|
-
// Includes `thematicBreakSequence` and `whitespace`.
|
|
119833
|
-
thematicBreak: 'thematicBreak',
|
|
119834
|
-
|
|
119835
|
-
// A sequence of one or more thematic break markers (`***`).
|
|
119836
|
-
thematicBreakSequence: 'thematicBreakSequence',
|
|
119837
|
-
|
|
119838
|
-
// Whole block quote:
|
|
119839
|
-
//
|
|
119840
|
-
// ```markdown
|
|
119841
|
-
// > a
|
|
119842
|
-
// >
|
|
119843
|
-
// > b
|
|
119844
|
-
// ```
|
|
119845
|
-
//
|
|
119846
|
-
// Includes `blockQuotePrefix` and flow.
|
|
119847
|
-
blockQuote: 'blockQuote',
|
|
119848
|
-
// The `>` or `> ` of a block quote.
|
|
119849
|
-
blockQuotePrefix: 'blockQuotePrefix',
|
|
119850
|
-
// The `>` of a block quote prefix.
|
|
119851
|
-
blockQuoteMarker: 'blockQuoteMarker',
|
|
119852
|
-
// The optional ` ` of a block quote prefix.
|
|
119853
|
-
blockQuotePrefixWhitespace: 'blockQuotePrefixWhitespace',
|
|
119854
|
-
|
|
119855
|
-
// Whole ordered list:
|
|
119856
|
-
//
|
|
119857
|
-
// ```markdown
|
|
119858
|
-
// 1. a
|
|
119859
|
-
// b
|
|
119860
|
-
// ```
|
|
119861
|
-
//
|
|
119862
|
-
// Includes `listItemPrefix`, flow, and optionally `listItemIndent` on further
|
|
119863
|
-
// lines.
|
|
119864
|
-
listOrdered: 'listOrdered',
|
|
119865
|
-
|
|
119866
|
-
// Whole unordered list:
|
|
119867
|
-
//
|
|
119868
|
-
// ```markdown
|
|
119869
|
-
// - a
|
|
119870
|
-
// b
|
|
119871
|
-
// ```
|
|
119872
|
-
//
|
|
119873
|
-
// Includes `listItemPrefix`, flow, and optionally `listItemIndent` on further
|
|
119874
|
-
// lines.
|
|
119875
|
-
listUnordered: 'listUnordered',
|
|
119876
|
-
|
|
119877
|
-
// The indent of further list item lines.
|
|
119878
|
-
listItemIndent: 'listItemIndent',
|
|
119879
|
-
|
|
119880
|
-
// A marker, as in, `*`, `+`, `-`, `.`, or `)`.
|
|
119881
|
-
listItemMarker: 'listItemMarker',
|
|
119882
|
-
|
|
119883
|
-
// The thing that starts a list item, such as `1. `.
|
|
119884
|
-
// Includes `listItemValue` if ordered, `listItemMarker`, and
|
|
119885
|
-
// `listItemPrefixWhitespace` (unless followed by a line ending).
|
|
119886
|
-
listItemPrefix: 'listItemPrefix',
|
|
119887
|
-
|
|
119888
|
-
// The whitespace after a marker.
|
|
119889
|
-
listItemPrefixWhitespace: 'listItemPrefixWhitespace',
|
|
119890
|
-
|
|
119891
|
-
// The numerical value of an ordered item.
|
|
119892
|
-
listItemValue: 'listItemValue',
|
|
119893
|
-
|
|
119894
|
-
// Internal types used for subtokenizers, compiled away
|
|
119895
|
-
chunkDocument: 'chunkDocument',
|
|
119896
|
-
chunkContent: 'chunkContent',
|
|
119897
|
-
chunkFlow: 'chunkFlow',
|
|
119898
|
-
chunkText: 'chunkText',
|
|
119899
|
-
chunkString: 'chunkString'
|
|
119900
|
-
})
|
|
119901
|
-
|
|
119902
120207
|
;// ./lib/micromark/mdx-component/syntax.ts
|
|
119903
120208
|
|
|
119904
120209
|
|
|
@@ -119914,8 +120219,8 @@ const htmlFlowTagNames = new Set([...htmlRawNames, ...htmlBlockNames]);
|
|
|
119914
120219
|
// blank lines between nested JSX siblings don't fragment the block. Excludes table
|
|
119915
120220
|
// tags (mdxishTables owns their blank lines) and voids (never close).
|
|
119916
120221
|
const plainBlockClaimTagNames = new Set([...htmlBlockNames].filter(tag => !HTML_TABLE_STRUCTURE_TAGS.has(tag) && !HTML_VOID_ELEMENTS.has(tag)));
|
|
119917
|
-
const
|
|
119918
|
-
tokenize:
|
|
120222
|
+
const mdx_component_syntax_nonLazyContinuationStart = {
|
|
120223
|
+
tokenize: mdx_component_syntax_tokenizeNonLazyContinuationStart,
|
|
119919
120224
|
partial: true,
|
|
119920
120225
|
};
|
|
119921
120226
|
// Lookahead for `plainClaimLineStart`: is this line markup-only, or a paragraph
|
|
@@ -120009,11 +120314,11 @@ function createTokenize(mode) {
|
|
|
120009
120314
|
// When a } brings braceDepth back to a saved value, we return to the
|
|
120010
120315
|
// template literal instead of continuing in the brace expression.
|
|
120011
120316
|
const templateStack = [];
|
|
120012
|
-
const isAlpha = (code) => (code >=
|
|
120013
|
-
(code >=
|
|
120317
|
+
const isAlpha = (code) => (code >= codes.uppercaseA && code <= codes.uppercaseZ) ||
|
|
120318
|
+
(code >= codes.lowercaseA && code <= codes.lowercaseZ);
|
|
120014
120319
|
const isSameCaseAsTag = (code) => isLowercaseTag
|
|
120015
|
-
? code >=
|
|
120016
|
-
: code >=
|
|
120320
|
+
? code >= codes.lowercaseA && code <= codes.lowercaseZ
|
|
120321
|
+
: code >= codes.uppercaseA && code <= codes.uppercaseZ;
|
|
120017
120322
|
// Shared brace-expression state machine. The two call sites differ only in where
|
|
120018
120323
|
// to continue after a line ending and where to return when braceDepth reaches zero.
|
|
120019
120324
|
function createBraceExprStates(continuationStart, afterBraceClose) {
|
|
@@ -120026,22 +120331,22 @@ function createTokenize(mode) {
|
|
|
120026
120331
|
effects.exit('mdxComponentData');
|
|
120027
120332
|
return continuationStart(code);
|
|
120028
120333
|
}
|
|
120029
|
-
if (code ===
|
|
120334
|
+
if (code === codes.quotationMark || code === codes.apostrophe) {
|
|
120030
120335
|
quoteChar = code;
|
|
120031
120336
|
effects.consume(code);
|
|
120032
120337
|
return braceString;
|
|
120033
120338
|
}
|
|
120034
|
-
if (code ===
|
|
120339
|
+
if (code === codes.graveAccent) {
|
|
120035
120340
|
inTemplateLit = true;
|
|
120036
120341
|
effects.consume(code);
|
|
120037
120342
|
return braceTemplateLiteral;
|
|
120038
120343
|
}
|
|
120039
|
-
if (code ===
|
|
120344
|
+
if (code === codes.leftCurlyBrace) {
|
|
120040
120345
|
braceDepth += 1;
|
|
120041
120346
|
effects.consume(code);
|
|
120042
120347
|
return braceExpr;
|
|
120043
120348
|
}
|
|
120044
|
-
if (code ===
|
|
120349
|
+
if (code === codes.rightCurlyBrace) {
|
|
120045
120350
|
braceDepth -= 1;
|
|
120046
120351
|
effects.consume(code);
|
|
120047
120352
|
if (templateStack.length > 0 && braceDepth === templateStack[templateStack.length - 1]) {
|
|
@@ -120066,7 +120371,7 @@ function createTokenize(mode) {
|
|
|
120066
120371
|
effects.exit('mdxComponentData');
|
|
120067
120372
|
return continuationStart(code);
|
|
120068
120373
|
}
|
|
120069
|
-
if (code ===
|
|
120374
|
+
if (code === codes.backslash) {
|
|
120070
120375
|
effects.consume(code);
|
|
120071
120376
|
return braceStringEscape;
|
|
120072
120377
|
}
|
|
@@ -120094,16 +120399,16 @@ function createTokenize(mode) {
|
|
|
120094
120399
|
effects.exit('mdxComponentData');
|
|
120095
120400
|
return continuationStart(code);
|
|
120096
120401
|
}
|
|
120097
|
-
if (code ===
|
|
120402
|
+
if (code === codes.graveAccent) {
|
|
120098
120403
|
inTemplateLit = false;
|
|
120099
120404
|
effects.consume(code);
|
|
120100
120405
|
return braceExpr;
|
|
120101
120406
|
}
|
|
120102
|
-
if (code ===
|
|
120407
|
+
if (code === codes.backslash) {
|
|
120103
120408
|
effects.consume(code);
|
|
120104
120409
|
return braceTemplateLiteralEscape;
|
|
120105
120410
|
}
|
|
120106
|
-
if (code ===
|
|
120411
|
+
if (code === codes.dollarSign) {
|
|
120107
120412
|
effects.consume(code);
|
|
120108
120413
|
return braceTemplateLiteralDollar;
|
|
120109
120414
|
}
|
|
@@ -120118,7 +120423,7 @@ function createTokenize(mode) {
|
|
|
120118
120423
|
return braceTemplateLiteral;
|
|
120119
120424
|
}
|
|
120120
120425
|
function braceTemplateLiteralDollar(code) {
|
|
120121
|
-
if (code ===
|
|
120426
|
+
if (code === codes.leftCurlyBrace) {
|
|
120122
120427
|
templateStack.push(braceDepth);
|
|
120123
120428
|
braceDepth += 1;
|
|
120124
120429
|
inTemplateLit = false;
|
|
@@ -120134,7 +120439,7 @@ function createTokenize(mode) {
|
|
|
120134
120439
|
return start;
|
|
120135
120440
|
// ── Start ──────────────────────────────────────────────────────────────
|
|
120136
120441
|
function start(code) {
|
|
120137
|
-
if (code !==
|
|
120442
|
+
if (code !== codes.lessThan)
|
|
120138
120443
|
return nok(code);
|
|
120139
120444
|
effects.enter('mdxComponent');
|
|
120140
120445
|
effects.enter('mdxComponentData');
|
|
@@ -120146,7 +120451,7 @@ function createTokenize(mode) {
|
|
|
120146
120451
|
// Uppercase A-Z → PascalCase MDX component. Flow mode claims block
|
|
120147
120452
|
// components; text mode only claims inline components (Anchor, Glossary),
|
|
120148
120453
|
// which is enforced once the full name is known in `tagNameRest`.
|
|
120149
|
-
if (code !== null && code >=
|
|
120454
|
+
if (code !== null && code >= codes.uppercaseA && code <= codes.uppercaseZ) {
|
|
120150
120455
|
tagName = String.fromCharCode(code);
|
|
120151
120456
|
isLowercaseTag = false;
|
|
120152
120457
|
sawBraceAttr = false;
|
|
@@ -120156,7 +120461,7 @@ function createTokenize(mode) {
|
|
|
120156
120461
|
// Lowercase a-z → HTML tag (claim only if `{...}` attr appears). In
|
|
120157
120462
|
// flow mode, refuse to interrupt a paragraph — same rule as html-flow
|
|
120158
120463
|
// type-7. The text variant picks these up during inline parsing.
|
|
120159
|
-
if (code !== null && code >=
|
|
120464
|
+
if (code !== null && code >= codes.lowercaseA && code <= codes.lowercaseZ) {
|
|
120160
120465
|
if (isFlow && self.interrupt)
|
|
120161
120466
|
return nok(code);
|
|
120162
120467
|
tagName = String.fromCharCode(code);
|
|
@@ -120169,10 +120474,10 @@ function createTokenize(mode) {
|
|
|
120169
120474
|
}
|
|
120170
120475
|
function tagNameRest(code) {
|
|
120171
120476
|
if (code !== null &&
|
|
120172
|
-
((code >=
|
|
120173
|
-
(code >=
|
|
120174
|
-
(code >=
|
|
120175
|
-
code ===
|
|
120477
|
+
((code >= codes.uppercaseA && code <= codes.uppercaseZ) ||
|
|
120478
|
+
(code >= codes.lowercaseA && code <= codes.lowercaseZ) ||
|
|
120479
|
+
(code >= codes.digit0 && code <= codes.digit9) ||
|
|
120480
|
+
code === codes.underscore)) {
|
|
120176
120481
|
tagName += String.fromCharCode(code);
|
|
120177
120482
|
effects.consume(code);
|
|
120178
120483
|
return tagNameRest;
|
|
@@ -120207,14 +120512,14 @@ function createTokenize(mode) {
|
|
|
120207
120512
|
return openTagContinuationStart(code);
|
|
120208
120513
|
}
|
|
120209
120514
|
// Self-closing />
|
|
120210
|
-
if (code ===
|
|
120515
|
+
if (code === codes.slash) {
|
|
120211
120516
|
if (requiresBraceAttr && !sawBraceAttr)
|
|
120212
120517
|
return nok(code);
|
|
120213
120518
|
effects.consume(code);
|
|
120214
120519
|
return selfCloseGt;
|
|
120215
120520
|
}
|
|
120216
120521
|
// End of opening tag
|
|
120217
|
-
if (code ===
|
|
120522
|
+
if (code === codes.greaterThan) {
|
|
120218
120523
|
if (requiresBraceAttr && !sawBraceAttr) {
|
|
120219
120524
|
// Plain lowercase block tags stay claimable in flow, gated per line by
|
|
120220
120525
|
// `plainClaimLineStart`; everything else falls through to CommonMark.
|
|
@@ -120227,13 +120532,13 @@ function createTokenize(mode) {
|
|
|
120227
120532
|
return body;
|
|
120228
120533
|
}
|
|
120229
120534
|
// Quoted attribute value
|
|
120230
|
-
if (code ===
|
|
120535
|
+
if (code === codes.quotationMark || code === codes.apostrophe) {
|
|
120231
120536
|
quoteChar = code;
|
|
120232
120537
|
effects.consume(code);
|
|
120233
120538
|
return inQuotedAttr;
|
|
120234
120539
|
}
|
|
120235
120540
|
// JSX expression attribute
|
|
120236
|
-
if (code ===
|
|
120541
|
+
if (code === codes.leftCurlyBrace) {
|
|
120237
120542
|
braceDepth = 1;
|
|
120238
120543
|
sawBraceAttr = true;
|
|
120239
120544
|
effects.consume(code);
|
|
@@ -120251,7 +120556,7 @@ function createTokenize(mode) {
|
|
|
120251
120556
|
effects.exit('mdxComponentData');
|
|
120252
120557
|
return openTagContinuationStart(code);
|
|
120253
120558
|
}
|
|
120254
|
-
if (code ===
|
|
120559
|
+
if (code === codes.backslash) {
|
|
120255
120560
|
effects.consume(code);
|
|
120256
120561
|
return inQuotedAttrEscape;
|
|
120257
120562
|
}
|
|
@@ -120271,7 +120576,7 @@ function createTokenize(mode) {
|
|
|
120271
120576
|
return inQuotedAttr;
|
|
120272
120577
|
}
|
|
120273
120578
|
function selfCloseGt(code) {
|
|
120274
|
-
if (code ===
|
|
120579
|
+
if (code === codes.greaterThan) {
|
|
120275
120580
|
effects.consume(code);
|
|
120276
120581
|
// Self-closing tag completes the token
|
|
120277
120582
|
return afterClose;
|
|
@@ -120281,7 +120586,7 @@ function createTokenize(mode) {
|
|
|
120281
120586
|
}
|
|
120282
120587
|
// Continuation for multi-line opening tags
|
|
120283
120588
|
function openTagContinuationStart(code) {
|
|
120284
|
-
return effects.check(
|
|
120589
|
+
return effects.check(mdx_component_syntax_nonLazyContinuationStart, openTagContinuationNonLazy, continuationAfter)(code);
|
|
120285
120590
|
}
|
|
120286
120591
|
function openTagContinuationNonLazy(code) {
|
|
120287
120592
|
sawLineEnding = true;
|
|
@@ -120324,25 +120629,25 @@ function createTokenize(mode) {
|
|
|
120324
120629
|
atLineStart = true;
|
|
120325
120630
|
return bodyContinuationStart(code);
|
|
120326
120631
|
}
|
|
120327
|
-
if (code !==
|
|
120632
|
+
if (code !== codes.space && code !== codes.horizontalTab) {
|
|
120328
120633
|
openerLineHasContent = true;
|
|
120329
120634
|
}
|
|
120330
|
-
if (code ===
|
|
120635
|
+
if (code === codes.backslash) {
|
|
120331
120636
|
effects.consume(code);
|
|
120332
120637
|
return bodyEscapedChar;
|
|
120333
120638
|
}
|
|
120334
|
-
if (code ===
|
|
120639
|
+
if (code === codes.lessThan) {
|
|
120335
120640
|
effects.consume(code);
|
|
120336
120641
|
return bodyLessThan;
|
|
120337
120642
|
}
|
|
120338
120643
|
// Code span tracking
|
|
120339
|
-
if (code ===
|
|
120644
|
+
if (code === codes.graveAccent) {
|
|
120340
120645
|
codeSpanOpenSize = 0;
|
|
120341
120646
|
return countOpenTicks(code);
|
|
120342
120647
|
}
|
|
120343
120648
|
// JSX expression child — track braces/template literals so the closing
|
|
120344
120649
|
// backtick of `{`...`}` is not misread as a code span opener
|
|
120345
|
-
if (code ===
|
|
120650
|
+
if (code === codes.leftCurlyBrace) {
|
|
120346
120651
|
braceDepth = 1;
|
|
120347
120652
|
inTemplateLit = false;
|
|
120348
120653
|
effects.consume(code);
|
|
@@ -120362,14 +120667,14 @@ function createTokenize(mode) {
|
|
|
120362
120667
|
}
|
|
120363
120668
|
// ── Code span handling ─────────────────────────────────────────────────
|
|
120364
120669
|
function countOpenTicks(code) {
|
|
120365
|
-
if (code ===
|
|
120670
|
+
if (code === codes.graveAccent) {
|
|
120366
120671
|
codeSpanOpenSize += 1;
|
|
120367
120672
|
effects.consume(code);
|
|
120368
120673
|
return countOpenTicks;
|
|
120369
120674
|
}
|
|
120370
120675
|
// 3+ backticks at line start = fenced code block
|
|
120371
120676
|
if (atLineStart && codeSpanOpenSize >= 3) {
|
|
120372
|
-
fenceChar =
|
|
120677
|
+
fenceChar = codes.graveAccent;
|
|
120373
120678
|
fenceLength = codeSpanOpenSize;
|
|
120374
120679
|
atLineStart = false;
|
|
120375
120680
|
return inFencedCode(code);
|
|
@@ -120379,7 +120684,7 @@ function createTokenize(mode) {
|
|
|
120379
120684
|
function inCodeSpan(code) {
|
|
120380
120685
|
if (code === null || markdownLineEnding(code))
|
|
120381
120686
|
return body(code);
|
|
120382
|
-
if (code ===
|
|
120687
|
+
if (code === codes.graveAccent) {
|
|
120383
120688
|
codeSpanCloseSize = 0;
|
|
120384
120689
|
return countCloseTicks(code);
|
|
120385
120690
|
}
|
|
@@ -120387,7 +120692,7 @@ function createTokenize(mode) {
|
|
|
120387
120692
|
return inCodeSpan;
|
|
120388
120693
|
}
|
|
120389
120694
|
function countCloseTicks(code) {
|
|
120390
|
-
if (code ===
|
|
120695
|
+
if (code === codes.graveAccent) {
|
|
120391
120696
|
codeSpanCloseSize += 1;
|
|
120392
120697
|
effects.consume(code);
|
|
120393
120698
|
return countCloseTicks;
|
|
@@ -120406,7 +120711,7 @@ function createTokenize(mode) {
|
|
|
120406
120711
|
return inFencedCode;
|
|
120407
120712
|
}
|
|
120408
120713
|
function fencedCodeContinuationStart(code) {
|
|
120409
|
-
return effects.check(
|
|
120714
|
+
return effects.check(mdx_component_syntax_nonLazyContinuationStart, fencedCodeContinuationNonLazy, continuationAfter)(code);
|
|
120410
120715
|
}
|
|
120411
120716
|
function fencedCodeContinuationNonLazy(code) {
|
|
120412
120717
|
sawLineEnding = true;
|
|
@@ -120421,6 +120726,16 @@ function createTokenize(mode) {
|
|
|
120421
120726
|
}
|
|
120422
120727
|
effects.enter('mdxComponentData');
|
|
120423
120728
|
fenceCloseLength = 0;
|
|
120729
|
+
return fencedCodeMaybeClose(code);
|
|
120730
|
+
}
|
|
120731
|
+
// Skip leading indentation before the closing-fence check: an indented fence
|
|
120732
|
+
// (the norm in a component body) closes on an equally-indented line, else the
|
|
120733
|
+
// closer is never matched and scanning runs to EOF (CX-3704).
|
|
120734
|
+
function fencedCodeMaybeClose(code) {
|
|
120735
|
+
if (markdownSpace(code)) {
|
|
120736
|
+
effects.consume(code);
|
|
120737
|
+
return fencedCodeMaybeClose;
|
|
120738
|
+
}
|
|
120424
120739
|
// Check for closing fence
|
|
120425
120740
|
if (code === fenceChar) {
|
|
120426
120741
|
fenceCloseLength = 1;
|
|
@@ -120450,7 +120765,7 @@ function createTokenize(mode) {
|
|
|
120450
120765
|
return body(code);
|
|
120451
120766
|
}
|
|
120452
120767
|
// Only spaces/tabs allowed after closing fence
|
|
120453
|
-
if (code ===
|
|
120768
|
+
if (code === codes.space || code === codes.horizontalTab) {
|
|
120454
120769
|
effects.consume(code);
|
|
120455
120770
|
return fenceCloseTrailing;
|
|
120456
120771
|
}
|
|
@@ -120459,7 +120774,7 @@ function createTokenize(mode) {
|
|
|
120459
120774
|
}
|
|
120460
120775
|
// ── Tilde fenced code detection ────────────────────────────────────────
|
|
120461
120776
|
function bodyAfterLineStart(code) {
|
|
120462
|
-
if (code ===
|
|
120777
|
+
if (code === codes.tilde) {
|
|
120463
120778
|
fenceCloseLength = 1;
|
|
120464
120779
|
effects.consume(code);
|
|
120465
120780
|
return countTildes;
|
|
@@ -120468,13 +120783,13 @@ function createTokenize(mode) {
|
|
|
120468
120783
|
return body(code);
|
|
120469
120784
|
}
|
|
120470
120785
|
function countTildes(code) {
|
|
120471
|
-
if (code ===
|
|
120786
|
+
if (code === codes.tilde) {
|
|
120472
120787
|
fenceCloseLength += 1;
|
|
120473
120788
|
effects.consume(code);
|
|
120474
120789
|
return countTildes;
|
|
120475
120790
|
}
|
|
120476
120791
|
if (fenceCloseLength >= 3) {
|
|
120477
|
-
fenceChar =
|
|
120792
|
+
fenceChar = codes.tilde;
|
|
120478
120793
|
fenceLength = fenceCloseLength;
|
|
120479
120794
|
return inFencedCode(code);
|
|
120480
120795
|
}
|
|
@@ -120484,7 +120799,7 @@ function createTokenize(mode) {
|
|
|
120484
120799
|
}
|
|
120485
120800
|
// ── Tag detection inside body ──────────────────────────────────────────
|
|
120486
120801
|
function bodyLessThan(code) {
|
|
120487
|
-
if (code ===
|
|
120802
|
+
if (code === codes.slash) {
|
|
120488
120803
|
if (onOpenerLine)
|
|
120489
120804
|
openerLineCloses += 1;
|
|
120490
120805
|
effects.consume(code);
|
|
@@ -120511,10 +120826,10 @@ function createTokenize(mode) {
|
|
|
120511
120826
|
// ── Nested opening tag ─────────────────────────────────────────────────
|
|
120512
120827
|
function nestedOpenTagName(code) {
|
|
120513
120828
|
if (code !== null &&
|
|
120514
|
-
((code >=
|
|
120515
|
-
(code >=
|
|
120516
|
-
(code >=
|
|
120517
|
-
code ===
|
|
120829
|
+
((code >= codes.uppercaseA && code <= codes.uppercaseZ) ||
|
|
120830
|
+
(code >= codes.lowercaseA && code <= codes.lowercaseZ) ||
|
|
120831
|
+
(code >= codes.digit0 && code <= codes.digit9) ||
|
|
120832
|
+
code === codes.underscore)) {
|
|
120518
120833
|
closingTagName += String.fromCharCode(code);
|
|
120519
120834
|
effects.consume(code);
|
|
120520
120835
|
return nestedOpenTagName;
|
|
@@ -120522,10 +120837,10 @@ function createTokenize(mode) {
|
|
|
120522
120837
|
// Same-name opener followed by a tag-end char bumps depth. A line ending
|
|
120523
120838
|
// counts too: Prettier puts a newline right after the name (`<div\n …\n>`).
|
|
120524
120839
|
if (closingTagName === tagName &&
|
|
120525
|
-
(code ===
|
|
120526
|
-
code ===
|
|
120527
|
-
code ===
|
|
120528
|
-
code ===
|
|
120840
|
+
(code === codes.greaterThan ||
|
|
120841
|
+
code === codes.slash ||
|
|
120842
|
+
code === codes.space ||
|
|
120843
|
+
code === codes.horizontalTab ||
|
|
120529
120844
|
markdownLineEnding(code))) {
|
|
120530
120845
|
depth += 1;
|
|
120531
120846
|
}
|
|
@@ -120544,15 +120859,15 @@ function createTokenize(mode) {
|
|
|
120544
120859
|
}
|
|
120545
120860
|
function closingTagNameRest(code) {
|
|
120546
120861
|
if (code !== null &&
|
|
120547
|
-
((code >=
|
|
120548
|
-
(code >=
|
|
120549
|
-
(code >=
|
|
120550
|
-
code ===
|
|
120862
|
+
((code >= codes.uppercaseA && code <= codes.uppercaseZ) ||
|
|
120863
|
+
(code >= codes.lowercaseA && code <= codes.lowercaseZ) ||
|
|
120864
|
+
(code >= codes.digit0 && code <= codes.digit9) ||
|
|
120865
|
+
code === codes.underscore)) {
|
|
120551
120866
|
closingTagName += String.fromCharCode(code);
|
|
120552
120867
|
effects.consume(code);
|
|
120553
120868
|
return closingTagNameRest;
|
|
120554
120869
|
}
|
|
120555
|
-
if (closingTagName === tagName && code ===
|
|
120870
|
+
if (closingTagName === tagName && code === codes.greaterThan) {
|
|
120556
120871
|
depth -= 1;
|
|
120557
120872
|
effects.consume(code);
|
|
120558
120873
|
if (depth === 0) {
|
|
@@ -120604,7 +120919,7 @@ function createTokenize(mode) {
|
|
|
120604
120919
|
}
|
|
120605
120920
|
// ── Body continuation (line endings) ───────────────────────────────────
|
|
120606
120921
|
function bodyContinuationStart(code) {
|
|
120607
|
-
return effects.check(
|
|
120922
|
+
return effects.check(mdx_component_syntax_nonLazyContinuationStart, bodyContinuationNonLazy, continuationAfter)(code);
|
|
120608
120923
|
}
|
|
120609
120924
|
function bodyContinuationNonLazy(code) {
|
|
120610
120925
|
sawLineEnding = true;
|
|
@@ -120636,9 +120951,16 @@ function createTokenize(mode) {
|
|
|
120636
120951
|
}
|
|
120637
120952
|
// Dispatch a non-blank continuation line: fenced code at line start, else body.
|
|
120638
120953
|
function bodyLineStart(code) {
|
|
120639
|
-
|
|
120954
|
+
// Skip leading indentation while staying "at line start" so an indented
|
|
120955
|
+
// fence is still recognized. Otherwise the first space clears `atLineStart`
|
|
120956
|
+
// and its content — including any unbalanced `{` — stays live text (CX-3704).
|
|
120957
|
+
if (atLineStart && markdownSpace(code)) {
|
|
120958
|
+
effects.consume(code);
|
|
120959
|
+
return bodyLineStart;
|
|
120960
|
+
}
|
|
120961
|
+
if (atLineStart && code === codes.tilde)
|
|
120640
120962
|
return bodyAfterLineStart(code);
|
|
120641
|
-
if (atLineStart && code ===
|
|
120963
|
+
if (atLineStart && code === codes.graveAccent) {
|
|
120642
120964
|
codeSpanOpenSize = 0;
|
|
120643
120965
|
// Leave `atLineStart` set — `countOpenTicks` needs it to tell a fence from an
|
|
120644
120966
|
// inline code span once the run of backticks is fully counted; it's cleared once
|
|
@@ -120653,7 +120975,7 @@ function createTokenize(mode) {
|
|
|
120653
120975
|
// fence) refuses so CommonMark html-flow reparses it exactly as it does today.
|
|
120654
120976
|
function plainClaimLineStart(code) {
|
|
120655
120977
|
// Leading whitespace only → treat as a blank line, matching CommonMark.
|
|
120656
|
-
if (code ===
|
|
120978
|
+
if (code === codes.space || code === codes.horizontalTab) {
|
|
120657
120979
|
effects.consume(code);
|
|
120658
120980
|
return plainClaimLineStart;
|
|
120659
120981
|
}
|
|
@@ -120666,7 +120988,7 @@ function createTokenize(mode) {
|
|
|
120666
120988
|
// paragraph that merely starts with a tag must fall back so its markdown
|
|
120667
120989
|
// parses and rehype-raw re-nests it into the wrapper.
|
|
120668
120990
|
if (pendingBlankLine) {
|
|
120669
|
-
if (code !==
|
|
120991
|
+
if (code !== codes.lessThan)
|
|
120670
120992
|
return nok(code);
|
|
120671
120993
|
return effects.check(markupOnlyContinuation, plainClaimContinue, nok)(code);
|
|
120672
120994
|
}
|
|
@@ -120686,7 +121008,7 @@ function createTokenize(mode) {
|
|
|
120686
121008
|
}
|
|
120687
121009
|
};
|
|
120688
121010
|
}
|
|
120689
|
-
function
|
|
121011
|
+
function mdx_component_syntax_tokenizeNonLazyContinuationStart(effects, ok, nok) {
|
|
120690
121012
|
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
120691
121013
|
const self = this;
|
|
120692
121014
|
return start;
|
|
@@ -120719,7 +121041,7 @@ function tokenizeMarkupOnlyContinuation(effects, ok, nok) {
|
|
|
120719
121041
|
return afterLessThan;
|
|
120720
121042
|
}
|
|
120721
121043
|
function afterLessThan(code) {
|
|
120722
|
-
if (code ===
|
|
121044
|
+
if (code === codes.slash) {
|
|
120723
121045
|
effects.consume(code);
|
|
120724
121046
|
return afterSlash;
|
|
120725
121047
|
}
|
|
@@ -120738,7 +121060,7 @@ function tokenizeMarkupOnlyContinuation(effects, ok, nok) {
|
|
|
120738
121060
|
function scanToLineEnd(code) {
|
|
120739
121061
|
if (code === null || markdownLineEnding(code)) {
|
|
120740
121062
|
effects.exit(types_types.data);
|
|
120741
|
-
return lastNonSpace ===
|
|
121063
|
+
return lastNonSpace === codes.greaterThan ? ok(code) : nok(code);
|
|
120742
121064
|
}
|
|
120743
121065
|
if (!markdownSpace(code))
|
|
120744
121066
|
lastNonSpace = code;
|
|
@@ -120771,8 +121093,8 @@ function tokenizeMarkupOnlyContinuation(effects, ok, nok) {
|
|
|
120771
121093
|
*/
|
|
120772
121094
|
function syntax_mdxComponent() {
|
|
120773
121095
|
return {
|
|
120774
|
-
flow: { [
|
|
120775
|
-
text: { [
|
|
121096
|
+
flow: { [codes.lessThan]: [mdxComponentFlowConstruct] },
|
|
121097
|
+
text: { [codes.lessThan]: [mdxComponentTextConstruct] },
|
|
120776
121098
|
};
|
|
120777
121099
|
}
|
|
120778
121100
|
|
|
@@ -120794,9 +121116,20 @@ function syntax_mdxComponent() {
|
|
|
120794
121116
|
|
|
120795
121117
|
|
|
120796
121118
|
|
|
121119
|
+
|
|
121120
|
+
|
|
121121
|
+
|
|
121122
|
+
|
|
121123
|
+
|
|
121124
|
+
|
|
120797
121125
|
const buildInlineMdProcessor = (safeMode) => {
|
|
120798
|
-
|
|
121126
|
+
// `jsxTable` must be present so a `<Table>`/`<table>` nested in a component
|
|
121127
|
+
// body (e.g. a `<Callout>`) is captured as one html node. Without it, blank
|
|
121128
|
+
// lines between rows let CommonMark HTML block type 6 fragment the table and
|
|
121129
|
+
// its rows spill out as text / indented code blocks (CX-3705).
|
|
121130
|
+
const micromarkExts = [syntax_jsxTable(), syntax_mdxComponent(), syntax_gemoji(), legacyVariable(), syntax_magicBlock()];
|
|
120799
121131
|
const fromMarkdownExts = [
|
|
121132
|
+
jsx_table_jsxTableFromMarkdown(),
|
|
120800
121133
|
mdx_component_mdxComponentFromMarkdown(),
|
|
120801
121134
|
gemojiFromMarkdown(),
|
|
120802
121135
|
legacyVariableFromMarkdown(),
|
|
@@ -120856,6 +121189,65 @@ const toMdxJsxTextElement = (name, attributes, children, position) => ({
|
|
|
120856
121189
|
children,
|
|
120857
121190
|
...(position ? { position } : {}),
|
|
120858
121191
|
});
|
|
121192
|
+
// Raw-body tags (pre/script/style/textarea) must stay byte-exact; table
|
|
121193
|
+
// structure (`table` + `tableTags`) is owned by `mdxishTables` and figures by
|
|
121194
|
+
// `mdxishJsxToMdast`, both of which run later on raw html nodes.
|
|
121195
|
+
const NON_PROMOTABLE_PLAIN_TAGS = new Set([...htmlRawNames, ...tableTags, 'table', 'figure', 'figcaption']);
|
|
121196
|
+
const NESTED_TABLE_RE = /<table[\s>]/i;
|
|
121197
|
+
const isMarkdownPromotableHtmlTag = (tag) => !NON_PROMOTABLE_PLAIN_TAGS.has(tag);
|
|
121198
|
+
// Expression nodes count as plain so `<div>{1+1}</div>` keeps its current
|
|
121199
|
+
// literal-brace behavior; variables/glossary already resolve inside raw html.
|
|
121200
|
+
const PLAIN_CONTENT_TYPES = new Set([
|
|
121201
|
+
'paragraph',
|
|
121202
|
+
'text',
|
|
121203
|
+
'html',
|
|
121204
|
+
'mdxTextExpression',
|
|
121205
|
+
'mdxFlowExpression',
|
|
121206
|
+
enums_NodeTypes.variable,
|
|
121207
|
+
enums_NodeTypes.glossary,
|
|
121208
|
+
]);
|
|
121209
|
+
// Promoting plain HTML is only worth bypassing rehype-raw's parse5 pass when
|
|
121210
|
+
// the body parses into an actual markdown construct.
|
|
121211
|
+
const containsMarkdownConstruct = (nodes) => nodes.some(node => !PLAIN_CONTENT_TYPES.has(node.type) ||
|
|
121212
|
+
('children' in node && Array.isArray(node.children) && containsMarkdownConstruct(node.children)));
|
|
121213
|
+
/**
|
|
121214
|
+
* Index of the `</tag>` that balances the already-consumed opening tag (the
|
|
121215
|
+
* caller starts us one level deep). `lastIndexOf` mis-slices sibling same-tag
|
|
121216
|
+
* pairs like `<div>**a**</div><div>**b**</div>`, so we depth-match instead —
|
|
121217
|
+
* delegating to `walkTags` (htmlparser2) so quoted attributes (`title="</div>"`),
|
|
121218
|
+
* code spans, and legacy `<<VARIABLE>>` are handled for free. Returns -1 when
|
|
121219
|
+
* the wrapper is left open.
|
|
121220
|
+
*/
|
|
121221
|
+
function findBalancedClosingTagIndex(content, tag) {
|
|
121222
|
+
const target = tag.toLowerCase();
|
|
121223
|
+
const canonicalCloserLength = tag.length + 3; // `</tag>`
|
|
121224
|
+
// The caller already stripped the opening tag, so re-attach one: htmlparser2
|
|
121225
|
+
// drops an unmatched closer, and we want it balanced. Offsets shift by the
|
|
121226
|
+
// prefix length.
|
|
121227
|
+
const prefix = `<${tag}>`;
|
|
121228
|
+
let depth = 0;
|
|
121229
|
+
let closeIndex = -1;
|
|
121230
|
+
walkTags(prefix + content, {
|
|
121231
|
+
onOpen: ({ name, isSelfClosing, isStrayCloser }) => {
|
|
121232
|
+
if (closeIndex >= 0 || isSelfClosing || isStrayCloser)
|
|
121233
|
+
return;
|
|
121234
|
+
if (name.toLowerCase() === target)
|
|
121235
|
+
depth += 1;
|
|
121236
|
+
},
|
|
121237
|
+
onClose: ({ name, start, end, implicit }) => {
|
|
121238
|
+
if (closeIndex >= 0 || implicit || name.toLowerCase() !== target)
|
|
121239
|
+
return;
|
|
121240
|
+
// Only canonical `</tag>` closers — the caller slices by that length, so a
|
|
121241
|
+
// whitespaced `</tag >` would misalign; leaving it unmatched keeps it raw.
|
|
121242
|
+
if (end - start !== canonicalCloserLength)
|
|
121243
|
+
return;
|
|
121244
|
+
depth -= 1;
|
|
121245
|
+
if (depth === 0)
|
|
121246
|
+
closeIndex = start - prefix.length;
|
|
121247
|
+
},
|
|
121248
|
+
});
|
|
121249
|
+
return closeIndex;
|
|
121250
|
+
}
|
|
120859
121251
|
|
|
120860
121252
|
;// ./processor/transform/mdxish/components/inline-html.ts
|
|
120861
121253
|
|
|
@@ -121180,6 +121572,10 @@ const substituteNodeWithMdxNode = (parent, index, mdxNode) => {
|
|
|
121180
121572
|
* This transformer identifies these patterns and converts them to proper MDX JSX elements so they
|
|
121181
121573
|
* can be accurately recognized and rendered later with their component definition code.
|
|
121182
121574
|
*
|
|
121575
|
+
* Note: The main goal is to promote PascalCase tags to MDX elements, but we want to promote
|
|
121576
|
+
* normal HTML to MDX elements in some cases so they get the full custom parsing behavior.
|
|
121577
|
+
* E.g. tags with JSX expressions, nested components, etc.
|
|
121578
|
+
*
|
|
121183
121579
|
* The mdx-component micromark tokenizer ensures that multi-line components are captured
|
|
121184
121580
|
* as single HTML nodes, so this transformer only needs to handle two cases:
|
|
121185
121581
|
*
|
|
@@ -121226,6 +121622,7 @@ const mdx_blocks_mdxishMdxComponentBlocks = (opts = {}) => (tree, file) => {
|
|
|
121226
121622
|
if (GENERIC_MDX_COMPONENT_EXCLUDED_TAGS.has(tag))
|
|
121227
121623
|
return; // owned by dedicated transformers
|
|
121228
121624
|
const isPascal = isPascalCase(tag);
|
|
121625
|
+
// ==== SPECIAL CASES TO PROMOTE NORMAL HTML TO MDX ELEMENTS ====
|
|
121229
121626
|
// Lowercase inline tags with `{…}` attributes belong to
|
|
121230
121627
|
// mdxishInlineComponentBlocks; leave them as html for that pass. PascalCase
|
|
121231
121628
|
// components stay flow-level even when inline (ReadMe's component model).
|
|
@@ -121234,11 +121631,19 @@ const mdx_blocks_mdxishMdxComponentBlocks = (opts = {}) => (tree, file) => {
|
|
|
121234
121631
|
// A lowercase wrapper is only promoted when it (or a descendant) carries a
|
|
121235
121632
|
// JSX expression or nests a component; otherwise it would swallow that inner
|
|
121236
121633
|
// JSX/component as literal text that rehype-raw's parse5 pass can't handle.
|
|
121237
|
-
// Table-structural wrappers are excluded — `mdxishTables` re-parses
|
|
121238
|
-
|
|
121634
|
+
// Table-structural wrappers are excluded from both — `mdxishTables` re-parses
|
|
121635
|
+
// those, so a `{…}` in a cell (e.g. `<code>--depth={n}</code>`) must not
|
|
121636
|
+
// accidentally promote the table to an MDX element prematurely.
|
|
121239
121637
|
const isTableStructuralTag = tag === 'table' || tableTags.has(tag);
|
|
121638
|
+
const hasNestedExpressionAttr = !selfClosing && !isTableStructuralTag && NESTED_ATTR_EXPRESSION_RE.test(contentAfterTag);
|
|
121240
121639
|
const hasNestedComponentTag = !selfClosing && !isTableStructuralTag && hasNestedGenericComponentTag(contentAfterTag);
|
|
121241
|
-
|
|
121640
|
+
// Promotion: By default commonmark doesn't parse markdown in single line HTML tags (e.g. <div>**bold**</div>)
|
|
121641
|
+
// To support that, we try to promote them to MDX elements so the markdown gets parsed
|
|
121642
|
+
const isPlainLowercaseHtml = !isPascal && !hasExpressionAttr(attributes) && !hasNestedExpressionAttr && !hasNestedComponentTag;
|
|
121643
|
+
const plainClosingTagIndex = isPlainLowercaseHtml && !selfClosing && isMarkdownPromotableHtmlTag(tag) && !NESTED_TABLE_RE.test(contentAfterTag)
|
|
121644
|
+
? findBalancedClosingTagIndex(contentAfterTag, tag)
|
|
121645
|
+
: -1;
|
|
121646
|
+
if (isPlainLowercaseHtml && plainClosingTagIndex < 0)
|
|
121242
121647
|
return;
|
|
121243
121648
|
const closingTagStr = `</${tag}>`;
|
|
121244
121649
|
// Case 1: Self-closing tag
|
|
@@ -121259,14 +121664,26 @@ const mdx_blocks_mdxishMdxComponentBlocks = (opts = {}) => (tree, file) => {
|
|
|
121259
121664
|
return;
|
|
121260
121665
|
}
|
|
121261
121666
|
// Case 2: Self-contained block (closing tag in content)
|
|
121262
|
-
|
|
121263
|
-
|
|
121667
|
+
const closingTagIndex = isPlainLowercaseHtml ? plainClosingTagIndex : contentAfterTag.lastIndexOf(closingTagStr);
|
|
121668
|
+
if (closingTagIndex >= 0) {
|
|
121264
121669
|
// Untrimmed so parseMdChildren can dedent before trimming.
|
|
121265
121670
|
const componentInnerContent = contentAfterTag.substring(0, closingTagIndex);
|
|
121266
121671
|
const contentAfterClose = contentAfterTag.substring(closingTagIndex + closingTagStr.length).trim();
|
|
121267
|
-
let parsedChildren =
|
|
121268
|
-
|
|
121269
|
-
|
|
121672
|
+
let parsedChildren = [];
|
|
121673
|
+
if (componentInnerContent.trim()) {
|
|
121674
|
+
try {
|
|
121675
|
+
parsedChildren = parseMdChildren(componentInnerContent, safeMode);
|
|
121676
|
+
}
|
|
121677
|
+
catch (error) {
|
|
121678
|
+
// Plain HTML bodies can hold anything (e.g. stray braces the strict
|
|
121679
|
+
// expression parser rejects) — keep the node raw instead of throwing.
|
|
121680
|
+
if (isPlainLowercaseHtml)
|
|
121681
|
+
return;
|
|
121682
|
+
throw error;
|
|
121683
|
+
}
|
|
121684
|
+
}
|
|
121685
|
+
if (isPlainLowercaseHtml && !containsMarkdownConstruct(parsedChildren))
|
|
121686
|
+
return;
|
|
121270
121687
|
// Lowercase tags are usually inline; unwrap a sole paragraph so their
|
|
121271
121688
|
// phrasing content isn't spuriously block-wrapped.
|
|
121272
121689
|
if (!isPascal && parsedChildren.length === 1 && parsedChildren[0].type === 'paragraph') {
|
|
@@ -123467,21 +123884,21 @@ function resolveEntity(name) {
|
|
|
123467
123884
|
function tokenizeLooseHtmlEntity(effects, ok, nok) {
|
|
123468
123885
|
let length = 0;
|
|
123469
123886
|
const start = (code) => {
|
|
123470
|
-
if (code !==
|
|
123887
|
+
if (code !== codes.ampersand)
|
|
123471
123888
|
return nok(code);
|
|
123472
123889
|
effects.enter('looseHtmlEntity');
|
|
123473
123890
|
effects.consume(code);
|
|
123474
123891
|
return afterAmpersand;
|
|
123475
123892
|
};
|
|
123476
123893
|
const afterAmpersand = (code) => {
|
|
123477
|
-
if (code ===
|
|
123894
|
+
if (code === codes.numberSign) {
|
|
123478
123895
|
effects.consume(code);
|
|
123479
123896
|
return afterHash;
|
|
123480
123897
|
}
|
|
123481
123898
|
return accumulateNamed(code);
|
|
123482
123899
|
};
|
|
123483
123900
|
const afterHash = (code) => {
|
|
123484
|
-
if (code ===
|
|
123901
|
+
if (code === codes.lowercaseX || code === codes.uppercaseX) {
|
|
123485
123902
|
effects.consume(code);
|
|
123486
123903
|
return accumulateHex;
|
|
123487
123904
|
}
|
|
@@ -123495,7 +123912,7 @@ function tokenizeLooseHtmlEntity(effects, ok, nok) {
|
|
|
123495
123912
|
}
|
|
123496
123913
|
if (length === 0)
|
|
123497
123914
|
return nok(code);
|
|
123498
|
-
if (code ===
|
|
123915
|
+
if (code === codes.semicolon)
|
|
123499
123916
|
return nok(code);
|
|
123500
123917
|
effects.exit('looseHtmlEntity');
|
|
123501
123918
|
return ok(code);
|
|
@@ -123508,7 +123925,7 @@ function tokenizeLooseHtmlEntity(effects, ok, nok) {
|
|
|
123508
123925
|
}
|
|
123509
123926
|
if (length === 0)
|
|
123510
123927
|
return nok(code);
|
|
123511
|
-
if (code ===
|
|
123928
|
+
if (code === codes.semicolon)
|
|
123512
123929
|
return nok(code);
|
|
123513
123930
|
effects.exit('looseHtmlEntity');
|
|
123514
123931
|
return ok(code);
|
|
@@ -123521,7 +123938,7 @@ function tokenizeLooseHtmlEntity(effects, ok, nok) {
|
|
|
123521
123938
|
}
|
|
123522
123939
|
if (length === 0)
|
|
123523
123940
|
return nok(code);
|
|
123524
|
-
if (code ===
|
|
123941
|
+
if (code === codes.semicolon)
|
|
123525
123942
|
return nok(code);
|
|
123526
123943
|
effects.exit('looseHtmlEntity');
|
|
123527
123944
|
return ok(code);
|
|
@@ -123556,7 +123973,7 @@ function exitLooseHtmlEntity(token) {
|
|
|
123556
123973
|
}
|
|
123557
123974
|
function looseHtmlEntity() {
|
|
123558
123975
|
return {
|
|
123559
|
-
text: { [
|
|
123976
|
+
text: { [codes.ampersand]: looseHtmlEntityConstruct },
|
|
123560
123977
|
};
|
|
123561
123978
|
}
|
|
123562
123979
|
function looseHtmlEntityFromMarkdown() {
|
|
@@ -124249,9 +124666,6 @@ const magicBlockTransformer = (options = {}) => tree => {
|
|
|
124249
124666
|
// single-line `<div>…</div>`). CommonMark slurps the whole div as one `html`
|
|
124250
124667
|
// node, so the tokenizer never sees the HTMLBlock — we recover it here.
|
|
124251
124668
|
const RAW_HTML_BLOCK_RE = /<HTMLBlock\b([^>]*)>\s*\{\s*`((?:[^`\\]|\\.)*)`\s*\}\s*<\/HTMLBlock>/g;
|
|
124252
|
-
// Opening `<HTMLBlock …>` as its own `html` node — produced inside a paragraph
|
|
124253
|
-
// when an HTMLBlock appears inline alongside text.
|
|
124254
|
-
const HTML_BLOCK_OPEN_RE = /^<HTMLBlock\b([^>]*)>$/;
|
|
124255
124669
|
/**
|
|
124256
124670
|
* Builds the canonical `html-block` MDAST node the renderer expects.
|
|
124257
124671
|
*/
|
|
@@ -124332,13 +124746,14 @@ const splitRawHtmlBlocks = (node) => {
|
|
|
124332
124746
|
/**
|
|
124333
124747
|
* Converts every `<HTMLBlock>` shape that survives parsing into the canonical
|
|
124334
124748
|
* `html-block` MDAST node, reading the body from the tokenizer's template-literal
|
|
124335
|
-
* expression.
|
|
124749
|
+
* expression. Two shapes occur:
|
|
124336
124750
|
*
|
|
124337
|
-
* 1. JSX element (`mdxJsxFlowElement`/`mdxJsxTextElement`) —
|
|
124338
|
-
*
|
|
124339
|
-
*
|
|
124340
|
-
*
|
|
124341
|
-
*
|
|
124751
|
+
* 1. JSX element (`mdxJsxFlowElement`/`mdxJsxTextElement`) — table cells, after
|
|
124752
|
+
* their remarkMdx re-parse (that re-parse runs without the htmlBlockComponent
|
|
124753
|
+
* tokenizer, so `<HTMLBlock>` arrives as JSX rather than an opaque `html` node).
|
|
124754
|
+
* 2. Raw `html` blob (`splitRawHtmlBlocks`) — the htmlBlockComponent tokenizer's
|
|
124755
|
+
* opaque output (top-level and inline), or an `<HTMLBlock>` embedded in a
|
|
124756
|
+
* larger raw-HTML node like an inline `<div>` that the tokenizer never saw.
|
|
124342
124757
|
*
|
|
124343
124758
|
* Runs *after* `mdxishTables` so table cells are re-parsed first;
|
|
124344
124759
|
* `mdxishTables` recognizes the still-JSX `<HTMLBlock>` element when deciding to
|
|
@@ -124363,36 +124778,6 @@ const mdxishHtmlBlocks = () => tree => {
|
|
|
124363
124778
|
if (replacement)
|
|
124364
124779
|
parent.children.splice(index, 1, ...replacement);
|
|
124365
124780
|
});
|
|
124366
|
-
// Shape 3: inline within a paragraph — `<HTMLBlock>` open/close arrive as
|
|
124367
|
-
// separate `html` siblings with the template-literal expression between them.
|
|
124368
|
-
lib_visit(tree, 'paragraph', (paragraph) => {
|
|
124369
|
-
// An html-block is block content, so it isn't a valid PhrasingContent child;
|
|
124370
|
-
// widen to RootContent (which HTMLBlock belongs to) for the in-place splice.
|
|
124371
|
-
const children = paragraph.children;
|
|
124372
|
-
for (let i = 0; i < children.length; i += 1) {
|
|
124373
|
-
const open = children[i];
|
|
124374
|
-
const openMatch = open.type === 'html' ? open.value.match(HTML_BLOCK_OPEN_RE) : null;
|
|
124375
|
-
if (!openMatch)
|
|
124376
|
-
continue; // eslint-disable-line no-continue
|
|
124377
|
-
const closeIdx = children.findIndex((child, j) => j > i && child.type === 'html' && child.value === '</HTMLBlock>');
|
|
124378
|
-
if (closeIdx === -1)
|
|
124379
|
-
continue; // eslint-disable-line no-continue
|
|
124380
|
-
const body = children
|
|
124381
|
-
.slice(i + 1, closeIdx)
|
|
124382
|
-
.map(child => {
|
|
124383
|
-
if (child.type === 'mdxTextExpression' || child.type === 'mdxFlowExpression') {
|
|
124384
|
-
return extractTemplateLiteral(child.value);
|
|
124385
|
-
}
|
|
124386
|
-
// Preserve raw text from any other phrasing sibling (e.g. stray
|
|
124387
|
-
// whitespace or content the tokenizer didn't claim) so it isn't
|
|
124388
|
-
// silently dropped from the html payload.
|
|
124389
|
-
return 'value' in child && typeof child.value === 'string' ? child.value : '';
|
|
124390
|
-
})
|
|
124391
|
-
.join('');
|
|
124392
|
-
const openingTagIndent = (open.position?.start.column ?? 1) - 1;
|
|
124393
|
-
children.splice(i, closeIdx - i + 1, htmlBlockFromRaw(openMatch[1], body, open.position, openingTagIndent));
|
|
124394
|
-
}
|
|
124395
|
-
});
|
|
124396
124781
|
};
|
|
124397
124782
|
/* harmony default export */ const mdxish_html_blocks = (mdxishHtmlBlocks);
|
|
124398
124783
|
|
|
@@ -125092,6 +125477,29 @@ const mdxishMermaidTransformer = () => (tree) => {
|
|
|
125092
125477
|
};
|
|
125093
125478
|
/* harmony default export */ const mdxish_mermaid = (mdxishMermaidTransformer);
|
|
125094
125479
|
|
|
125480
|
+
;// ./processor/transform/mdxish/normalize-closing-tag-whitespace.ts
|
|
125481
|
+
|
|
125482
|
+
|
|
125483
|
+
// Spaces/tabs only — newlines would let prose `<` / `>` across lines look like one tag.
|
|
125484
|
+
const SPACED_CLOSING_TAG_RE = /<\/[ \t]*([a-zA-Z][a-zA-Z0-9-]*)[ \t]*>/g;
|
|
125485
|
+
/**
|
|
125486
|
+
* Canonicalize spaced closing tags (`</ td >` → `</td>`) for known HTML names.
|
|
125487
|
+
*
|
|
125488
|
+
* In HTML, `</` + whitespace is a bogus comment, so `</ table >` never closes the
|
|
125489
|
+
* table (jsxTable misses it → empty table + pre; CX-3706). Only standard HTML tags;
|
|
125490
|
+
* custom components, prose (`a </ b`), and code blocks are left alone.
|
|
125491
|
+
*
|
|
125492
|
+
* @example
|
|
125493
|
+
* normalizeClosingTagWhitespace('</ td >') // '</td>'
|
|
125494
|
+
* normalizeClosingTagWhitespace('</table >') // '</table>'
|
|
125495
|
+
* normalizeClosingTagWhitespace('a </ b >') // unchanged
|
|
125496
|
+
*/
|
|
125497
|
+
function normalizeClosingTagWhitespace(content) {
|
|
125498
|
+
const { protectedContent, protectedCode } = protectCodeBlocks(content);
|
|
125499
|
+
const result = protectedContent.replace(SPACED_CLOSING_TAG_RE, (match, tagName) => STANDARD_HTML_TAGS.has(tagName.toLowerCase()) ? `</${tagName}>` : match);
|
|
125500
|
+
return restoreCodeBlocks(result, protectedCode);
|
|
125501
|
+
}
|
|
125502
|
+
|
|
125095
125503
|
;// ./processor/transform/mdxish/normalize-compact-headings.ts
|
|
125096
125504
|
|
|
125097
125505
|
/**
|
|
@@ -125703,25 +126111,25 @@ const variablesTextTransformer = () => tree => {
|
|
|
125703
126111
|
};
|
|
125704
126112
|
/* harmony default export */ const variables_text = (variablesTextTransformer);
|
|
125705
126113
|
|
|
125706
|
-
;// ./lib/mdast-util/
|
|
125707
|
-
const
|
|
125708
|
-
function
|
|
126114
|
+
;// ./lib/mdast-util/html-block-component/index.ts
|
|
126115
|
+
const html_block_component_contextMap = new WeakMap();
|
|
126116
|
+
function findHtmlBlockComponentToken() {
|
|
125709
126117
|
const events = this.tokenStack;
|
|
125710
126118
|
for (let i = events.length - 1; i >= 0; i -= 1) {
|
|
125711
|
-
if (events[i][0].type === '
|
|
126119
|
+
if (events[i][0].type === 'htmlBlockComponent')
|
|
125712
126120
|
return events[i][0];
|
|
125713
126121
|
}
|
|
125714
126122
|
return undefined;
|
|
125715
126123
|
}
|
|
125716
|
-
function
|
|
125717
|
-
|
|
126124
|
+
function enterHtmlBlockComponent(token) {
|
|
126125
|
+
html_block_component_contextMap.set(token, { chunks: [], lastEndLine: token.start.line });
|
|
125718
126126
|
this.enter({ type: 'html', value: '' }, token);
|
|
125719
126127
|
}
|
|
125720
|
-
function
|
|
125721
|
-
const
|
|
125722
|
-
if (!
|
|
126128
|
+
function exitHtmlBlockComponentData(token) {
|
|
126129
|
+
const componentToken = findHtmlBlockComponentToken.call(this);
|
|
126130
|
+
if (!componentToken)
|
|
125723
126131
|
return;
|
|
125724
|
-
const ctx =
|
|
126132
|
+
const ctx = html_block_component_contextMap.get(componentToken);
|
|
125725
126133
|
if (ctx) {
|
|
125726
126134
|
const gap = token.start.line - ctx.lastEndLine;
|
|
125727
126135
|
if (ctx.chunks.length > 0 && gap > 0) {
|
|
@@ -125731,27 +126139,304 @@ function exitJsxTableData(token) {
|
|
|
125731
126139
|
ctx.lastEndLine = token.end.line;
|
|
125732
126140
|
}
|
|
125733
126141
|
}
|
|
125734
|
-
function
|
|
125735
|
-
const ctx =
|
|
126142
|
+
function exitHtmlBlockComponent(token) {
|
|
126143
|
+
const ctx = html_block_component_contextMap.get(token);
|
|
125736
126144
|
const node = this.stack[this.stack.length - 1];
|
|
125737
126145
|
if (ctx) {
|
|
125738
126146
|
node.value = ctx.chunks.join('');
|
|
125739
|
-
|
|
126147
|
+
html_block_component_contextMap.delete(token);
|
|
125740
126148
|
}
|
|
125741
126149
|
this.exit(token);
|
|
125742
126150
|
}
|
|
125743
|
-
function
|
|
126151
|
+
function html_block_component_htmlBlockComponentFromMarkdown() {
|
|
125744
126152
|
return {
|
|
125745
126153
|
enter: {
|
|
125746
|
-
|
|
126154
|
+
htmlBlockComponent: enterHtmlBlockComponent,
|
|
125747
126155
|
},
|
|
125748
126156
|
exit: {
|
|
125749
|
-
|
|
125750
|
-
|
|
126157
|
+
htmlBlockComponentData: exitHtmlBlockComponentData,
|
|
126158
|
+
htmlBlockComponent: exitHtmlBlockComponent,
|
|
125751
126159
|
},
|
|
125752
126160
|
};
|
|
125753
126161
|
}
|
|
125754
126162
|
|
|
126163
|
+
;// ./lib/micromark/html-block-component/syntax.ts
|
|
126164
|
+
|
|
126165
|
+
|
|
126166
|
+
const TAG_SUFFIX = [
|
|
126167
|
+
codes.uppercaseT,
|
|
126168
|
+
codes.uppercaseM,
|
|
126169
|
+
codes.uppercaseL,
|
|
126170
|
+
codes.uppercaseB,
|
|
126171
|
+
codes.lowercaseL,
|
|
126172
|
+
codes.lowercaseO,
|
|
126173
|
+
codes.lowercaseC,
|
|
126174
|
+
codes.lowercaseK,
|
|
126175
|
+
];
|
|
126176
|
+
// ---------------------------------------------------------------------------
|
|
126177
|
+
// Shared tokenizer factory
|
|
126178
|
+
// ---------------------------------------------------------------------------
|
|
126179
|
+
/**
|
|
126180
|
+
* Creates a tokenize function for `<HTMLBlock>...</HTMLBlock>`.
|
|
126181
|
+
*
|
|
126182
|
+
* - **flow** (block-level): supports multiline content via line continuations,
|
|
126183
|
+
* consumes trailing whitespace after the closing tag.
|
|
126184
|
+
* - **text** (inline): single-line only, exits immediately after the closing tag.
|
|
126185
|
+
*/
|
|
126186
|
+
function syntax_createTokenize(mode) {
|
|
126187
|
+
return function tokenize(effects, ok, nok) {
|
|
126188
|
+
let depth = 1;
|
|
126189
|
+
function matchChars(chars, onMatch, onFail) {
|
|
126190
|
+
if (chars.length === 0)
|
|
126191
|
+
return onMatch;
|
|
126192
|
+
const next = (code) => {
|
|
126193
|
+
if (code === chars[0]) {
|
|
126194
|
+
effects.consume(code);
|
|
126195
|
+
return matchChars(chars.slice(1), onMatch, onFail);
|
|
126196
|
+
}
|
|
126197
|
+
return onFail(code);
|
|
126198
|
+
};
|
|
126199
|
+
return next;
|
|
126200
|
+
}
|
|
126201
|
+
function matchTagName(onMatch, onFail) {
|
|
126202
|
+
const next = (code) => {
|
|
126203
|
+
if (code === codes.uppercaseH) {
|
|
126204
|
+
effects.consume(code);
|
|
126205
|
+
return matchChars(TAG_SUFFIX, onMatch, onFail);
|
|
126206
|
+
}
|
|
126207
|
+
return onFail(code);
|
|
126208
|
+
};
|
|
126209
|
+
return next;
|
|
126210
|
+
}
|
|
126211
|
+
return start;
|
|
126212
|
+
function start(code) {
|
|
126213
|
+
if (code !== codes.lessThan)
|
|
126214
|
+
return nok(code);
|
|
126215
|
+
effects.enter('htmlBlockComponent');
|
|
126216
|
+
effects.enter('htmlBlockComponentData');
|
|
126217
|
+
effects.consume(code);
|
|
126218
|
+
return matchTagName(afterTagName, nok);
|
|
126219
|
+
}
|
|
126220
|
+
function afterTagName(code) {
|
|
126221
|
+
if (code === codes.greaterThan) {
|
|
126222
|
+
effects.consume(code);
|
|
126223
|
+
return body;
|
|
126224
|
+
}
|
|
126225
|
+
if (code === codes.space || code === codes.horizontalTab) {
|
|
126226
|
+
effects.consume(code);
|
|
126227
|
+
return inAttributes;
|
|
126228
|
+
}
|
|
126229
|
+
if (mode === 'flow' && markdownLineEnding(code)) {
|
|
126230
|
+
effects.exit('htmlBlockComponentData');
|
|
126231
|
+
return attributeContinuationStart(code);
|
|
126232
|
+
}
|
|
126233
|
+
if (code === codes.slash) {
|
|
126234
|
+
effects.consume(code);
|
|
126235
|
+
return selfClose;
|
|
126236
|
+
}
|
|
126237
|
+
return nok(code);
|
|
126238
|
+
}
|
|
126239
|
+
function inAttributes(code) {
|
|
126240
|
+
if (code === codes.greaterThan) {
|
|
126241
|
+
effects.consume(code);
|
|
126242
|
+
return body;
|
|
126243
|
+
}
|
|
126244
|
+
if (code === null) {
|
|
126245
|
+
return nok(code);
|
|
126246
|
+
}
|
|
126247
|
+
if (markdownLineEnding(code)) {
|
|
126248
|
+
if (mode === 'text')
|
|
126249
|
+
return nok(code);
|
|
126250
|
+
effects.exit('htmlBlockComponentData');
|
|
126251
|
+
return attributeContinuationStart(code);
|
|
126252
|
+
}
|
|
126253
|
+
effects.consume(code);
|
|
126254
|
+
return inAttributes;
|
|
126255
|
+
}
|
|
126256
|
+
function attributeContinuationStart(code) {
|
|
126257
|
+
return effects.check(html_block_component_syntax_nonLazyContinuationStart, attributeContinuationNonLazy, continuationAfter)(code);
|
|
126258
|
+
}
|
|
126259
|
+
function attributeContinuationNonLazy(code) {
|
|
126260
|
+
effects.enter(types_types.lineEnding);
|
|
126261
|
+
effects.consume(code);
|
|
126262
|
+
effects.exit(types_types.lineEnding);
|
|
126263
|
+
return attributeContinuationBefore;
|
|
126264
|
+
}
|
|
126265
|
+
function attributeContinuationBefore(code) {
|
|
126266
|
+
if (code === null || markdownLineEnding(code)) {
|
|
126267
|
+
return attributeContinuationStart(code);
|
|
126268
|
+
}
|
|
126269
|
+
effects.enter('htmlBlockComponentData');
|
|
126270
|
+
return inAttributes(code);
|
|
126271
|
+
}
|
|
126272
|
+
function selfClose(code) {
|
|
126273
|
+
if (code === codes.greaterThan) {
|
|
126274
|
+
effects.consume(code);
|
|
126275
|
+
return mode === 'flow' ? afterClose : done(code);
|
|
126276
|
+
}
|
|
126277
|
+
return nok(code);
|
|
126278
|
+
}
|
|
126279
|
+
function body(code) {
|
|
126280
|
+
if (code === null)
|
|
126281
|
+
return nok(code);
|
|
126282
|
+
if (markdownLineEnding(code)) {
|
|
126283
|
+
if (mode === 'text') {
|
|
126284
|
+
// Text constructs operate on paragraph content which spans lines
|
|
126285
|
+
effects.consume(code);
|
|
126286
|
+
return body;
|
|
126287
|
+
}
|
|
126288
|
+
effects.exit('htmlBlockComponentData');
|
|
126289
|
+
return continuationStart(code);
|
|
126290
|
+
}
|
|
126291
|
+
if (code === codes.lessThan) {
|
|
126292
|
+
effects.consume(code);
|
|
126293
|
+
return closeSlash;
|
|
126294
|
+
}
|
|
126295
|
+
effects.consume(code);
|
|
126296
|
+
return body;
|
|
126297
|
+
}
|
|
126298
|
+
function closeSlash(code) {
|
|
126299
|
+
if (code === codes.slash) {
|
|
126300
|
+
effects.consume(code);
|
|
126301
|
+
return matchTagName(closeGt, body);
|
|
126302
|
+
}
|
|
126303
|
+
return matchTagName(openAfterTagName, body)(code);
|
|
126304
|
+
}
|
|
126305
|
+
function openAfterTagName(code) {
|
|
126306
|
+
if (code === codes.greaterThan || code === codes.space || code === codes.horizontalTab) {
|
|
126307
|
+
depth += 1;
|
|
126308
|
+
effects.consume(code);
|
|
126309
|
+
return body;
|
|
126310
|
+
}
|
|
126311
|
+
return body(code);
|
|
126312
|
+
}
|
|
126313
|
+
function closeGt(code) {
|
|
126314
|
+
if (code === codes.greaterThan) {
|
|
126315
|
+
depth -= 1;
|
|
126316
|
+
effects.consume(code);
|
|
126317
|
+
if (depth === 0) {
|
|
126318
|
+
return mode === 'flow' ? afterClose : done(code);
|
|
126319
|
+
}
|
|
126320
|
+
return body;
|
|
126321
|
+
}
|
|
126322
|
+
return body(code);
|
|
126323
|
+
}
|
|
126324
|
+
// -- flow-only states ---------------------------------------------------
|
|
126325
|
+
function afterClose(code) {
|
|
126326
|
+
if (code === null || markdownLineEnding(code)) {
|
|
126327
|
+
return done(code);
|
|
126328
|
+
}
|
|
126329
|
+
if (code === codes.space || code === codes.horizontalTab) {
|
|
126330
|
+
effects.consume(code);
|
|
126331
|
+
return afterClose;
|
|
126332
|
+
}
|
|
126333
|
+
// Reject so the block re-parses as a paragraph, deferring to the
|
|
126334
|
+
// text tokenizer which preserves trailing content in the same line.
|
|
126335
|
+
return nok(code);
|
|
126336
|
+
}
|
|
126337
|
+
// -- flow-only: line continuation ---------------------------------------
|
|
126338
|
+
function continuationStart(code) {
|
|
126339
|
+
return effects.check(html_block_component_syntax_nonLazyContinuationStart, continuationStartNonLazy, continuationAfter)(code);
|
|
126340
|
+
}
|
|
126341
|
+
function continuationStartNonLazy(code) {
|
|
126342
|
+
effects.enter(types_types.lineEnding);
|
|
126343
|
+
effects.consume(code);
|
|
126344
|
+
effects.exit(types_types.lineEnding);
|
|
126345
|
+
return continuationBefore;
|
|
126346
|
+
}
|
|
126347
|
+
function continuationBefore(code) {
|
|
126348
|
+
if (code === null || markdownLineEnding(code)) {
|
|
126349
|
+
return continuationStart(code);
|
|
126350
|
+
}
|
|
126351
|
+
effects.enter('htmlBlockComponentData');
|
|
126352
|
+
return body(code);
|
|
126353
|
+
}
|
|
126354
|
+
function continuationAfter(code) {
|
|
126355
|
+
if (code === null)
|
|
126356
|
+
return nok(code);
|
|
126357
|
+
effects.exit('htmlBlockComponent');
|
|
126358
|
+
return ok(code);
|
|
126359
|
+
}
|
|
126360
|
+
// -- shared exit --------------------------------------------------------
|
|
126361
|
+
function done(_code) {
|
|
126362
|
+
effects.exit('htmlBlockComponentData');
|
|
126363
|
+
effects.exit('htmlBlockComponent');
|
|
126364
|
+
return ok(_code);
|
|
126365
|
+
}
|
|
126366
|
+
};
|
|
126367
|
+
}
|
|
126368
|
+
// ---------------------------------------------------------------------------
|
|
126369
|
+
// Flow construct (block-level)
|
|
126370
|
+
// ---------------------------------------------------------------------------
|
|
126371
|
+
const html_block_component_syntax_nonLazyContinuationStart = {
|
|
126372
|
+
tokenize: html_block_component_syntax_tokenizeNonLazyContinuationStart,
|
|
126373
|
+
partial: true,
|
|
126374
|
+
};
|
|
126375
|
+
function resolveToHtmlBlockComponent(events) {
|
|
126376
|
+
let index = events.length;
|
|
126377
|
+
while (index > 0) {
|
|
126378
|
+
index -= 1;
|
|
126379
|
+
if (events[index][0] === 'enter' && events[index][1].type === 'htmlBlockComponent') {
|
|
126380
|
+
break;
|
|
126381
|
+
}
|
|
126382
|
+
}
|
|
126383
|
+
if (index > 1 && events[index - 2][1].type === types_types.linePrefix) {
|
|
126384
|
+
events[index][1].start = events[index - 2][1].start;
|
|
126385
|
+
events[index + 1][1].start = events[index - 2][1].start;
|
|
126386
|
+
events.splice(index - 2, 2);
|
|
126387
|
+
}
|
|
126388
|
+
return events;
|
|
126389
|
+
}
|
|
126390
|
+
const htmlBlockComponentFlowConstruct = {
|
|
126391
|
+
name: 'htmlBlockComponent',
|
|
126392
|
+
tokenize: syntax_createTokenize('flow'),
|
|
126393
|
+
resolveTo: resolveToHtmlBlockComponent,
|
|
126394
|
+
concrete: true,
|
|
126395
|
+
};
|
|
126396
|
+
function html_block_component_syntax_tokenizeNonLazyContinuationStart(effects, ok, nok) {
|
|
126397
|
+
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
126398
|
+
const self = this;
|
|
126399
|
+
return start;
|
|
126400
|
+
function start(code) {
|
|
126401
|
+
if (markdownLineEnding(code)) {
|
|
126402
|
+
effects.enter(types_types.lineEnding);
|
|
126403
|
+
effects.consume(code);
|
|
126404
|
+
effects.exit(types_types.lineEnding);
|
|
126405
|
+
return after;
|
|
126406
|
+
}
|
|
126407
|
+
return nok(code);
|
|
126408
|
+
}
|
|
126409
|
+
function after(code) {
|
|
126410
|
+
if (self.parser.lazy[self.now().line]) {
|
|
126411
|
+
return nok(code);
|
|
126412
|
+
}
|
|
126413
|
+
return ok(code);
|
|
126414
|
+
}
|
|
126415
|
+
}
|
|
126416
|
+
// ---------------------------------------------------------------------------
|
|
126417
|
+
// Text construct (inline)
|
|
126418
|
+
// ---------------------------------------------------------------------------
|
|
126419
|
+
const htmlBlockComponentTextConstruct = {
|
|
126420
|
+
name: 'htmlBlockComponent',
|
|
126421
|
+
tokenize: syntax_createTokenize('text'),
|
|
126422
|
+
};
|
|
126423
|
+
// ---------------------------------------------------------------------------
|
|
126424
|
+
// Extension
|
|
126425
|
+
// ---------------------------------------------------------------------------
|
|
126426
|
+
function syntax_htmlBlockComponent() {
|
|
126427
|
+
return {
|
|
126428
|
+
flow: {
|
|
126429
|
+
[codes.lessThan]: [htmlBlockComponentFlowConstruct],
|
|
126430
|
+
},
|
|
126431
|
+
text: {
|
|
126432
|
+
[codes.lessThan]: [htmlBlockComponentTextConstruct],
|
|
126433
|
+
},
|
|
126434
|
+
};
|
|
126435
|
+
}
|
|
126436
|
+
|
|
126437
|
+
;// ./lib/micromark/html-block-component/index.ts
|
|
126438
|
+
|
|
126439
|
+
|
|
125755
126440
|
;// ./lib/micromark/jsx-comment/syntax.ts
|
|
125756
126441
|
|
|
125757
126442
|
|
|
@@ -125773,7 +126458,7 @@ function jsx_table_jsxTableFromMarkdown() {
|
|
|
125773
126458
|
function tokenizeJsxComment(effects, ok, nok) {
|
|
125774
126459
|
return start;
|
|
125775
126460
|
function start(code) {
|
|
125776
|
-
if (code !==
|
|
126461
|
+
if (code !== codes.leftCurlyBrace)
|
|
125777
126462
|
return nok(code);
|
|
125778
126463
|
effects.enter('mdxFlowExpression');
|
|
125779
126464
|
effects.enter('mdxFlowExpressionMarker');
|
|
@@ -125782,7 +126467,7 @@ function tokenizeJsxComment(effects, ok, nok) {
|
|
|
125782
126467
|
return expectSlash;
|
|
125783
126468
|
}
|
|
125784
126469
|
function expectSlash(code) {
|
|
125785
|
-
if (code !==
|
|
126470
|
+
if (code !== codes.slash) {
|
|
125786
126471
|
effects.exit('mdxFlowExpression');
|
|
125787
126472
|
return nok(code);
|
|
125788
126473
|
}
|
|
@@ -125791,7 +126476,7 @@ function tokenizeJsxComment(effects, ok, nok) {
|
|
|
125791
126476
|
return expectStar;
|
|
125792
126477
|
}
|
|
125793
126478
|
function expectStar(code) {
|
|
125794
|
-
if (code !==
|
|
126479
|
+
if (code !== codes.asterisk) {
|
|
125795
126480
|
effects.exit('mdxFlowExpressionChunk');
|
|
125796
126481
|
effects.exit('mdxFlowExpression');
|
|
125797
126482
|
return nok(code);
|
|
@@ -125818,7 +126503,7 @@ function tokenizeJsxComment(effects, ok, nok) {
|
|
|
125818
126503
|
effects.exit('mdxFlowExpressionChunk');
|
|
125819
126504
|
return before(code);
|
|
125820
126505
|
}
|
|
125821
|
-
if (code ===
|
|
126506
|
+
if (code === codes.asterisk) {
|
|
125822
126507
|
effects.consume(code);
|
|
125823
126508
|
return maybeClosed;
|
|
125824
126509
|
}
|
|
@@ -125830,11 +126515,11 @@ function tokenizeJsxComment(effects, ok, nok) {
|
|
|
125830
126515
|
effects.exit('mdxFlowExpressionChunk');
|
|
125831
126516
|
return before(code);
|
|
125832
126517
|
}
|
|
125833
|
-
if (code ===
|
|
126518
|
+
if (code === codes.slash) {
|
|
125834
126519
|
effects.consume(code);
|
|
125835
126520
|
return expectClosingBrace;
|
|
125836
126521
|
}
|
|
125837
|
-
if (code ===
|
|
126522
|
+
if (code === codes.asterisk) {
|
|
125838
126523
|
effects.consume(code);
|
|
125839
126524
|
return maybeClosed;
|
|
125840
126525
|
}
|
|
@@ -125846,7 +126531,7 @@ function tokenizeJsxComment(effects, ok, nok) {
|
|
|
125846
126531
|
effects.exit('mdxFlowExpressionChunk');
|
|
125847
126532
|
return before(code);
|
|
125848
126533
|
}
|
|
125849
|
-
if (code ===
|
|
126534
|
+
if (code === codes.rightCurlyBrace) {
|
|
125850
126535
|
effects.exit('mdxFlowExpressionChunk');
|
|
125851
126536
|
effects.enter('mdxFlowExpressionMarker');
|
|
125852
126537
|
effects.consume(code);
|
|
@@ -125854,7 +126539,7 @@ function tokenizeJsxComment(effects, ok, nok) {
|
|
|
125854
126539
|
effects.exit('mdxFlowExpression');
|
|
125855
126540
|
return ok;
|
|
125856
126541
|
}
|
|
125857
|
-
if (code ===
|
|
126542
|
+
if (code === codes.asterisk) {
|
|
125858
126543
|
effects.consume(code);
|
|
125859
126544
|
return maybeClosed;
|
|
125860
126545
|
}
|
|
@@ -125865,7 +126550,7 @@ function tokenizeJsxComment(effects, ok, nok) {
|
|
|
125865
126550
|
function jsxComment() {
|
|
125866
126551
|
return {
|
|
125867
126552
|
flow: {
|
|
125868
|
-
[
|
|
126553
|
+
[codes.leftCurlyBrace]: {
|
|
125869
126554
|
name: 'jsxComment',
|
|
125870
126555
|
concrete: true,
|
|
125871
126556
|
tokenize: tokenizeJsxComment,
|
|
@@ -125874,243 +126559,6 @@ function jsxComment() {
|
|
|
125874
126559
|
};
|
|
125875
126560
|
}
|
|
125876
126561
|
|
|
125877
|
-
;// ./lib/micromark/jsx-table/syntax.ts
|
|
125878
|
-
|
|
125879
|
-
|
|
125880
|
-
const jsx_table_syntax_nonLazyContinuationStart = {
|
|
125881
|
-
tokenize: jsx_table_syntax_tokenizeNonLazyContinuationStart,
|
|
125882
|
-
partial: true,
|
|
125883
|
-
};
|
|
125884
|
-
function resolveToJsxTable(events) {
|
|
125885
|
-
let index = events.length;
|
|
125886
|
-
while (index > 0) {
|
|
125887
|
-
index -= 1;
|
|
125888
|
-
if (events[index][0] === 'enter' && events[index][1].type === 'jsxTable') {
|
|
125889
|
-
break;
|
|
125890
|
-
}
|
|
125891
|
-
}
|
|
125892
|
-
if (index > 1 && events[index - 2][1].type === types_types.linePrefix) {
|
|
125893
|
-
events[index][1].start = events[index - 2][1].start;
|
|
125894
|
-
events[index + 1][1].start = events[index - 2][1].start;
|
|
125895
|
-
events.splice(index - 2, 2);
|
|
125896
|
-
}
|
|
125897
|
-
return events;
|
|
125898
|
-
}
|
|
125899
|
-
const jsxTableConstruct = {
|
|
125900
|
-
name: 'jsxTable',
|
|
125901
|
-
tokenize: tokenizeJsxTable,
|
|
125902
|
-
resolveTo: resolveToJsxTable,
|
|
125903
|
-
concrete: true,
|
|
125904
|
-
};
|
|
125905
|
-
function tokenizeJsxTable(effects, ok, nok) {
|
|
125906
|
-
let codeSpanOpenSize = 0;
|
|
125907
|
-
let codeSpanCloseSize = 0;
|
|
125908
|
-
let depth = 1;
|
|
125909
|
-
const ABLE_SUFFIX = [codes_codes.lowercaseA, codes_codes.lowercaseB, codes_codes.lowercaseL, codes_codes.lowercaseE];
|
|
125910
|
-
/** Build a state chain that matches a sequence of character codes. */
|
|
125911
|
-
function matchChars(chars, onMatch, onFail) {
|
|
125912
|
-
if (chars.length === 0)
|
|
125913
|
-
return onMatch;
|
|
125914
|
-
return ((code) => {
|
|
125915
|
-
if (code === chars[0]) {
|
|
125916
|
-
effects.consume(code);
|
|
125917
|
-
return matchChars(chars.slice(1), onMatch, onFail);
|
|
125918
|
-
}
|
|
125919
|
-
return onFail(code);
|
|
125920
|
-
});
|
|
125921
|
-
}
|
|
125922
|
-
return start;
|
|
125923
|
-
function start(code) {
|
|
125924
|
-
if (code !== codes_codes.lessThan)
|
|
125925
|
-
return nok(code);
|
|
125926
|
-
effects.enter('jsxTable');
|
|
125927
|
-
effects.enter('jsxTableData');
|
|
125928
|
-
effects.consume(code);
|
|
125929
|
-
return afterLessThan;
|
|
125930
|
-
}
|
|
125931
|
-
function afterLessThan(code) {
|
|
125932
|
-
if (code === codes_codes.uppercaseT || code === codes_codes.lowercaseT) {
|
|
125933
|
-
effects.consume(code);
|
|
125934
|
-
return matchChars(ABLE_SUFFIX, afterTagName, nok);
|
|
125935
|
-
}
|
|
125936
|
-
return nok(code);
|
|
125937
|
-
}
|
|
125938
|
-
function afterTagName(code) {
|
|
125939
|
-
if (code === codes_codes.greaterThan || code === codes_codes.slash || code === codes_codes.space || code === codes_codes.horizontalTab) {
|
|
125940
|
-
effects.consume(code);
|
|
125941
|
-
return body;
|
|
125942
|
-
}
|
|
125943
|
-
return nok(code);
|
|
125944
|
-
}
|
|
125945
|
-
function body(code) {
|
|
125946
|
-
// Reject unclosed <Table> so it falls back to normal HTML block parsing
|
|
125947
|
-
// instead of swallowing all subsequent content to EOF
|
|
125948
|
-
if (code === null) {
|
|
125949
|
-
return nok(code);
|
|
125950
|
-
}
|
|
125951
|
-
if (markdownLineEnding(code)) {
|
|
125952
|
-
effects.exit('jsxTableData');
|
|
125953
|
-
return continuationStart(code);
|
|
125954
|
-
}
|
|
125955
|
-
if (code === codes_codes.backslash) {
|
|
125956
|
-
effects.consume(code);
|
|
125957
|
-
return escapedChar;
|
|
125958
|
-
}
|
|
125959
|
-
if (code === codes_codes.lessThan) {
|
|
125960
|
-
effects.consume(code);
|
|
125961
|
-
return closeSlash;
|
|
125962
|
-
}
|
|
125963
|
-
// Skip over backtick code spans so `</Table>` in inline code isn't
|
|
125964
|
-
// treated as the closing tag
|
|
125965
|
-
if (code === codes_codes.graveAccent) {
|
|
125966
|
-
codeSpanOpenSize = 0;
|
|
125967
|
-
return countOpenTicks(code);
|
|
125968
|
-
}
|
|
125969
|
-
effects.consume(code);
|
|
125970
|
-
return body;
|
|
125971
|
-
}
|
|
125972
|
-
function countOpenTicks(code) {
|
|
125973
|
-
if (code === codes_codes.graveAccent) {
|
|
125974
|
-
codeSpanOpenSize += 1;
|
|
125975
|
-
effects.consume(code);
|
|
125976
|
-
return countOpenTicks;
|
|
125977
|
-
}
|
|
125978
|
-
return inCodeSpan(code);
|
|
125979
|
-
}
|
|
125980
|
-
function inCodeSpan(code) {
|
|
125981
|
-
if (code === null || markdownLineEnding(code))
|
|
125982
|
-
return body(code);
|
|
125983
|
-
if (code === codes_codes.graveAccent) {
|
|
125984
|
-
codeSpanCloseSize = 0;
|
|
125985
|
-
return countCloseTicks(code);
|
|
125986
|
-
}
|
|
125987
|
-
effects.consume(code);
|
|
125988
|
-
return inCodeSpan;
|
|
125989
|
-
}
|
|
125990
|
-
function countCloseTicks(code) {
|
|
125991
|
-
if (code === codes_codes.graveAccent) {
|
|
125992
|
-
codeSpanCloseSize += 1;
|
|
125993
|
-
effects.consume(code);
|
|
125994
|
-
return countCloseTicks;
|
|
125995
|
-
}
|
|
125996
|
-
return codeSpanCloseSize === codeSpanOpenSize ? body(code) : inCodeSpan(code);
|
|
125997
|
-
}
|
|
125998
|
-
function escapedChar(code) {
|
|
125999
|
-
if (code === null || markdownLineEnding(code)) {
|
|
126000
|
-
return body(code);
|
|
126001
|
-
}
|
|
126002
|
-
effects.consume(code);
|
|
126003
|
-
return body;
|
|
126004
|
-
}
|
|
126005
|
-
function closeSlash(code) {
|
|
126006
|
-
if (code === codes_codes.slash) {
|
|
126007
|
-
effects.consume(code);
|
|
126008
|
-
return closeTagFirstChar;
|
|
126009
|
-
}
|
|
126010
|
-
if (code === codes_codes.uppercaseT || code === codes_codes.lowercaseT) {
|
|
126011
|
-
effects.consume(code);
|
|
126012
|
-
return matchChars(ABLE_SUFFIX, openAfterTagName, body);
|
|
126013
|
-
}
|
|
126014
|
-
return body(code);
|
|
126015
|
-
}
|
|
126016
|
-
function closeTagFirstChar(code) {
|
|
126017
|
-
if (code === codes_codes.uppercaseT || code === codes_codes.lowercaseT) {
|
|
126018
|
-
effects.consume(code);
|
|
126019
|
-
return matchChars(ABLE_SUFFIX, closeGt, body);
|
|
126020
|
-
}
|
|
126021
|
-
return body(code);
|
|
126022
|
-
}
|
|
126023
|
-
function openAfterTagName(code) {
|
|
126024
|
-
if (code === codes_codes.greaterThan || code === codes_codes.slash || code === codes_codes.space || code === codes_codes.horizontalTab) {
|
|
126025
|
-
depth += 1;
|
|
126026
|
-
effects.consume(code);
|
|
126027
|
-
return body;
|
|
126028
|
-
}
|
|
126029
|
-
return body(code);
|
|
126030
|
-
}
|
|
126031
|
-
function closeGt(code) {
|
|
126032
|
-
if (code === codes_codes.greaterThan) {
|
|
126033
|
-
depth -= 1;
|
|
126034
|
-
effects.consume(code);
|
|
126035
|
-
if (depth === 0) {
|
|
126036
|
-
return afterClose;
|
|
126037
|
-
}
|
|
126038
|
-
return body;
|
|
126039
|
-
}
|
|
126040
|
-
return body(code);
|
|
126041
|
-
}
|
|
126042
|
-
function afterClose(code) {
|
|
126043
|
-
if (code === null || markdownLineEnding(code)) {
|
|
126044
|
-
effects.exit('jsxTableData');
|
|
126045
|
-
effects.exit('jsxTable');
|
|
126046
|
-
return ok(code);
|
|
126047
|
-
}
|
|
126048
|
-
effects.consume(code);
|
|
126049
|
-
return afterClose;
|
|
126050
|
-
}
|
|
126051
|
-
// Line ending handling — follows the htmlFlow pattern
|
|
126052
|
-
function continuationStart(code) {
|
|
126053
|
-
return effects.check(jsx_table_syntax_nonLazyContinuationStart, continuationStartNonLazy, continuationAfter)(code);
|
|
126054
|
-
}
|
|
126055
|
-
function continuationStartNonLazy(code) {
|
|
126056
|
-
effects.enter(types_types.lineEnding);
|
|
126057
|
-
effects.consume(code);
|
|
126058
|
-
effects.exit(types_types.lineEnding);
|
|
126059
|
-
return continuationBefore;
|
|
126060
|
-
}
|
|
126061
|
-
function continuationBefore(code) {
|
|
126062
|
-
if (code === null || markdownLineEnding(code)) {
|
|
126063
|
-
return continuationStart(code);
|
|
126064
|
-
}
|
|
126065
|
-
effects.enter('jsxTableData');
|
|
126066
|
-
return body(code);
|
|
126067
|
-
}
|
|
126068
|
-
function continuationAfter(code) {
|
|
126069
|
-
// At EOF without </Table>, reject so content isn't swallowed
|
|
126070
|
-
if (code === null) {
|
|
126071
|
-
return nok(code);
|
|
126072
|
-
}
|
|
126073
|
-
effects.exit('jsxTable');
|
|
126074
|
-
return ok(code);
|
|
126075
|
-
}
|
|
126076
|
-
}
|
|
126077
|
-
function jsx_table_syntax_tokenizeNonLazyContinuationStart(effects, ok, nok) {
|
|
126078
|
-
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
126079
|
-
const self = this;
|
|
126080
|
-
return start;
|
|
126081
|
-
function start(code) {
|
|
126082
|
-
if (markdownLineEnding(code)) {
|
|
126083
|
-
effects.enter(types_types.lineEnding);
|
|
126084
|
-
effects.consume(code);
|
|
126085
|
-
effects.exit(types_types.lineEnding);
|
|
126086
|
-
return after;
|
|
126087
|
-
}
|
|
126088
|
-
return nok(code);
|
|
126089
|
-
}
|
|
126090
|
-
function after(code) {
|
|
126091
|
-
if (self.parser.lazy[self.now().line]) {
|
|
126092
|
-
return nok(code);
|
|
126093
|
-
}
|
|
126094
|
-
return ok(code);
|
|
126095
|
-
}
|
|
126096
|
-
}
|
|
126097
|
-
/**
|
|
126098
|
-
* Micromark extension that tokenizes `<Table>...</Table>` and `<table>...</table>`
|
|
126099
|
-
* as a single flow block.
|
|
126100
|
-
*
|
|
126101
|
-
* Prevents CommonMark HTML block type 6 from fragmenting table blocks at blank lines.
|
|
126102
|
-
*/
|
|
126103
|
-
function syntax_jsxTable() {
|
|
126104
|
-
return {
|
|
126105
|
-
flow: {
|
|
126106
|
-
[codes_codes.lessThan]: [jsxTableConstruct],
|
|
126107
|
-
},
|
|
126108
|
-
};
|
|
126109
|
-
}
|
|
126110
|
-
|
|
126111
|
-
;// ./lib/micromark/jsx-table/index.ts
|
|
126112
|
-
|
|
126113
|
-
|
|
126114
126562
|
;// ./lib/micromark/mdx-expression-lenient/syntax.ts
|
|
126115
126563
|
|
|
126116
126564
|
|
|
@@ -126130,7 +126578,7 @@ function tokenizeTextExpression(effects, ok, nok) {
|
|
|
126130
126578
|
let depth = 0;
|
|
126131
126579
|
return start;
|
|
126132
126580
|
function start(code) {
|
|
126133
|
-
if (code !==
|
|
126581
|
+
if (code !== codes.leftCurlyBrace)
|
|
126134
126582
|
return nok(code);
|
|
126135
126583
|
effects.enter('mdxTextExpression');
|
|
126136
126584
|
effects.enter('mdxTextExpressionMarker');
|
|
@@ -126139,7 +126587,7 @@ function tokenizeTextExpression(effects, ok, nok) {
|
|
|
126139
126587
|
return before;
|
|
126140
126588
|
}
|
|
126141
126589
|
function before(code) {
|
|
126142
|
-
if (code ===
|
|
126590
|
+
if (code === codes.eof) {
|
|
126143
126591
|
effects.exit('mdxTextExpression');
|
|
126144
126592
|
return nok(code);
|
|
126145
126593
|
}
|
|
@@ -126149,24 +126597,24 @@ function tokenizeTextExpression(effects, ok, nok) {
|
|
|
126149
126597
|
effects.exit('lineEnding');
|
|
126150
126598
|
return before;
|
|
126151
126599
|
}
|
|
126152
|
-
if (code ===
|
|
126600
|
+
if (code === codes.rightCurlyBrace && depth === 0) {
|
|
126153
126601
|
return close(code);
|
|
126154
126602
|
}
|
|
126155
126603
|
effects.enter('mdxTextExpressionChunk');
|
|
126156
126604
|
return inside(code);
|
|
126157
126605
|
}
|
|
126158
126606
|
function inside(code) {
|
|
126159
|
-
if (code ===
|
|
126607
|
+
if (code === codes.eof || markdownLineEnding(code)) {
|
|
126160
126608
|
effects.exit('mdxTextExpressionChunk');
|
|
126161
126609
|
return before(code);
|
|
126162
126610
|
}
|
|
126163
|
-
if (code ===
|
|
126611
|
+
if (code === codes.rightCurlyBrace && depth === 0) {
|
|
126164
126612
|
effects.exit('mdxTextExpressionChunk');
|
|
126165
126613
|
return close(code);
|
|
126166
126614
|
}
|
|
126167
|
-
if (code ===
|
|
126615
|
+
if (code === codes.leftCurlyBrace)
|
|
126168
126616
|
depth += 1;
|
|
126169
|
-
else if (code ===
|
|
126617
|
+
else if (code === codes.rightCurlyBrace)
|
|
126170
126618
|
depth -= 1;
|
|
126171
126619
|
effects.consume(code);
|
|
126172
126620
|
return inside;
|
|
@@ -126182,7 +126630,7 @@ function tokenizeTextExpression(effects, ok, nok) {
|
|
|
126182
126630
|
function mdxExpressionLenient() {
|
|
126183
126631
|
return {
|
|
126184
126632
|
text: {
|
|
126185
|
-
[
|
|
126633
|
+
[codes.leftCurlyBrace]: {
|
|
126186
126634
|
name: 'mdxTextExpression',
|
|
126187
126635
|
tokenize: tokenizeTextExpression,
|
|
126188
126636
|
},
|
|
@@ -126286,6 +126734,9 @@ function loadComponents() {
|
|
|
126286
126734
|
|
|
126287
126735
|
|
|
126288
126736
|
|
|
126737
|
+
|
|
126738
|
+
|
|
126739
|
+
|
|
126289
126740
|
|
|
126290
126741
|
|
|
126291
126742
|
|
|
@@ -126300,15 +126751,19 @@ const defaultTransformers = [
|
|
|
126300
126751
|
* CommonMark/remark limitations and reach parity with legacy (rdmd) rendering.
|
|
126301
126752
|
*
|
|
126302
126753
|
* Runs a series of string-level transformations before micromark/remark parsing:
|
|
126303
|
-
* 1.
|
|
126304
|
-
* 2.
|
|
126305
|
-
* 3.
|
|
126306
|
-
* 4.
|
|
126307
|
-
* 5.
|
|
126754
|
+
* 1. Canonicalize closing tags with stray whitespace (e.g., `</ td >` → `</td>`)
|
|
126755
|
+
* 2. Normalize malformed table separator syntax (e.g., `|: ---` → `| :---`)
|
|
126756
|
+
* 3. Terminate HTML flow blocks so subsequent content isn't swallowed
|
|
126757
|
+
* 4. Close invalid "self-closing" HTML tags (e.g., `<i />` → `<i></i>`)
|
|
126758
|
+
* 5. Normalize compact ATX headings (e.g., `#Heading` → `# Heading`)
|
|
126759
|
+
* 6. Replace snake_case component names with parser-safe placeholders
|
|
126308
126760
|
*/
|
|
126309
126761
|
function preprocessContent(content, opts) {
|
|
126310
126762
|
const { knownComponents } = opts;
|
|
126311
|
-
|
|
126763
|
+
// Runs first so `jsxTable` sees a literal `</table>` (and the HTML-line
|
|
126764
|
+
// classification in `terminateHtmlFlowBlocks` is accurate)
|
|
126765
|
+
let result = normalizeClosingTagWhitespace(content);
|
|
126766
|
+
result = normalizeTableSeparator(result);
|
|
126312
126767
|
result = terminateHtmlFlowBlocks(result);
|
|
126313
126768
|
result = closeSelfClosingHtmlTags(result);
|
|
126314
126769
|
result = normalizeCompactHeadings(result);
|
|
@@ -126337,6 +126792,7 @@ function mdxishAstProcessor(mdContent, opts = {}) {
|
|
|
126337
126792
|
syntax_gemoji(),
|
|
126338
126793
|
legacyVariable(),
|
|
126339
126794
|
looseHtmlEntity(),
|
|
126795
|
+
syntax_htmlBlockComponent(),
|
|
126340
126796
|
];
|
|
126341
126797
|
const fromMarkdownExts = [
|
|
126342
126798
|
jsx_table_jsxTableFromMarkdown(),
|
|
@@ -126346,6 +126802,7 @@ function mdxishAstProcessor(mdContent, opts = {}) {
|
|
|
126346
126802
|
legacyVariableFromMarkdown(),
|
|
126347
126803
|
emptyTaskListItemFromMarkdown(),
|
|
126348
126804
|
looseHtmlEntityFromMarkdown(),
|
|
126805
|
+
html_block_component_htmlBlockComponentFromMarkdown(),
|
|
126349
126806
|
];
|
|
126350
126807
|
if (!safeMode) {
|
|
126351
126808
|
// Insert mdx expression (text-only, no flow) after gemoji at index 3
|
|
@@ -126359,6 +126816,10 @@ function mdxishAstProcessor(mdContent, opts = {}) {
|
|
|
126359
126816
|
// JSX comment tokenizer must come before magicBlock so it claims `{/* ... */}` first
|
|
126360
126817
|
micromarkExts.unshift(jsxComment());
|
|
126361
126818
|
}
|
|
126819
|
+
// Claim `<HTMLBlock>` as one opaque token so broad tokenizers can't fragment its body
|
|
126820
|
+
// We put this last as micromark tries the last-registered extension first, so push (not unshift) to win the `<` race.
|
|
126821
|
+
// micromarkExts.push(htmlBlockComponent());
|
|
126822
|
+
// fromMarkdownExts.push(htmlBlockComponentFromMarkdown());
|
|
126362
126823
|
const processor = lib_unified()
|
|
126363
126824
|
.data('micromarkExtensions', micromarkExts)
|
|
126364
126825
|
.data('fromMarkdownExtensions', fromMarkdownExts)
|
|
@@ -126902,332 +127363,6 @@ const mdxishTags_tags = (doc) => {
|
|
|
126902
127363
|
};
|
|
126903
127364
|
/* harmony default export */ const mdxishTags = ((/* unused pure expression or super */ null && (mdxishTags_tags)));
|
|
126904
127365
|
|
|
126905
|
-
;// ./lib/mdast-util/html-block-component/index.ts
|
|
126906
|
-
const html_block_component_contextMap = new WeakMap();
|
|
126907
|
-
function findHtmlBlockComponentToken() {
|
|
126908
|
-
const events = this.tokenStack;
|
|
126909
|
-
for (let i = events.length - 1; i >= 0; i -= 1) {
|
|
126910
|
-
if (events[i][0].type === 'htmlBlockComponent')
|
|
126911
|
-
return events[i][0];
|
|
126912
|
-
}
|
|
126913
|
-
return undefined;
|
|
126914
|
-
}
|
|
126915
|
-
function enterHtmlBlockComponent(token) {
|
|
126916
|
-
html_block_component_contextMap.set(token, { chunks: [], lastEndLine: token.start.line });
|
|
126917
|
-
this.enter({ type: 'html', value: '' }, token);
|
|
126918
|
-
}
|
|
126919
|
-
function exitHtmlBlockComponentData(token) {
|
|
126920
|
-
const componentToken = findHtmlBlockComponentToken.call(this);
|
|
126921
|
-
if (!componentToken)
|
|
126922
|
-
return;
|
|
126923
|
-
const ctx = html_block_component_contextMap.get(componentToken);
|
|
126924
|
-
if (ctx) {
|
|
126925
|
-
const gap = token.start.line - ctx.lastEndLine;
|
|
126926
|
-
if (ctx.chunks.length > 0 && gap > 0) {
|
|
126927
|
-
ctx.chunks.push('\n'.repeat(gap));
|
|
126928
|
-
}
|
|
126929
|
-
ctx.chunks.push(this.sliceSerialize(token));
|
|
126930
|
-
ctx.lastEndLine = token.end.line;
|
|
126931
|
-
}
|
|
126932
|
-
}
|
|
126933
|
-
function exitHtmlBlockComponent(token) {
|
|
126934
|
-
const ctx = html_block_component_contextMap.get(token);
|
|
126935
|
-
const node = this.stack[this.stack.length - 1];
|
|
126936
|
-
if (ctx) {
|
|
126937
|
-
node.value = ctx.chunks.join('');
|
|
126938
|
-
html_block_component_contextMap.delete(token);
|
|
126939
|
-
}
|
|
126940
|
-
this.exit(token);
|
|
126941
|
-
}
|
|
126942
|
-
function html_block_component_htmlBlockComponentFromMarkdown() {
|
|
126943
|
-
return {
|
|
126944
|
-
enter: {
|
|
126945
|
-
htmlBlockComponent: enterHtmlBlockComponent,
|
|
126946
|
-
},
|
|
126947
|
-
exit: {
|
|
126948
|
-
htmlBlockComponentData: exitHtmlBlockComponentData,
|
|
126949
|
-
htmlBlockComponent: exitHtmlBlockComponent,
|
|
126950
|
-
},
|
|
126951
|
-
};
|
|
126952
|
-
}
|
|
126953
|
-
|
|
126954
|
-
;// ./lib/micromark/html-block-component/syntax.ts
|
|
126955
|
-
|
|
126956
|
-
|
|
126957
|
-
const TAG_SUFFIX = [
|
|
126958
|
-
codes_codes.uppercaseT,
|
|
126959
|
-
codes_codes.uppercaseM,
|
|
126960
|
-
codes_codes.uppercaseL,
|
|
126961
|
-
codes_codes.uppercaseB,
|
|
126962
|
-
codes_codes.lowercaseL,
|
|
126963
|
-
codes_codes.lowercaseO,
|
|
126964
|
-
codes_codes.lowercaseC,
|
|
126965
|
-
codes_codes.lowercaseK,
|
|
126966
|
-
];
|
|
126967
|
-
// ---------------------------------------------------------------------------
|
|
126968
|
-
// Shared tokenizer factory
|
|
126969
|
-
// ---------------------------------------------------------------------------
|
|
126970
|
-
/**
|
|
126971
|
-
* Creates a tokenize function for `<HTMLBlock>...</HTMLBlock>`.
|
|
126972
|
-
*
|
|
126973
|
-
* - **flow** (block-level): supports multiline content via line continuations,
|
|
126974
|
-
* consumes trailing whitespace after the closing tag.
|
|
126975
|
-
* - **text** (inline): single-line only, exits immediately after the closing tag.
|
|
126976
|
-
*/
|
|
126977
|
-
function syntax_createTokenize(mode) {
|
|
126978
|
-
return function tokenize(effects, ok, nok) {
|
|
126979
|
-
let depth = 1;
|
|
126980
|
-
function matchChars(chars, onMatch, onFail) {
|
|
126981
|
-
if (chars.length === 0)
|
|
126982
|
-
return onMatch;
|
|
126983
|
-
const next = (code) => {
|
|
126984
|
-
if (code === chars[0]) {
|
|
126985
|
-
effects.consume(code);
|
|
126986
|
-
return matchChars(chars.slice(1), onMatch, onFail);
|
|
126987
|
-
}
|
|
126988
|
-
return onFail(code);
|
|
126989
|
-
};
|
|
126990
|
-
return next;
|
|
126991
|
-
}
|
|
126992
|
-
function matchTagName(onMatch, onFail) {
|
|
126993
|
-
const next = (code) => {
|
|
126994
|
-
if (code === codes_codes.uppercaseH) {
|
|
126995
|
-
effects.consume(code);
|
|
126996
|
-
return matchChars(TAG_SUFFIX, onMatch, onFail);
|
|
126997
|
-
}
|
|
126998
|
-
return onFail(code);
|
|
126999
|
-
};
|
|
127000
|
-
return next;
|
|
127001
|
-
}
|
|
127002
|
-
return start;
|
|
127003
|
-
function start(code) {
|
|
127004
|
-
if (code !== codes_codes.lessThan)
|
|
127005
|
-
return nok(code);
|
|
127006
|
-
effects.enter('htmlBlockComponent');
|
|
127007
|
-
effects.enter('htmlBlockComponentData');
|
|
127008
|
-
effects.consume(code);
|
|
127009
|
-
return matchTagName(afterTagName, nok);
|
|
127010
|
-
}
|
|
127011
|
-
function afterTagName(code) {
|
|
127012
|
-
if (code === codes_codes.greaterThan) {
|
|
127013
|
-
effects.consume(code);
|
|
127014
|
-
return body;
|
|
127015
|
-
}
|
|
127016
|
-
if (code === codes_codes.space || code === codes_codes.horizontalTab) {
|
|
127017
|
-
effects.consume(code);
|
|
127018
|
-
return inAttributes;
|
|
127019
|
-
}
|
|
127020
|
-
if (mode === 'flow' && markdownLineEnding(code)) {
|
|
127021
|
-
effects.exit('htmlBlockComponentData');
|
|
127022
|
-
return attributeContinuationStart(code);
|
|
127023
|
-
}
|
|
127024
|
-
if (code === codes_codes.slash) {
|
|
127025
|
-
effects.consume(code);
|
|
127026
|
-
return selfClose;
|
|
127027
|
-
}
|
|
127028
|
-
return nok(code);
|
|
127029
|
-
}
|
|
127030
|
-
function inAttributes(code) {
|
|
127031
|
-
if (code === codes_codes.greaterThan) {
|
|
127032
|
-
effects.consume(code);
|
|
127033
|
-
return body;
|
|
127034
|
-
}
|
|
127035
|
-
if (code === null) {
|
|
127036
|
-
return nok(code);
|
|
127037
|
-
}
|
|
127038
|
-
if (markdownLineEnding(code)) {
|
|
127039
|
-
if (mode === 'text')
|
|
127040
|
-
return nok(code);
|
|
127041
|
-
effects.exit('htmlBlockComponentData');
|
|
127042
|
-
return attributeContinuationStart(code);
|
|
127043
|
-
}
|
|
127044
|
-
effects.consume(code);
|
|
127045
|
-
return inAttributes;
|
|
127046
|
-
}
|
|
127047
|
-
function attributeContinuationStart(code) {
|
|
127048
|
-
return effects.check(html_block_component_syntax_nonLazyContinuationStart, attributeContinuationNonLazy, continuationAfter)(code);
|
|
127049
|
-
}
|
|
127050
|
-
function attributeContinuationNonLazy(code) {
|
|
127051
|
-
effects.enter(types_types.lineEnding);
|
|
127052
|
-
effects.consume(code);
|
|
127053
|
-
effects.exit(types_types.lineEnding);
|
|
127054
|
-
return attributeContinuationBefore;
|
|
127055
|
-
}
|
|
127056
|
-
function attributeContinuationBefore(code) {
|
|
127057
|
-
if (code === null || markdownLineEnding(code)) {
|
|
127058
|
-
return attributeContinuationStart(code);
|
|
127059
|
-
}
|
|
127060
|
-
effects.enter('htmlBlockComponentData');
|
|
127061
|
-
return inAttributes(code);
|
|
127062
|
-
}
|
|
127063
|
-
function selfClose(code) {
|
|
127064
|
-
if (code === codes_codes.greaterThan) {
|
|
127065
|
-
effects.consume(code);
|
|
127066
|
-
return mode === 'flow' ? afterClose : done(code);
|
|
127067
|
-
}
|
|
127068
|
-
return nok(code);
|
|
127069
|
-
}
|
|
127070
|
-
function body(code) {
|
|
127071
|
-
if (code === null)
|
|
127072
|
-
return nok(code);
|
|
127073
|
-
if (markdownLineEnding(code)) {
|
|
127074
|
-
if (mode === 'text') {
|
|
127075
|
-
// Text constructs operate on paragraph content which spans lines
|
|
127076
|
-
effects.consume(code);
|
|
127077
|
-
return body;
|
|
127078
|
-
}
|
|
127079
|
-
effects.exit('htmlBlockComponentData');
|
|
127080
|
-
return continuationStart(code);
|
|
127081
|
-
}
|
|
127082
|
-
if (code === codes_codes.lessThan) {
|
|
127083
|
-
effects.consume(code);
|
|
127084
|
-
return closeSlash;
|
|
127085
|
-
}
|
|
127086
|
-
effects.consume(code);
|
|
127087
|
-
return body;
|
|
127088
|
-
}
|
|
127089
|
-
function closeSlash(code) {
|
|
127090
|
-
if (code === codes_codes.slash) {
|
|
127091
|
-
effects.consume(code);
|
|
127092
|
-
return matchTagName(closeGt, body);
|
|
127093
|
-
}
|
|
127094
|
-
return matchTagName(openAfterTagName, body)(code);
|
|
127095
|
-
}
|
|
127096
|
-
function openAfterTagName(code) {
|
|
127097
|
-
if (code === codes_codes.greaterThan || code === codes_codes.space || code === codes_codes.horizontalTab) {
|
|
127098
|
-
depth += 1;
|
|
127099
|
-
effects.consume(code);
|
|
127100
|
-
return body;
|
|
127101
|
-
}
|
|
127102
|
-
return body(code);
|
|
127103
|
-
}
|
|
127104
|
-
function closeGt(code) {
|
|
127105
|
-
if (code === codes_codes.greaterThan) {
|
|
127106
|
-
depth -= 1;
|
|
127107
|
-
effects.consume(code);
|
|
127108
|
-
if (depth === 0) {
|
|
127109
|
-
return mode === 'flow' ? afterClose : done(code);
|
|
127110
|
-
}
|
|
127111
|
-
return body;
|
|
127112
|
-
}
|
|
127113
|
-
return body(code);
|
|
127114
|
-
}
|
|
127115
|
-
// -- flow-only states ---------------------------------------------------
|
|
127116
|
-
function afterClose(code) {
|
|
127117
|
-
if (code === null || markdownLineEnding(code)) {
|
|
127118
|
-
return done(code);
|
|
127119
|
-
}
|
|
127120
|
-
if (code === codes_codes.space || code === codes_codes.horizontalTab) {
|
|
127121
|
-
effects.consume(code);
|
|
127122
|
-
return afterClose;
|
|
127123
|
-
}
|
|
127124
|
-
// Reject so the block re-parses as a paragraph, deferring to the
|
|
127125
|
-
// text tokenizer which preserves trailing content in the same line.
|
|
127126
|
-
return nok(code);
|
|
127127
|
-
}
|
|
127128
|
-
// -- flow-only: line continuation ---------------------------------------
|
|
127129
|
-
function continuationStart(code) {
|
|
127130
|
-
return effects.check(html_block_component_syntax_nonLazyContinuationStart, continuationStartNonLazy, continuationAfter)(code);
|
|
127131
|
-
}
|
|
127132
|
-
function continuationStartNonLazy(code) {
|
|
127133
|
-
effects.enter(types_types.lineEnding);
|
|
127134
|
-
effects.consume(code);
|
|
127135
|
-
effects.exit(types_types.lineEnding);
|
|
127136
|
-
return continuationBefore;
|
|
127137
|
-
}
|
|
127138
|
-
function continuationBefore(code) {
|
|
127139
|
-
if (code === null || markdownLineEnding(code)) {
|
|
127140
|
-
return continuationStart(code);
|
|
127141
|
-
}
|
|
127142
|
-
effects.enter('htmlBlockComponentData');
|
|
127143
|
-
return body(code);
|
|
127144
|
-
}
|
|
127145
|
-
function continuationAfter(code) {
|
|
127146
|
-
if (code === null)
|
|
127147
|
-
return nok(code);
|
|
127148
|
-
effects.exit('htmlBlockComponent');
|
|
127149
|
-
return ok(code);
|
|
127150
|
-
}
|
|
127151
|
-
// -- shared exit --------------------------------------------------------
|
|
127152
|
-
function done(_code) {
|
|
127153
|
-
effects.exit('htmlBlockComponentData');
|
|
127154
|
-
effects.exit('htmlBlockComponent');
|
|
127155
|
-
return ok(_code);
|
|
127156
|
-
}
|
|
127157
|
-
};
|
|
127158
|
-
}
|
|
127159
|
-
// ---------------------------------------------------------------------------
|
|
127160
|
-
// Flow construct (block-level)
|
|
127161
|
-
// ---------------------------------------------------------------------------
|
|
127162
|
-
const html_block_component_syntax_nonLazyContinuationStart = {
|
|
127163
|
-
tokenize: html_block_component_syntax_tokenizeNonLazyContinuationStart,
|
|
127164
|
-
partial: true,
|
|
127165
|
-
};
|
|
127166
|
-
function resolveToHtmlBlockComponent(events) {
|
|
127167
|
-
let index = events.length;
|
|
127168
|
-
while (index > 0) {
|
|
127169
|
-
index -= 1;
|
|
127170
|
-
if (events[index][0] === 'enter' && events[index][1].type === 'htmlBlockComponent') {
|
|
127171
|
-
break;
|
|
127172
|
-
}
|
|
127173
|
-
}
|
|
127174
|
-
if (index > 1 && events[index - 2][1].type === types_types.linePrefix) {
|
|
127175
|
-
events[index][1].start = events[index - 2][1].start;
|
|
127176
|
-
events[index + 1][1].start = events[index - 2][1].start;
|
|
127177
|
-
events.splice(index - 2, 2);
|
|
127178
|
-
}
|
|
127179
|
-
return events;
|
|
127180
|
-
}
|
|
127181
|
-
const htmlBlockComponentFlowConstruct = {
|
|
127182
|
-
name: 'htmlBlockComponent',
|
|
127183
|
-
tokenize: syntax_createTokenize('flow'),
|
|
127184
|
-
resolveTo: resolveToHtmlBlockComponent,
|
|
127185
|
-
concrete: true,
|
|
127186
|
-
};
|
|
127187
|
-
function html_block_component_syntax_tokenizeNonLazyContinuationStart(effects, ok, nok) {
|
|
127188
|
-
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
127189
|
-
const self = this;
|
|
127190
|
-
return start;
|
|
127191
|
-
function start(code) {
|
|
127192
|
-
if (markdownLineEnding(code)) {
|
|
127193
|
-
effects.enter(types_types.lineEnding);
|
|
127194
|
-
effects.consume(code);
|
|
127195
|
-
effects.exit(types_types.lineEnding);
|
|
127196
|
-
return after;
|
|
127197
|
-
}
|
|
127198
|
-
return nok(code);
|
|
127199
|
-
}
|
|
127200
|
-
function after(code) {
|
|
127201
|
-
if (self.parser.lazy[self.now().line]) {
|
|
127202
|
-
return nok(code);
|
|
127203
|
-
}
|
|
127204
|
-
return ok(code);
|
|
127205
|
-
}
|
|
127206
|
-
}
|
|
127207
|
-
// ---------------------------------------------------------------------------
|
|
127208
|
-
// Text construct (inline)
|
|
127209
|
-
// ---------------------------------------------------------------------------
|
|
127210
|
-
const htmlBlockComponentTextConstruct = {
|
|
127211
|
-
name: 'htmlBlockComponent',
|
|
127212
|
-
tokenize: syntax_createTokenize('text'),
|
|
127213
|
-
};
|
|
127214
|
-
// ---------------------------------------------------------------------------
|
|
127215
|
-
// Extension
|
|
127216
|
-
// ---------------------------------------------------------------------------
|
|
127217
|
-
function syntax_htmlBlockComponent() {
|
|
127218
|
-
return {
|
|
127219
|
-
flow: {
|
|
127220
|
-
[codes.lessThan]: [htmlBlockComponentFlowConstruct],
|
|
127221
|
-
},
|
|
127222
|
-
text: {
|
|
127223
|
-
[codes.lessThan]: [htmlBlockComponentTextConstruct],
|
|
127224
|
-
},
|
|
127225
|
-
};
|
|
127226
|
-
}
|
|
127227
|
-
|
|
127228
|
-
;// ./lib/micromark/html-block-component/index.ts
|
|
127229
|
-
|
|
127230
|
-
|
|
127231
127366
|
;// ./lib/stripComments.ts
|
|
127232
127367
|
|
|
127233
127368
|
|