@readme/markdown 13.5.0 → 13.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/Callout/style.scss +8 -0
- package/dist/enums.d.ts +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/lib/ast-processor.d.ts +2 -2
- package/dist/lib/constants.d.ts +8 -0
- package/dist/lib/index.d.ts +1 -1
- package/dist/lib/mdast-util/jsx-table/index.d.ts +2 -0
- package/dist/lib/micromark/jsx-table/index.d.ts +1 -0
- package/dist/lib/micromark/jsx-table/syntax.d.ts +14 -0
- package/dist/main.css +1 -1
- package/dist/main.css.map +1 -1
- package/dist/main.js +2193 -1226
- package/dist/main.node.js +2193 -1226
- package/dist/main.node.js.map +1 -1
- package/dist/processor/transform/mdxish/constants.d.ts +5 -0
- package/dist/processor/transform/mdxish/mdxish-inline-components.d.ts +11 -0
- package/dist/processor/transform/mdxish/mdxish-tables.d.ts +7 -2
- package/package.json +2 -2
package/dist/main.node.js
CHANGED
|
@@ -19019,6 +19019,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
19019
19019
|
// EXPORTS
|
|
19020
19020
|
__webpack_require__.d(__webpack_exports__, {
|
|
19021
19021
|
Components: () => (/* reexport */ components_namespaceObject),
|
|
19022
|
+
FLOW_TYPES: () => (/* reexport */ FLOW_TYPES),
|
|
19022
19023
|
Owlmoji: () => (/* reexport */ Owlmoji),
|
|
19023
19024
|
compile: () => (/* reexport */ lib_compile),
|
|
19024
19025
|
exports: () => (/* reexport */ lib_exports),
|
|
@@ -25091,6 +25092,28 @@ const parseOptions = (userOpts = {}) => {
|
|
|
25091
25092
|
return opts;
|
|
25092
25093
|
};
|
|
25093
25094
|
|
|
25095
|
+
;// ./lib/constants.ts
|
|
25096
|
+
/**
|
|
25097
|
+
* Pattern to match component tags (PascalCase or snake_case)
|
|
25098
|
+
*/
|
|
25099
|
+
const componentTagPattern = /<(\/?[A-Z][A-Za-z0-9_]*)([^>]*?)(\/?)>/g;
|
|
25100
|
+
/**
|
|
25101
|
+
* MDAST flow (block-level) content types that cannot be represented
|
|
25102
|
+
* inside GFM table cells. Used to decide whether a table should be
|
|
25103
|
+
* serialized as GFM or as JSX `<Table>` syntax.
|
|
25104
|
+
*
|
|
25105
|
+
* @see https://github.com/syntax-tree/mdast#flowcontent
|
|
25106
|
+
*/
|
|
25107
|
+
const FLOW_TYPES = new Set([
|
|
25108
|
+
'blockquote',
|
|
25109
|
+
'code',
|
|
25110
|
+
'heading',
|
|
25111
|
+
'html',
|
|
25112
|
+
'list',
|
|
25113
|
+
'table',
|
|
25114
|
+
'thematicBreak',
|
|
25115
|
+
]);
|
|
25116
|
+
|
|
25094
25117
|
;// ./node_modules/github-slugger/regex.js
|
|
25095
25118
|
// This module is generated by `script/`.
|
|
25096
25119
|
/* eslint-disable no-control-regex, no-misleading-character-class, no-useless-escape */
|
|
@@ -61232,6 +61255,7 @@ function remarkMdx(options) {
|
|
|
61232
61255
|
;// ./enums.ts
|
|
61233
61256
|
var NodeTypes;
|
|
61234
61257
|
(function (NodeTypes) {
|
|
61258
|
+
NodeTypes["anchor"] = "readme-anchor";
|
|
61235
61259
|
NodeTypes["callout"] = "rdme-callout";
|
|
61236
61260
|
NodeTypes["codeTabs"] = "code-tabs";
|
|
61237
61261
|
NodeTypes["embedBlock"] = "embed-block";
|
|
@@ -73206,6 +73230,10 @@ const plain = (node, opts = {}) => {
|
|
|
73206
73230
|
};
|
|
73207
73231
|
/* harmony default export */ const lib_plain = (plain);
|
|
73208
73232
|
|
|
73233
|
+
;// ./processor/compile/variable.ts
|
|
73234
|
+
const variable = (node) => `{user.${node.data?.hProperties?.name || ''}}`;
|
|
73235
|
+
/* harmony default export */ const compile_variable = (variable);
|
|
73236
|
+
|
|
73209
73237
|
;// ./processor/transform/extract-text.ts
|
|
73210
73238
|
/**
|
|
73211
73239
|
* Extracts text content from a single AST node recursively.
|
|
@@ -73217,7 +73245,7 @@ const plain = (node, opts = {}) => {
|
|
|
73217
73245
|
* @returns The concatenated text content
|
|
73218
73246
|
*/
|
|
73219
73247
|
const extractText = (node) => {
|
|
73220
|
-
if (node.type === 'text' && typeof node.value === 'string') {
|
|
73248
|
+
if ((node.type === 'text' || node.type === 'html') && typeof node.value === 'string') {
|
|
73221
73249
|
return node.value;
|
|
73222
73250
|
}
|
|
73223
73251
|
// When a blockquote contains only an image (no text), treat it as having content
|
|
@@ -73245,6 +73273,23 @@ const extractText = (node) => {
|
|
|
73245
73273
|
|
|
73246
73274
|
|
|
73247
73275
|
|
|
73276
|
+
|
|
73277
|
+
|
|
73278
|
+
|
|
73279
|
+
|
|
73280
|
+
|
|
73281
|
+
|
|
73282
|
+
|
|
73283
|
+
const titleParser = unified().use(remarkParse).use(remarkGfm);
|
|
73284
|
+
// The title paragraph may contain custom AST nodes that `toMarkdown` doesn't
|
|
73285
|
+
// natively understand
|
|
73286
|
+
const toMarkdownExtensions = [
|
|
73287
|
+
gfmStrikethroughToMarkdown(),
|
|
73288
|
+
// For mdx variable syntaxes (e.g., {user.name})
|
|
73289
|
+
mdxExpressionToMarkdown(),
|
|
73290
|
+
// Important: This is required and would crash the parser if there's no variable node handler
|
|
73291
|
+
{ handlers: { [NodeTypes.variable]: compile_variable } },
|
|
73292
|
+
];
|
|
73248
73293
|
const callouts_regex = `^(${emoji_regex().source}|⚠)(\\s+|$)`;
|
|
73249
73294
|
const findFirst = (node) => {
|
|
73250
73295
|
if ('children' in node)
|
|
@@ -73361,31 +73406,65 @@ const processBlockquote = (node, index, parent) => {
|
|
|
73361
73406
|
// Example: "> ⚠️ **Bold heading**\nBody text here"
|
|
73362
73407
|
const bodyChildren = splitParagraphAtNewline(firstParagraph);
|
|
73363
73408
|
const didSplit = bodyChildren !== null;
|
|
73364
|
-
// Extract heading text after removing the icon prefix.
|
|
73365
|
-
// Use `plain()` to handle complex markdown structures (bold, inline code, etc.)
|
|
73366
|
-
const headingText = lib_plain(firstParagraph)
|
|
73367
|
-
.toString()
|
|
73368
|
-
.slice(match.length);
|
|
73369
|
-
// Clean up the raw AST by removing the icon prefix from the first text node
|
|
73370
73409
|
removeIconPrefix(firstParagraph, match.length);
|
|
73371
|
-
const
|
|
73410
|
+
const firstText = findFirst(firstParagraph);
|
|
73411
|
+
const rawValue = firstText?.value ?? '';
|
|
73412
|
+
const hasContent = rawValue.trim().length > 0 || firstParagraph.children.length > 1;
|
|
73413
|
+
const empty = !hasContent;
|
|
73372
73414
|
const theme = themes[icon] || 'default';
|
|
73373
|
-
|
|
73374
|
-
|
|
73375
|
-
|
|
73376
|
-
//
|
|
73377
|
-
|
|
73378
|
-
|
|
73415
|
+
if (hasContent || didSplit) {
|
|
73416
|
+
const headingMatch = rawValue.match(/^(#{1,6})\s*/);
|
|
73417
|
+
// # heading syntax is handled via direct AST manipulation so we can
|
|
73418
|
+
// set the depth while preserving the original inline children (bold, etc.)
|
|
73419
|
+
if (headingMatch) {
|
|
73420
|
+
firstText.value = rawValue.slice(headingMatch[0].length);
|
|
73421
|
+
const heading = wrapHeading(node);
|
|
73422
|
+
heading.depth = headingMatch[1].length;
|
|
73423
|
+
node.children[0] = heading;
|
|
73424
|
+
node.children[0].position.start.offset += match.length;
|
|
73425
|
+
node.children[0].position.start.column += match.length;
|
|
73426
|
+
}
|
|
73427
|
+
else {
|
|
73428
|
+
const headingText = toMarkdown({ type: 'root', children: [firstParagraph] }, {
|
|
73429
|
+
extensions: toMarkdownExtensions,
|
|
73430
|
+
})
|
|
73431
|
+
.trim()
|
|
73432
|
+
.replace(/^\\(?=[>#+\-*])/, '');
|
|
73433
|
+
const parsedTitle = titleParser.parse(headingText);
|
|
73434
|
+
const parsedFirstChild = parsedTitle.children[0];
|
|
73435
|
+
// Block-level syntax ("> quote", "- list") produces non-paragraph nodes;
|
|
73436
|
+
// inline text parses as a paragraph and falls through to wrapHeading().
|
|
73437
|
+
if (parsedFirstChild && parsedFirstChild.type !== 'paragraph') {
|
|
73438
|
+
// Strip positions from re-parsed nodes since they're relative to the heading text, not the original source
|
|
73439
|
+
visit(parsedTitle, (n) => {
|
|
73440
|
+
delete n.position;
|
|
73441
|
+
});
|
|
73442
|
+
const heading = wrapHeading(node);
|
|
73443
|
+
heading.children = parsedTitle.children;
|
|
73444
|
+
delete heading.position;
|
|
73445
|
+
node.children[0] = heading;
|
|
73446
|
+
}
|
|
73447
|
+
else {
|
|
73448
|
+
node.children[0] = wrapHeading(node);
|
|
73449
|
+
node.children[0].position.start.offset += match.length;
|
|
73450
|
+
node.children[0].position.start.column += match.length;
|
|
73451
|
+
}
|
|
73452
|
+
}
|
|
73379
73453
|
}
|
|
73380
73454
|
// Insert body content as a separate paragraph after the heading
|
|
73381
73455
|
if (bodyChildren) {
|
|
73456
|
+
const headingPosition = node.children[0].position;
|
|
73382
73457
|
node.children.splice(1, 0, {
|
|
73383
73458
|
type: 'paragraph',
|
|
73384
73459
|
children: bodyChildren,
|
|
73385
|
-
|
|
73386
|
-
|
|
73387
|
-
|
|
73388
|
-
|
|
73460
|
+
...(headingPosition && firstParagraphOriginalEnd
|
|
73461
|
+
? {
|
|
73462
|
+
position: {
|
|
73463
|
+
start: headingPosition.end,
|
|
73464
|
+
end: firstParagraphOriginalEnd,
|
|
73465
|
+
},
|
|
73466
|
+
}
|
|
73467
|
+
: {}),
|
|
73389
73468
|
});
|
|
73390
73469
|
}
|
|
73391
73470
|
Object.assign(node, {
|
|
@@ -73402,11 +73481,24 @@ const processBlockquote = (node, index, parent) => {
|
|
|
73402
73481
|
}
|
|
73403
73482
|
};
|
|
73404
73483
|
const calloutTransformer = () => {
|
|
73405
|
-
|
|
73406
|
-
visit(
|
|
73484
|
+
const processNode = (root) => {
|
|
73485
|
+
visit(root, 'blockquote', (node, index, parent) => {
|
|
73407
73486
|
processBlockquote(node, index, parent);
|
|
73487
|
+
if (node.type === NodeTypes.callout) {
|
|
73488
|
+
// SKIP prevents re-processing synthetic blockquotes in parsed title content
|
|
73489
|
+
// (e.g., blockquotes from "> Quote" titles). Recursively process body children
|
|
73490
|
+
// (index 1+, skipping the heading at 0) to handle nested callouts.
|
|
73491
|
+
for (let i = 1; i < node.children.length; i += 1) {
|
|
73492
|
+
processNode(node.children[i]);
|
|
73493
|
+
}
|
|
73494
|
+
return SKIP;
|
|
73495
|
+
}
|
|
73496
|
+
return undefined;
|
|
73408
73497
|
});
|
|
73409
73498
|
};
|
|
73499
|
+
return (tree) => {
|
|
73500
|
+
processNode(tree);
|
|
73501
|
+
};
|
|
73410
73502
|
};
|
|
73411
73503
|
/* harmony default export */ const callouts = (calloutTransformer);
|
|
73412
73504
|
|
|
@@ -73431,8 +73523,18 @@ const codeTabsTransformer = ({ copyButtons } = {}) => (tree) => {
|
|
|
73431
73523
|
const sibling = parent.children[walker];
|
|
73432
73524
|
if (!isCode(sibling))
|
|
73433
73525
|
break;
|
|
73526
|
+
// Check that the two code blocks are truly adjacent (no blank lines or
|
|
73527
|
+
// other content between them). The `gap` is the number of raw characters
|
|
73528
|
+
// between the end of the previous block and the start of this one.
|
|
73529
|
+
// For a LF-separated pair the gap equals `start.column` (the newline
|
|
73530
|
+
// char(s) plus any indentation). CRLF line endings add one extra byte
|
|
73531
|
+
// (\r) without advancing the line count, so we also accept
|
|
73532
|
+
// `start.column + 1` provided the blocks are still on consecutive lines.
|
|
73434
73533
|
const olderSibling = parent.children[walker - 1];
|
|
73435
|
-
|
|
73534
|
+
const gap = sibling.position.start.offset - olderSibling.position.end.offset;
|
|
73535
|
+
const lineDiff = sibling.position.start.line - olderSibling.position.end.line;
|
|
73536
|
+
const isCRLF = gap === sibling.position.start.column + 1 && lineDiff === 1;
|
|
73537
|
+
if (gap !== sibling.position.start.column && !isCRLF)
|
|
73436
73538
|
break;
|
|
73437
73539
|
children.push(sibling);
|
|
73438
73540
|
// eslint-disable-next-line no-plusplus
|
|
@@ -91008,687 +91110,348 @@ const mdxToHast = () => tree => {
|
|
|
91008
91110
|
};
|
|
91009
91111
|
/* harmony default export */ const mdx_to_hast = (mdxToHast);
|
|
91010
91112
|
|
|
91011
|
-
;// ./
|
|
91113
|
+
;// ./processor/transform/mdxish/normalize-malformed-md-syntax.ts
|
|
91114
|
+
|
|
91115
|
+
// Marker patterns for multi-node emphasis detection
|
|
91116
|
+
const MARKER_PATTERNS = [
|
|
91117
|
+
{ isBold: true, marker: '**' },
|
|
91118
|
+
{ isBold: true, marker: '__' },
|
|
91119
|
+
{ isBold: false, marker: '*' },
|
|
91120
|
+
{ isBold: false, marker: '_' },
|
|
91121
|
+
];
|
|
91122
|
+
// Patterns to detect for bold (** and __) and italic (* and _) syntax:
|
|
91123
|
+
// Bold: ** text**, **text **, word** text**, ** text **
|
|
91124
|
+
// Italic: * text*, *text *, word* text*, * text *
|
|
91125
|
+
// Same patterns for underscore variants
|
|
91126
|
+
// We use separate patterns for each marker type to allow this flexibility.
|
|
91127
|
+
// Pattern for ** bold **
|
|
91128
|
+
// Groups: 1=wordBefore, 2=marker, 3=contentWithSpaceAfter, 4=trailingSpace1, 5=contentWithSpaceBefore, 6=trailingSpace2, 7=afterChar
|
|
91129
|
+
// trailingSpace1 is for "** text **" pattern, trailingSpace2 is for "**text **" pattern
|
|
91130
|
+
const asteriskBoldRegex = /([^*\s]+)?\s*(\*\*)(?:\s+((?:[^*\n]|\*(?!\*))+?)(\s*)\2|((?:[^*\n]|\*(?!\*))+?)(\s+)\2)(\S|$)?/g;
|
|
91131
|
+
// Pattern for __ bold __
|
|
91132
|
+
const underscoreBoldRegex = /([^_\s]+)?\s*(__)(?:\s+((?:__(?! )|_(?!_)|[^_\n])+?)(\s*)\2|((?:__(?! )|_(?!_)|[^_\n])+?)(\s+)\2)(\S|$)?/g;
|
|
91133
|
+
// Pattern for * italic *
|
|
91134
|
+
const asteriskItalicRegex = /([^*\s]+)?\s*(\*)(?!\*)(?:\s+([^*\n]+?)(\s*)\2|([^*\n]+?)(\s+)\2)(\S|$)?/g;
|
|
91135
|
+
// Pattern for _ italic _
|
|
91136
|
+
const underscoreItalicRegex = /([^_\s]+)?\s*(_)(?!_)(?:\s+((?:[^_\n]|_(?! ))+?)(\s*)\2|((?:[^_\n]|_(?! ))+?)(\s+)\2)(\S|$)?/g;
|
|
91137
|
+
// CommonMark ignores intraword underscores or asteriks, but we want to italicize/bold the inner part
|
|
91138
|
+
// Pattern for intraword _word_ in words like hello_world_
|
|
91139
|
+
const intrawordUnderscoreItalicRegex = /(\w)_(?!_)([a-zA-Z0-9]+)_(?![\w_])/g;
|
|
91140
|
+
// Pattern for intraword __word__ in words like hello__world__
|
|
91141
|
+
const intrawordUnderscoreBoldRegex = /(\w)__([a-zA-Z0-9]+)__(?![\w_])/g;
|
|
91142
|
+
// Pattern for intraword *word* in words like hello*world*
|
|
91143
|
+
const intrawordAsteriskItalicRegex = /(\w)\*(?!\*)([a-zA-Z0-9]+)\*(?![\w*])/g;
|
|
91144
|
+
// Pattern for intraword **word** in words like hello**world**
|
|
91145
|
+
const intrawordAsteriskBoldRegex = /(\w)\*\*([a-zA-Z0-9]+)\*\*(?![\w*])/g;
|
|
91012
91146
|
/**
|
|
91013
|
-
*
|
|
91014
|
-
*
|
|
91015
|
-
* follows the closing bracket (`]`). This matches legacy behaviour for checkboxes
|
|
91016
|
-
*
|
|
91017
|
-
* The issue is `remark-gfm` does not actually classify these as task items when they have no content
|
|
91018
|
-
* after the checkbox, which leaves them as plain text (`"[ ]"`). So a custom extension is needed to
|
|
91019
|
-
* treat these as task items
|
|
91147
|
+
* Finds opening emphasis marker in a text value.
|
|
91148
|
+
* Returns marker info if found, null otherwise.
|
|
91020
91149
|
*/
|
|
91021
|
-
function
|
|
91022
|
-
const
|
|
91023
|
-
|
|
91024
|
-
|
|
91025
|
-
|
|
91026
|
-
|
|
91027
|
-
|
|
91028
|
-
|
|
91029
|
-
|
|
91030
|
-
|
|
91031
|
-
|
|
91032
|
-
|
|
91033
|
-
|
|
91034
|
-
|
|
91035
|
-
|
|
91036
|
-
|
|
91037
|
-
|
|
91038
|
-
|
|
91039
|
-
if (value === '[ ]') {
|
|
91040
|
-
listItem.checked = false;
|
|
91041
|
-
head.children = [];
|
|
91042
|
-
}
|
|
91043
|
-
else if (value === '[x]' || value === '[X]') {
|
|
91044
|
-
listItem.checked = true;
|
|
91045
|
-
head.children = [];
|
|
91046
|
-
}
|
|
91150
|
+
function findOpeningMarker(text) {
|
|
91151
|
+
const results = MARKER_PATTERNS.map(({ isBold, marker }) => {
|
|
91152
|
+
if (marker === '*' && text.startsWith('**'))
|
|
91153
|
+
return null;
|
|
91154
|
+
if (marker === '_' && text.startsWith('__'))
|
|
91155
|
+
return null;
|
|
91156
|
+
if (text.startsWith(marker) && text.length > marker.length) {
|
|
91157
|
+
return { isBold, marker, textAfter: text.slice(marker.length), textBefore: '' };
|
|
91158
|
+
}
|
|
91159
|
+
const idx = text.indexOf(marker);
|
|
91160
|
+
if (idx > 0 && !/\s/.test(text[idx - 1])) {
|
|
91161
|
+
if (marker === '*' && text.slice(idx).startsWith('**'))
|
|
91162
|
+
return null;
|
|
91163
|
+
if (marker === '_' && text.slice(idx).startsWith('__'))
|
|
91164
|
+
return null;
|
|
91165
|
+
const after = text.slice(idx + marker.length);
|
|
91166
|
+
if (after.length > 0) {
|
|
91167
|
+
return { isBold, marker, textAfter: after, textBefore: text.slice(0, idx) };
|
|
91047
91168
|
}
|
|
91048
91169
|
}
|
|
91049
|
-
|
|
91050
|
-
|
|
91051
|
-
|
|
91052
|
-
function emptyTaskListItemFromMarkdown() {
|
|
91053
|
-
return {
|
|
91054
|
-
exit: {
|
|
91055
|
-
listItem: exitListItemWithEmptyTaskListItem,
|
|
91056
|
-
},
|
|
91057
|
-
};
|
|
91170
|
+
return null;
|
|
91171
|
+
});
|
|
91172
|
+
return results.find(r => r !== null) ?? null;
|
|
91058
91173
|
}
|
|
91059
|
-
|
|
91060
|
-
|
|
91061
|
-
|
|
91062
|
-
|
|
91063
|
-
|
|
91064
|
-
|
|
91065
|
-
|
|
91066
|
-
|
|
91067
|
-
|
|
91068
|
-
if (
|
|
91069
|
-
return
|
|
91174
|
+
/**
|
|
91175
|
+
* Finds the end/closing marker in a text node for multi-node emphasis.
|
|
91176
|
+
*/
|
|
91177
|
+
function findEndMarker(text, marker) {
|
|
91178
|
+
const spacePattern = ` ${marker}`;
|
|
91179
|
+
const spaceIdx = text.indexOf(spacePattern);
|
|
91180
|
+
if (spaceIdx >= 0) {
|
|
91181
|
+
if (marker === '*' && text.slice(spaceIdx + 1).startsWith('**'))
|
|
91182
|
+
return null;
|
|
91183
|
+
if (marker === '_' && text.slice(spaceIdx + 1).startsWith('__'))
|
|
91184
|
+
return null;
|
|
91185
|
+
return {
|
|
91186
|
+
textAfter: text.slice(spaceIdx + spacePattern.length),
|
|
91187
|
+
textBefore: text.slice(0, spaceIdx),
|
|
91188
|
+
};
|
|
91070
91189
|
}
|
|
91071
|
-
|
|
91072
|
-
|
|
91073
|
-
|
|
91074
|
-
|
|
91075
|
-
|
|
91076
|
-
|
|
91077
|
-
|
|
91078
|
-
|
|
91079
|
-
|
|
91080
|
-
const ctx = contextMap.get(variableToken);
|
|
91081
|
-
// Build up the variable characters
|
|
91082
|
-
if (ctx)
|
|
91083
|
-
ctx.value += this.sliceSerialize(token);
|
|
91084
|
-
}
|
|
91085
|
-
function exitlegacyVariable(token) {
|
|
91086
|
-
const ctx = contextMap.get(token);
|
|
91087
|
-
const serialized = this.sliceSerialize(token);
|
|
91088
|
-
const variableName = serialized.startsWith('<<') && serialized.endsWith('>>')
|
|
91089
|
-
? serialized.slice(2, -2)
|
|
91090
|
-
: ctx?.value ?? '';
|
|
91091
|
-
const nodePosition = {
|
|
91092
|
-
start: {
|
|
91093
|
-
offset: token.start.offset,
|
|
91094
|
-
line: token.start.line,
|
|
91095
|
-
column: token.start.column,
|
|
91096
|
-
},
|
|
91097
|
-
end: {
|
|
91098
|
-
offset: token.end.offset,
|
|
91099
|
-
line: token.end.line,
|
|
91100
|
-
column: token.end.column,
|
|
91101
|
-
},
|
|
91102
|
-
};
|
|
91103
|
-
if (variableName.startsWith('glossary:')) {
|
|
91104
|
-
const term = variableName.slice('glossary:'.length).trim();
|
|
91105
|
-
this.enter({
|
|
91106
|
-
type: NodeTypes.glossary,
|
|
91107
|
-
data: {
|
|
91108
|
-
hName: 'Glossary',
|
|
91109
|
-
hProperties: { term },
|
|
91110
|
-
},
|
|
91111
|
-
children: [{ type: 'text', value: term }],
|
|
91112
|
-
position: nodePosition,
|
|
91113
|
-
}, token);
|
|
91114
|
-
this.exit(token);
|
|
91115
|
-
contextMap.delete(token);
|
|
91116
|
-
return;
|
|
91190
|
+
if (text.startsWith(marker)) {
|
|
91191
|
+
if (marker === '*' && text.startsWith('**'))
|
|
91192
|
+
return null;
|
|
91193
|
+
if (marker === '_' && text.startsWith('__'))
|
|
91194
|
+
return null;
|
|
91195
|
+
return {
|
|
91196
|
+
textAfter: text.slice(marker.length),
|
|
91197
|
+
textBefore: '',
|
|
91198
|
+
};
|
|
91117
91199
|
}
|
|
91118
|
-
|
|
91119
|
-
type: NodeTypes.variable,
|
|
91120
|
-
data: {
|
|
91121
|
-
hName: 'Variable',
|
|
91122
|
-
hProperties: { name: variableName.trim(), isLegacy: true },
|
|
91123
|
-
},
|
|
91124
|
-
value: `<<${variableName}>>`,
|
|
91125
|
-
}, token);
|
|
91126
|
-
this.exit(token);
|
|
91127
|
-
contextMap.delete(token);
|
|
91128
|
-
}
|
|
91129
|
-
function legacyVariableFromMarkdown() {
|
|
91130
|
-
return {
|
|
91131
|
-
enter: {
|
|
91132
|
-
legacyVariable: enterlegacyVariable,
|
|
91133
|
-
},
|
|
91134
|
-
exit: {
|
|
91135
|
-
legacyVariableValue: exitlegacyVariableValue,
|
|
91136
|
-
legacyVariable: exitlegacyVariable,
|
|
91137
|
-
},
|
|
91138
|
-
};
|
|
91200
|
+
return null;
|
|
91139
91201
|
}
|
|
91140
|
-
|
|
91141
|
-
;// ./node_modules/micromark-util-symbol/lib/codes.js
|
|
91142
91202
|
/**
|
|
91143
|
-
*
|
|
91144
|
-
*
|
|
91145
|
-
* This module is compiled away!
|
|
91146
|
-
*
|
|
91147
|
-
* micromark works based on character codes.
|
|
91148
|
-
* This module contains constants for the ASCII block and the replacement
|
|
91149
|
-
* character.
|
|
91150
|
-
* A couple of them are handled in a special way, such as the line endings
|
|
91151
|
-
* (CR, LF, and CR+LF, commonly known as end-of-line: EOLs), the tab (horizontal
|
|
91152
|
-
* tab) and its expansion based on what column it’s at (virtual space),
|
|
91153
|
-
* and the end-of-file (eof) character.
|
|
91154
|
-
* As values are preprocessed before handling them, the actual characters LF,
|
|
91155
|
-
* CR, HT, and NUL (which is present as the replacement character), are
|
|
91156
|
-
* guaranteed to not exist.
|
|
91157
|
-
*
|
|
91158
|
-
* Unicode basic latin block.
|
|
91203
|
+
* Scan children for an opening emphasis marker in a text node.
|
|
91159
91204
|
*/
|
|
91160
|
-
|
|
91161
|
-
|
|
91162
|
-
|
|
91163
|
-
|
|
91164
|
-
|
|
91165
|
-
|
|
91166
|
-
|
|
91167
|
-
|
|
91168
|
-
|
|
91169
|
-
stx: 2,
|
|
91170
|
-
etx: 3,
|
|
91171
|
-
eot: 4,
|
|
91172
|
-
enq: 5,
|
|
91173
|
-
ack: 6,
|
|
91174
|
-
bel: 7,
|
|
91175
|
-
bs: 8,
|
|
91176
|
-
ht: 9, // `\t`
|
|
91177
|
-
lf: 10, // `\n`
|
|
91178
|
-
vt: 11, // `\v`
|
|
91179
|
-
ff: 12, // `\f`
|
|
91180
|
-
cr: 13, // `\r`
|
|
91181
|
-
so: 14,
|
|
91182
|
-
si: 15,
|
|
91183
|
-
dle: 16,
|
|
91184
|
-
dc1: 17,
|
|
91185
|
-
dc2: 18,
|
|
91186
|
-
dc3: 19,
|
|
91187
|
-
dc4: 20,
|
|
91188
|
-
nak: 21,
|
|
91189
|
-
syn: 22,
|
|
91190
|
-
etb: 23,
|
|
91191
|
-
can: 24,
|
|
91192
|
-
em: 25,
|
|
91193
|
-
sub: 26,
|
|
91194
|
-
esc: 27,
|
|
91195
|
-
fs: 28,
|
|
91196
|
-
gs: 29,
|
|
91197
|
-
rs: 30,
|
|
91198
|
-
us: 31,
|
|
91199
|
-
space: 32,
|
|
91200
|
-
exclamationMark: 33, // `!`
|
|
91201
|
-
quotationMark: 34, // `"`
|
|
91202
|
-
numberSign: 35, // `#`
|
|
91203
|
-
dollarSign: 36, // `$`
|
|
91204
|
-
percentSign: 37, // `%`
|
|
91205
|
-
ampersand: 38, // `&`
|
|
91206
|
-
apostrophe: 39, // `'`
|
|
91207
|
-
leftParenthesis: 40, // `(`
|
|
91208
|
-
rightParenthesis: 41, // `)`
|
|
91209
|
-
asterisk: 42, // `*`
|
|
91210
|
-
plusSign: 43, // `+`
|
|
91211
|
-
comma: 44, // `,`
|
|
91212
|
-
dash: 45, // `-`
|
|
91213
|
-
dot: 46, // `.`
|
|
91214
|
-
slash: 47, // `/`
|
|
91215
|
-
digit0: 48, // `0`
|
|
91216
|
-
digit1: 49, // `1`
|
|
91217
|
-
digit2: 50, // `2`
|
|
91218
|
-
digit3: 51, // `3`
|
|
91219
|
-
digit4: 52, // `4`
|
|
91220
|
-
digit5: 53, // `5`
|
|
91221
|
-
digit6: 54, // `6`
|
|
91222
|
-
digit7: 55, // `7`
|
|
91223
|
-
digit8: 56, // `8`
|
|
91224
|
-
digit9: 57, // `9`
|
|
91225
|
-
colon: 58, // `:`
|
|
91226
|
-
semicolon: 59, // `;`
|
|
91227
|
-
lessThan: 60, // `<`
|
|
91228
|
-
equalsTo: 61, // `=`
|
|
91229
|
-
greaterThan: 62, // `>`
|
|
91230
|
-
questionMark: 63, // `?`
|
|
91231
|
-
atSign: 64, // `@`
|
|
91232
|
-
uppercaseA: 65, // `A`
|
|
91233
|
-
uppercaseB: 66, // `B`
|
|
91234
|
-
uppercaseC: 67, // `C`
|
|
91235
|
-
uppercaseD: 68, // `D`
|
|
91236
|
-
uppercaseE: 69, // `E`
|
|
91237
|
-
uppercaseF: 70, // `F`
|
|
91238
|
-
uppercaseG: 71, // `G`
|
|
91239
|
-
uppercaseH: 72, // `H`
|
|
91240
|
-
uppercaseI: 73, // `I`
|
|
91241
|
-
uppercaseJ: 74, // `J`
|
|
91242
|
-
uppercaseK: 75, // `K`
|
|
91243
|
-
uppercaseL: 76, // `L`
|
|
91244
|
-
uppercaseM: 77, // `M`
|
|
91245
|
-
uppercaseN: 78, // `N`
|
|
91246
|
-
uppercaseO: 79, // `O`
|
|
91247
|
-
uppercaseP: 80, // `P`
|
|
91248
|
-
uppercaseQ: 81, // `Q`
|
|
91249
|
-
uppercaseR: 82, // `R`
|
|
91250
|
-
uppercaseS: 83, // `S`
|
|
91251
|
-
uppercaseT: 84, // `T`
|
|
91252
|
-
uppercaseU: 85, // `U`
|
|
91253
|
-
uppercaseV: 86, // `V`
|
|
91254
|
-
uppercaseW: 87, // `W`
|
|
91255
|
-
uppercaseX: 88, // `X`
|
|
91256
|
-
uppercaseY: 89, // `Y`
|
|
91257
|
-
uppercaseZ: 90, // `Z`
|
|
91258
|
-
leftSquareBracket: 91, // `[`
|
|
91259
|
-
backslash: 92, // `\`
|
|
91260
|
-
rightSquareBracket: 93, // `]`
|
|
91261
|
-
caret: 94, // `^`
|
|
91262
|
-
underscore: 95, // `_`
|
|
91263
|
-
graveAccent: 96, // `` ` ``
|
|
91264
|
-
lowercaseA: 97, // `a`
|
|
91265
|
-
lowercaseB: 98, // `b`
|
|
91266
|
-
lowercaseC: 99, // `c`
|
|
91267
|
-
lowercaseD: 100, // `d`
|
|
91268
|
-
lowercaseE: 101, // `e`
|
|
91269
|
-
lowercaseF: 102, // `f`
|
|
91270
|
-
lowercaseG: 103, // `g`
|
|
91271
|
-
lowercaseH: 104, // `h`
|
|
91272
|
-
lowercaseI: 105, // `i`
|
|
91273
|
-
lowercaseJ: 106, // `j`
|
|
91274
|
-
lowercaseK: 107, // `k`
|
|
91275
|
-
lowercaseL: 108, // `l`
|
|
91276
|
-
lowercaseM: 109, // `m`
|
|
91277
|
-
lowercaseN: 110, // `n`
|
|
91278
|
-
lowercaseO: 111, // `o`
|
|
91279
|
-
lowercaseP: 112, // `p`
|
|
91280
|
-
lowercaseQ: 113, // `q`
|
|
91281
|
-
lowercaseR: 114, // `r`
|
|
91282
|
-
lowercaseS: 115, // `s`
|
|
91283
|
-
lowercaseT: 116, // `t`
|
|
91284
|
-
lowercaseU: 117, // `u`
|
|
91285
|
-
lowercaseV: 118, // `v`
|
|
91286
|
-
lowercaseW: 119, // `w`
|
|
91287
|
-
lowercaseX: 120, // `x`
|
|
91288
|
-
lowercaseY: 121, // `y`
|
|
91289
|
-
lowercaseZ: 122, // `z`
|
|
91290
|
-
leftCurlyBrace: 123, // `{`
|
|
91291
|
-
verticalBar: 124, // `|`
|
|
91292
|
-
rightCurlyBrace: 125, // `}`
|
|
91293
|
-
tilde: 126, // `~`
|
|
91294
|
-
del: 127,
|
|
91295
|
-
// Unicode Specials block.
|
|
91296
|
-
byteOrderMarker: 65_279,
|
|
91297
|
-
// Unicode Specials block.
|
|
91298
|
-
replacementCharacter: 65_533 // `�`
|
|
91299
|
-
})
|
|
91300
|
-
|
|
91301
|
-
;// ./lib/micromark/legacy-variable/syntax.ts
|
|
91302
|
-
|
|
91303
|
-
|
|
91304
|
-
function isAllowedValueChar(code) {
|
|
91305
|
-
return (code !== null &&
|
|
91306
|
-
code !== codes.lessThan &&
|
|
91307
|
-
code !== codes.greaterThan &&
|
|
91308
|
-
!markdownLineEnding(code));
|
|
91309
|
-
}
|
|
91310
|
-
const legacyVariableConstruct = {
|
|
91311
|
-
name: 'legacyVariable',
|
|
91312
|
-
tokenize,
|
|
91313
|
-
};
|
|
91314
|
-
function tokenize(effects, ok, nok) {
|
|
91315
|
-
let hasValue = false;
|
|
91316
|
-
const start = (code) => {
|
|
91317
|
-
if (code !== codes.lessThan)
|
|
91318
|
-
return nok(code);
|
|
91319
|
-
effects.enter('legacyVariable');
|
|
91320
|
-
effects.enter('legacyVariableMarkerStart');
|
|
91321
|
-
effects.consume(code); // <
|
|
91322
|
-
return open2;
|
|
91323
|
-
};
|
|
91324
|
-
const open2 = (code) => {
|
|
91325
|
-
if (code !== codes.lessThan)
|
|
91326
|
-
return nok(code);
|
|
91327
|
-
effects.consume(code); // <<
|
|
91328
|
-
effects.exit('legacyVariableMarkerStart');
|
|
91329
|
-
effects.enter('legacyVariableValue');
|
|
91330
|
-
return value;
|
|
91331
|
-
};
|
|
91332
|
-
const value = (code) => {
|
|
91333
|
-
if (code === codes.greaterThan) {
|
|
91334
|
-
if (!hasValue)
|
|
91335
|
-
return nok(code);
|
|
91336
|
-
effects.exit('legacyVariableValue');
|
|
91337
|
-
effects.enter('legacyVariableMarkerEnd');
|
|
91338
|
-
effects.consume(code); // >
|
|
91339
|
-
return close2;
|
|
91205
|
+
function findOpeningInChildren(children) {
|
|
91206
|
+
let result = null;
|
|
91207
|
+
children.some((child, idx) => {
|
|
91208
|
+
if (child.type !== 'text')
|
|
91209
|
+
return false;
|
|
91210
|
+
const found = findOpeningMarker(child.value);
|
|
91211
|
+
if (found) {
|
|
91212
|
+
result = { idx, opening: found };
|
|
91213
|
+
return true;
|
|
91340
91214
|
}
|
|
91341
|
-
|
|
91342
|
-
|
|
91343
|
-
|
|
91344
|
-
effects.consume(code);
|
|
91345
|
-
return value;
|
|
91346
|
-
};
|
|
91347
|
-
const close2 = (code) => {
|
|
91348
|
-
if (code !== codes.greaterThan)
|
|
91349
|
-
return nok(code);
|
|
91350
|
-
effects.consume(code); // >>
|
|
91351
|
-
effects.exit('legacyVariableMarkerEnd');
|
|
91352
|
-
effects.exit('legacyVariable');
|
|
91353
|
-
return ok;
|
|
91354
|
-
};
|
|
91355
|
-
return start;
|
|
91356
|
-
}
|
|
91357
|
-
function legacyVariable() {
|
|
91358
|
-
return {
|
|
91359
|
-
text: { [codes.lessThan]: legacyVariableConstruct },
|
|
91360
|
-
};
|
|
91215
|
+
return false;
|
|
91216
|
+
});
|
|
91217
|
+
return result;
|
|
91361
91218
|
}
|
|
91362
|
-
|
|
91363
|
-
;// ./lib/micromark/legacy-variable/index.ts
|
|
91364
91219
|
/**
|
|
91365
|
-
*
|
|
91220
|
+
* Scan children (after openingIdx) for a closing emphasis marker.
|
|
91366
91221
|
*/
|
|
91367
|
-
|
|
91368
|
-
|
|
91369
|
-
|
|
91370
|
-
|
|
91371
|
-
|
|
91372
|
-
|
|
91373
|
-
|
|
91374
|
-
|
|
91375
|
-
|
|
91376
|
-
|
|
91377
|
-
|
|
91222
|
+
function findClosingInChildren(children, openingIdx, marker) {
|
|
91223
|
+
let result = null;
|
|
91224
|
+
children.slice(openingIdx + 1).some((child, relativeIdx) => {
|
|
91225
|
+
if (child.type !== 'text')
|
|
91226
|
+
return false;
|
|
91227
|
+
const found = findEndMarker(child.value, marker);
|
|
91228
|
+
if (found) {
|
|
91229
|
+
result = { closingIdx: openingIdx + 1 + relativeIdx, closing: found };
|
|
91230
|
+
return true;
|
|
91231
|
+
}
|
|
91232
|
+
return false;
|
|
91233
|
+
});
|
|
91234
|
+
return result;
|
|
91235
|
+
}
|
|
91378
91236
|
/**
|
|
91379
|
-
*
|
|
91380
|
-
* to avoid scanning too far and degrading performance
|
|
91237
|
+
* Build the replacement nodes for a matched emphasis pair.
|
|
91381
91238
|
*/
|
|
91382
|
-
|
|
91383
|
-
|
|
91384
|
-
|
|
91385
|
-
|
|
91386
|
-
* block transformer cannot handle correctly, or are inline components that we don't
|
|
91387
|
-
* want to convert to mdxJsxFlowElement which is a block level element.
|
|
91388
|
-
*
|
|
91389
|
-
* Glossary and Anchor are inline components.
|
|
91390
|
-
*/
|
|
91391
|
-
const EXCLUDED_TAGS = new Set(['HTMLBlock', 'Table', 'Glossary', 'Anchor']);
|
|
91392
|
-
const inlineMdProcessor = unified()
|
|
91393
|
-
.data('micromarkExtensions', [legacyVariable()])
|
|
91394
|
-
.data('fromMarkdownExtensions', [legacyVariableFromMarkdown(), emptyTaskListItemFromMarkdown()])
|
|
91395
|
-
.use(remarkParse)
|
|
91396
|
-
.use(remarkGfm);
|
|
91397
|
-
const isClosingTag = (value, tag) => value.trim() === `</${tag}>`;
|
|
91398
|
-
/**
|
|
91399
|
-
* Parse markdown content into mdast children nodes.
|
|
91400
|
-
*/
|
|
91401
|
-
const parseMdChildren = (value) => {
|
|
91402
|
-
const parsed = inlineMdProcessor.parse(value);
|
|
91403
|
-
return parsed.children || [];
|
|
91404
|
-
};
|
|
91405
|
-
/**
|
|
91406
|
-
* Convert raw attribute string into mdxJsxAttribute entries.
|
|
91407
|
-
* Handles both key-value attributes (theme="info") and boolean attributes (empty).
|
|
91408
|
-
*/
|
|
91409
|
-
const parseAttributes = (raw) => {
|
|
91410
|
-
const attributes = [];
|
|
91411
|
-
const attrString = raw.trim();
|
|
91412
|
-
if (!attrString)
|
|
91413
|
-
return attributes;
|
|
91414
|
-
tagAttributePattern.lastIndex = 0;
|
|
91415
|
-
let match = tagAttributePattern.exec(attrString);
|
|
91416
|
-
while (match !== null) {
|
|
91417
|
-
const [, attrName, attrValue] = match;
|
|
91418
|
-
const value = attrValue ? attrValue.replace(/^['"]|['"]$/g, '') : null;
|
|
91419
|
-
attributes.push({ type: 'mdxJsxAttribute', name: attrName, value });
|
|
91420
|
-
match = tagAttributePattern.exec(attrString);
|
|
91239
|
+
function buildReplacementNodes(container, { opening, openingIdx, closing, closingIdx }) {
|
|
91240
|
+
const newNodes = [];
|
|
91241
|
+
if (opening.textBefore) {
|
|
91242
|
+
newNodes.push({ type: 'text', value: `${opening.textBefore} ` });
|
|
91421
91243
|
}
|
|
91422
|
-
|
|
91423
|
-
|
|
91424
|
-
|
|
91425
|
-
|
|
91426
|
-
*/
|
|
91427
|
-
const parseTag = (value) => {
|
|
91428
|
-
const match = value.match(pascalCaseTagPattern);
|
|
91429
|
-
if (!match)
|
|
91430
|
-
return null;
|
|
91431
|
-
const [, tag, attrString = '', selfClosing = '', contentAfterTag = ''] = match;
|
|
91432
|
-
return {
|
|
91433
|
-
tag,
|
|
91434
|
-
attributes: parseAttributes(attrString),
|
|
91435
|
-
selfClosing: !!selfClosing,
|
|
91436
|
-
contentAfterTag,
|
|
91437
|
-
};
|
|
91438
|
-
};
|
|
91439
|
-
/**
|
|
91440
|
-
* Parse substring content of a node and update the parent's children to include the new nodes.
|
|
91441
|
-
*/
|
|
91442
|
-
const parseSibling = (stack, parent, index, sibling) => {
|
|
91443
|
-
const siblingNodes = parseMdChildren(sibling);
|
|
91444
|
-
// The new sibling nodes might contain new components to be processed
|
|
91445
|
-
if (siblingNodes.length > 0) {
|
|
91446
|
-
parent.children.splice(index + 1, 0, ...siblingNodes);
|
|
91447
|
-
stack.push(parent);
|
|
91244
|
+
const emphasisChildren = [];
|
|
91245
|
+
const openingText = opening.textAfter.replace(/^\s+/, '');
|
|
91246
|
+
if (openingText) {
|
|
91247
|
+
emphasisChildren.push({ type: 'text', value: openingText });
|
|
91448
91248
|
}
|
|
91449
|
-
|
|
91450
|
-
|
|
91451
|
-
|
|
91452
|
-
|
|
91453
|
-
|
|
91454
|
-
|
|
91455
|
-
|
|
91456
|
-
|
|
91457
|
-
|
|
91458
|
-
|
|
91459
|
-
|
|
91460
|
-
|
|
91461
|
-
}
|
|
91462
|
-
|
|
91249
|
+
container.children.slice(openingIdx + 1, closingIdx).forEach(child => {
|
|
91250
|
+
emphasisChildren.push(child);
|
|
91251
|
+
});
|
|
91252
|
+
const closingText = closing.textBefore.replace(/\s+$/, '');
|
|
91253
|
+
if (closingText) {
|
|
91254
|
+
emphasisChildren.push({ type: 'text', value: closingText });
|
|
91255
|
+
}
|
|
91256
|
+
if (emphasisChildren.length > 0) {
|
|
91257
|
+
const emphasisNode = opening.isBold
|
|
91258
|
+
? { type: 'strong', children: emphasisChildren }
|
|
91259
|
+
: { type: 'emphasis', children: emphasisChildren };
|
|
91260
|
+
newNodes.push(emphasisNode);
|
|
91261
|
+
}
|
|
91262
|
+
if (closing.textAfter) {
|
|
91263
|
+
newNodes.push({ type: 'text', value: closing.textAfter });
|
|
91264
|
+
}
|
|
91265
|
+
return newNodes;
|
|
91266
|
+
}
|
|
91463
91267
|
/**
|
|
91464
|
-
*
|
|
91268
|
+
* Find and transform one multi-node emphasis pair in the container.
|
|
91269
|
+
* Returns true if a pair was found and transformed, false otherwise.
|
|
91465
91270
|
*/
|
|
91466
|
-
|
|
91467
|
-
|
|
91468
|
-
|
|
91469
|
-
|
|
91470
|
-
const
|
|
91471
|
-
|
|
91472
|
-
|
|
91473
|
-
|
|
91474
|
-
|
|
91475
|
-
};
|
|
91271
|
+
function processOneEmphasisPair(container) {
|
|
91272
|
+
const openingResult = findOpeningInChildren(container.children);
|
|
91273
|
+
if (!openingResult)
|
|
91274
|
+
return false;
|
|
91275
|
+
const { idx: openingIdx, opening } = openingResult;
|
|
91276
|
+
const closingResult = findClosingInChildren(container.children, openingIdx, opening.marker);
|
|
91277
|
+
if (!closingResult)
|
|
91278
|
+
return false;
|
|
91279
|
+
const { closingIdx, closing } = closingResult;
|
|
91280
|
+
const newNodes = buildReplacementNodes(container, { opening, openingIdx, closing, closingIdx });
|
|
91281
|
+
const deleteCount = closingIdx - openingIdx + 1;
|
|
91282
|
+
container.children.splice(openingIdx, deleteCount, ...newNodes);
|
|
91283
|
+
return true;
|
|
91284
|
+
}
|
|
91476
91285
|
/**
|
|
91477
|
-
*
|
|
91478
|
-
*
|
|
91479
|
-
* - Exact match HTML siblings (e.g., `</Tag>`)
|
|
91480
|
-
* - HTML siblings with embedded closing tag (e.g., `...\n</Tag>`)
|
|
91481
|
-
* - Paragraph siblings containing the closing tag as a child
|
|
91482
|
-
*
|
|
91483
|
-
* Returns null if not found within MAX_LOOKAHEAD siblings
|
|
91286
|
+
* Handle malformed emphasis that spans multiple AST nodes.
|
|
91287
|
+
* E.g., "**bold [link](url)**" where markers are in different text nodes.
|
|
91484
91288
|
*/
|
|
91485
|
-
|
|
91486
|
-
const
|
|
91487
|
-
|
|
91488
|
-
|
|
91489
|
-
|
|
91490
|
-
|
|
91491
|
-
|
|
91492
|
-
|
|
91493
|
-
|
|
91494
|
-
|
|
91495
|
-
|
|
91496
|
-
return { closingIndex: i, extraClosingChildren: [] };
|
|
91497
|
-
}
|
|
91498
|
-
// Embedded closing tag (closing tag within HTML block content)
|
|
91499
|
-
if (siblingValue.includes(closingTagStr)) {
|
|
91500
|
-
const closeTagPos = siblingValue.indexOf(closingTagStr);
|
|
91501
|
-
const contentBeforeClose = siblingValue.substring(0, closeTagPos).trim();
|
|
91502
|
-
const contentAfterClose = siblingValue.substring(closeTagPos + closingTagStr.length).trim();
|
|
91503
|
-
const extraChildren = contentBeforeClose
|
|
91504
|
-
? parseMdChildren(contentBeforeClose)
|
|
91505
|
-
: [];
|
|
91506
|
-
return { closingIndex: i, extraClosingChildren: extraChildren, contentAfterClose: contentAfterClose || undefined };
|
|
91507
|
-
}
|
|
91508
|
-
}
|
|
91509
|
-
// Check paragraph siblings
|
|
91510
|
-
if (sibling.type === 'paragraph') {
|
|
91511
|
-
const { paragraph, found } = stripClosingTagFromParagraph(sibling, tag);
|
|
91512
|
-
if (found) {
|
|
91513
|
-
return { closingIndex: i, extraClosingChildren: [], strippedParagraph: paragraph };
|
|
91514
|
-
}
|
|
91289
|
+
function visitMultiNodeEmphasis(tree) {
|
|
91290
|
+
const containerTypes = ['paragraph', 'heading', 'tableCell', 'listItem', 'blockquote'];
|
|
91291
|
+
visit(tree, node => {
|
|
91292
|
+
if (!containerTypes.includes(node.type))
|
|
91293
|
+
return;
|
|
91294
|
+
if (!('children' in node) || !Array.isArray(node.children))
|
|
91295
|
+
return;
|
|
91296
|
+
const container = node;
|
|
91297
|
+
let foundPair = true;
|
|
91298
|
+
while (foundPair) {
|
|
91299
|
+
foundPair = processOneEmphasisPair(container);
|
|
91515
91300
|
}
|
|
91516
|
-
}
|
|
91517
|
-
|
|
91518
|
-
// eslint-disable-next-line no-console
|
|
91519
|
-
console.warn(`Closing tag </${tag}> not found within ${MAX_LOOKAHEAD} siblings, stopping scan`);
|
|
91520
|
-
}
|
|
91521
|
-
return null;
|
|
91522
|
-
};
|
|
91523
|
-
const substituteNodeWithMdxNode = (parent, index, mdxNode) => {
|
|
91524
|
-
parent.children.splice(index, 1, mdxNode);
|
|
91525
|
-
};
|
|
91301
|
+
});
|
|
91302
|
+
}
|
|
91526
91303
|
/**
|
|
91527
|
-
*
|
|
91528
|
-
*
|
|
91529
|
-
*
|
|
91530
|
-
*
|
|
91531
|
-
* This transformer identifies these patterns and converts them to proper MDX JSX elements so they
|
|
91532
|
-
* can be accurately recognized and rendered later with their component definition code.
|
|
91533
|
-
* Though for some tags, we need to handle them specially
|
|
91534
|
-
*
|
|
91535
|
-
* ## Supported HTML Structures
|
|
91536
|
-
*
|
|
91537
|
-
* ### 1. Self-closing tags
|
|
91538
|
-
* ```
|
|
91539
|
-
* <Component />
|
|
91540
|
-
* ```
|
|
91541
|
-
* Parsed as: `html: "<Component />"`
|
|
91542
|
-
*
|
|
91543
|
-
* ### 2. Self-contained blocks (entire component in single HTML node)
|
|
91544
|
-
* ```
|
|
91545
|
-
* <Button>Click me</Button>
|
|
91546
|
-
* ```
|
|
91547
|
-
* ```
|
|
91548
|
-
* <Component>
|
|
91549
|
-
* <h2>Title</h2>
|
|
91550
|
-
* <p>Content</p>
|
|
91551
|
-
* </Component>
|
|
91552
|
-
* ```
|
|
91553
|
-
* Parsed as: `html: "<Component>\n <h2>Title</h2>\n <p>Content</p>\n</Component>"`
|
|
91554
|
-
* The opening tag, content, and closing tag are all captured in one HTML node.
|
|
91555
|
-
*
|
|
91556
|
-
* ### 3. Multi-sibling components (closing tag in a following sibling)
|
|
91557
|
-
* Handles various structures where the closing tag is in a later sibling, such as:
|
|
91558
|
-
*
|
|
91559
|
-
* #### 3a. Block components (closing tag in sibling paragraph)
|
|
91560
|
-
* ```
|
|
91561
|
-
* <Callout>
|
|
91562
|
-
* Some **markdown** content
|
|
91563
|
-
* </Callout>
|
|
91564
|
-
* ```
|
|
91565
|
-
*
|
|
91566
|
-
* #### 3b. Multi-paragraph components (closing tag several siblings away)
|
|
91567
|
-
* ```
|
|
91568
|
-
* <Callout>
|
|
91569
|
-
*
|
|
91570
|
-
* First paragraph
|
|
91571
|
-
*
|
|
91572
|
-
* Second paragraph
|
|
91573
|
-
* </Callout>
|
|
91574
|
-
* ```
|
|
91304
|
+
* A remark plugin that normalizes malformed bold and italic markers in text nodes.
|
|
91305
|
+
* Detects patterns like `** bold**`, `Hello** Wrong Bold**`, `__ bold__`, `Hello__ Wrong Bold__`,
|
|
91306
|
+
* `* italic*`, `Hello* Wrong Italic*`, `_ italic_`, or `Hello_ Wrong Italic_`
|
|
91307
|
+
* and converts them to proper strong/emphasis nodes, matching the behavior of the legacy rdmd engine.
|
|
91575
91308
|
*
|
|
91576
|
-
*
|
|
91577
|
-
*
|
|
91578
|
-
* <Outer>
|
|
91579
|
-
* <Inner>content</Inner>
|
|
91309
|
+
* Supports both asterisk (`**bold**`, `*italic*`) and underscore (`__bold__`, `_italic_`) syntax.
|
|
91310
|
+
* Also supports snake_case content like `** some_snake_case**`.
|
|
91580
91311
|
*
|
|
91581
|
-
*
|
|
91582
|
-
*
|
|
91583
|
-
* ```
|
|
91312
|
+
* This runs after remark-parse, which (in v11+) is strict and doesn't parse
|
|
91313
|
+
* malformed emphasis syntax. This plugin post-processes the AST to handle these cases.
|
|
91584
91314
|
*/
|
|
91585
|
-
const
|
|
91586
|
-
|
|
91587
|
-
|
|
91588
|
-
|
|
91589
|
-
if
|
|
91590
|
-
|
|
91591
|
-
|
|
91592
|
-
stack.push(node);
|
|
91315
|
+
const normalizeEmphasisAST = () => (tree) => {
|
|
91316
|
+
visit(tree, 'text', function visitor(node, index, parent) {
|
|
91317
|
+
if (index === undefined || !parent)
|
|
91318
|
+
return undefined;
|
|
91319
|
+
// Skip if inside code blocks or inline code
|
|
91320
|
+
if (parent.type === 'inlineCode' || parent.type === 'code') {
|
|
91321
|
+
return undefined;
|
|
91593
91322
|
}
|
|
91594
|
-
|
|
91595
|
-
|
|
91596
|
-
|
|
91597
|
-
|
|
91598
|
-
|
|
91599
|
-
|
|
91600
|
-
|
|
91601
|
-
|
|
91602
|
-
|
|
91603
|
-
|
|
91604
|
-
|
|
91605
|
-
|
|
91606
|
-
|
|
91607
|
-
|
|
91608
|
-
|
|
91609
|
-
|
|
91610
|
-
|
|
91611
|
-
|
|
91612
|
-
|
|
91613
|
-
|
|
91614
|
-
|
|
91615
|
-
|
|
91616
|
-
|
|
91617
|
-
|
|
91618
|
-
|
|
91619
|
-
|
|
91323
|
+
const text = node.value;
|
|
91324
|
+
const allMatches = [];
|
|
91325
|
+
[...text.matchAll(asteriskBoldRegex)].forEach(match => {
|
|
91326
|
+
allMatches.push({ isBold: true, marker: '**', match });
|
|
91327
|
+
});
|
|
91328
|
+
[...text.matchAll(underscoreBoldRegex)].forEach(match => {
|
|
91329
|
+
allMatches.push({ isBold: true, marker: '__', match });
|
|
91330
|
+
});
|
|
91331
|
+
[...text.matchAll(asteriskItalicRegex)].forEach(match => {
|
|
91332
|
+
allMatches.push({ isBold: false, marker: '*', match });
|
|
91333
|
+
});
|
|
91334
|
+
[...text.matchAll(underscoreItalicRegex)].forEach(match => {
|
|
91335
|
+
allMatches.push({ isBold: false, marker: '_', match });
|
|
91336
|
+
});
|
|
91337
|
+
[...text.matchAll(intrawordUnderscoreItalicRegex)].forEach(match => {
|
|
91338
|
+
allMatches.push({ isBold: false, isIntraword: true, marker: '_', match });
|
|
91339
|
+
});
|
|
91340
|
+
[...text.matchAll(intrawordUnderscoreBoldRegex)].forEach(match => {
|
|
91341
|
+
allMatches.push({ isBold: true, isIntraword: true, marker: '__', match });
|
|
91342
|
+
});
|
|
91343
|
+
[...text.matchAll(intrawordAsteriskItalicRegex)].forEach(match => {
|
|
91344
|
+
allMatches.push({ isBold: false, isIntraword: true, marker: '*', match });
|
|
91345
|
+
});
|
|
91346
|
+
[...text.matchAll(intrawordAsteriskBoldRegex)].forEach(match => {
|
|
91347
|
+
allMatches.push({ isBold: true, isIntraword: true, marker: '**', match });
|
|
91348
|
+
});
|
|
91349
|
+
if (allMatches.length === 0)
|
|
91350
|
+
return undefined;
|
|
91351
|
+
allMatches.sort((a, b) => (a.match.index ?? 0) - (b.match.index ?? 0));
|
|
91352
|
+
const filteredMatches = [];
|
|
91353
|
+
let lastEnd = 0;
|
|
91354
|
+
allMatches.forEach(info => {
|
|
91355
|
+
const start = info.match.index ?? 0;
|
|
91356
|
+
const end = start + info.match[0].length;
|
|
91357
|
+
if (start >= lastEnd) {
|
|
91358
|
+
filteredMatches.push(info);
|
|
91359
|
+
lastEnd = end;
|
|
91620
91360
|
}
|
|
91621
|
-
|
|
91622
|
-
|
|
91623
|
-
|
|
91624
|
-
|
|
91625
|
-
|
|
91626
|
-
|
|
91627
|
-
const
|
|
91628
|
-
const
|
|
91629
|
-
|
|
91630
|
-
|
|
91631
|
-
|
|
91632
|
-
|
|
91633
|
-
|
|
91634
|
-
|
|
91635
|
-
|
|
91636
|
-
|
|
91637
|
-
|
|
91638
|
-
|
|
91361
|
+
});
|
|
91362
|
+
if (filteredMatches.length === 0)
|
|
91363
|
+
return undefined;
|
|
91364
|
+
const parts = [];
|
|
91365
|
+
let lastIndex = 0;
|
|
91366
|
+
filteredMatches.forEach(({ isBold, isIntraword, marker, match }) => {
|
|
91367
|
+
const matchIndex = match.index ?? 0;
|
|
91368
|
+
const fullMatch = match[0];
|
|
91369
|
+
if (isIntraword) {
|
|
91370
|
+
// handles cases like hello_world_ where we only want to italicize 'world'
|
|
91371
|
+
const charBefore = match[1] || ''; // e.g., "l" in "hello_world_"
|
|
91372
|
+
const content = match[2]; // e.g., "world"
|
|
91373
|
+
const combinedBefore = text.slice(lastIndex, matchIndex) + charBefore;
|
|
91374
|
+
if (combinedBefore) {
|
|
91375
|
+
parts.push({ type: 'text', value: combinedBefore });
|
|
91376
|
+
}
|
|
91377
|
+
if (isBold) {
|
|
91378
|
+
parts.push({
|
|
91379
|
+
type: 'strong',
|
|
91380
|
+
children: [{ type: 'text', value: content }],
|
|
91381
|
+
});
|
|
91382
|
+
}
|
|
91383
|
+
else {
|
|
91384
|
+
parts.push({
|
|
91385
|
+
type: 'emphasis',
|
|
91386
|
+
children: [{ type: 'text', value: content }],
|
|
91387
|
+
});
|
|
91388
|
+
}
|
|
91389
|
+
lastIndex = matchIndex + fullMatch.length;
|
|
91390
|
+
return;
|
|
91639
91391
|
}
|
|
91640
|
-
|
|
91641
|
-
|
|
91642
|
-
|
|
91392
|
+
if (matchIndex > lastIndex) {
|
|
91393
|
+
const beforeText = text.slice(lastIndex, matchIndex);
|
|
91394
|
+
if (beforeText) {
|
|
91395
|
+
parts.push({ type: 'text', value: beforeText });
|
|
91396
|
+
}
|
|
91643
91397
|
}
|
|
91644
|
-
|
|
91645
|
-
|
|
91646
|
-
|
|
91647
|
-
|
|
91648
|
-
|
|
91649
|
-
|
|
91650
|
-
|
|
91651
|
-
|
|
91652
|
-
|
|
91653
|
-
|
|
91654
|
-
|
|
91655
|
-
|
|
91656
|
-
|
|
91657
|
-
|
|
91658
|
-
|
|
91659
|
-
|
|
91660
|
-
|
|
91661
|
-
|
|
91662
|
-
|
|
91663
|
-
|
|
91664
|
-
|
|
91665
|
-
|
|
91398
|
+
const wordBefore = match[1]; // e.g., "Hello" in "Hello** Wrong Bold**"
|
|
91399
|
+
const contentWithSpaceAfter = match[3]; // Content when there's a space after opening markers
|
|
91400
|
+
const trailingSpace1 = match[4] || ''; // Space before closing markers (for "** text **" pattern)
|
|
91401
|
+
const contentWithSpaceBefore = match[5]; // Content when there's only a space before closing markers
|
|
91402
|
+
const trailingSpace2 = match[6] || ''; // Space before closing markers (for "**text **" pattern)
|
|
91403
|
+
const trailingSpace = trailingSpace1 || trailingSpace2; // Combined trailing space
|
|
91404
|
+
const content = (contentWithSpaceAfter || contentWithSpaceBefore || '').trim();
|
|
91405
|
+
const afterChar = match[7]; // Character after closing markers (if any)
|
|
91406
|
+
const markerPos = fullMatch.indexOf(marker);
|
|
91407
|
+
const spacesBeforeMarkers = wordBefore
|
|
91408
|
+
? fullMatch.slice(wordBefore.length, markerPos)
|
|
91409
|
+
: fullMatch.slice(0, markerPos);
|
|
91410
|
+
const shouldAddSpace = !!contentWithSpaceAfter && !!wordBefore && !spacesBeforeMarkers;
|
|
91411
|
+
if (wordBefore) {
|
|
91412
|
+
const spacing = spacesBeforeMarkers + (shouldAddSpace ? ' ' : '');
|
|
91413
|
+
parts.push({ type: 'text', value: wordBefore + spacing });
|
|
91414
|
+
}
|
|
91415
|
+
else if (spacesBeforeMarkers) {
|
|
91416
|
+
parts.push({ type: 'text', value: spacesBeforeMarkers });
|
|
91417
|
+
}
|
|
91418
|
+
if (content) {
|
|
91419
|
+
if (isBold) {
|
|
91420
|
+
parts.push({
|
|
91421
|
+
type: 'strong',
|
|
91422
|
+
children: [{ type: 'text', value: content }],
|
|
91423
|
+
});
|
|
91424
|
+
}
|
|
91425
|
+
else {
|
|
91426
|
+
parts.push({
|
|
91427
|
+
type: 'emphasis',
|
|
91428
|
+
children: [{ type: 'text', value: content }],
|
|
91429
|
+
});
|
|
91430
|
+
}
|
|
91431
|
+
}
|
|
91432
|
+
if (afterChar) {
|
|
91433
|
+
const prefix = trailingSpace ? ' ' : '';
|
|
91434
|
+
parts.push({ type: 'text', value: prefix + afterChar });
|
|
91435
|
+
}
|
|
91436
|
+
lastIndex = matchIndex + fullMatch.length;
|
|
91666
91437
|
});
|
|
91667
|
-
|
|
91668
|
-
|
|
91669
|
-
|
|
91670
|
-
|
|
91671
|
-
|
|
91672
|
-
stack.push(componentNode);
|
|
91673
|
-
}
|
|
91674
|
-
// If the closing tag sibling had content after it (e.g., another component opening tag),
|
|
91675
|
-
// re-insert it as a sibling so it can be processed in subsequent iterations
|
|
91676
|
-
if (remainingAfterClose) {
|
|
91677
|
-
parseSibling(stack, parent, index, remainingAfterClose);
|
|
91438
|
+
if (lastIndex < text.length) {
|
|
91439
|
+
const remainingText = text.slice(lastIndex);
|
|
91440
|
+
if (remainingText) {
|
|
91441
|
+
parts.push({ type: 'text', value: remainingText });
|
|
91442
|
+
}
|
|
91678
91443
|
}
|
|
91679
|
-
|
|
91680
|
-
|
|
91681
|
-
|
|
91682
|
-
const parent = stack.pop();
|
|
91683
|
-
if (parent?.children) {
|
|
91684
|
-
parent.children.forEach((_child, index) => {
|
|
91685
|
-
processChildNode(parent, index);
|
|
91686
|
-
});
|
|
91444
|
+
if (parts.length > 0) {
|
|
91445
|
+
parent.children.splice(index, 1, ...parts);
|
|
91446
|
+
return [SKIP, index + parts.length];
|
|
91687
91447
|
}
|
|
91688
|
-
|
|
91448
|
+
return undefined;
|
|
91449
|
+
});
|
|
91450
|
+
// Handle malformed emphasis spanning multiple nodes (e.g., **text [link](url) **)
|
|
91451
|
+
visitMultiNodeEmphasis(tree);
|
|
91689
91452
|
return tree;
|
|
91690
91453
|
};
|
|
91691
|
-
/* harmony default export */ const
|
|
91454
|
+
/* harmony default export */ const normalize_malformed_md_syntax = (normalizeEmphasisAST);
|
|
91692
91455
|
|
|
91693
91456
|
;// ./processor/transform/mdxish/mdxish-tables.ts
|
|
91694
91457
|
|
|
@@ -91699,14 +91462,21 @@ const mdxishComponentBlocks = () => tree => {
|
|
|
91699
91462
|
|
|
91700
91463
|
|
|
91701
91464
|
|
|
91465
|
+
|
|
91466
|
+
|
|
91467
|
+
|
|
91702
91468
|
const isTableCell = (node) => isMDXElement(node) && ['th', 'td'].includes(node.name);
|
|
91703
91469
|
const tableTypes = {
|
|
91704
91470
|
tr: 'tableRow',
|
|
91705
91471
|
th: 'tableCell',
|
|
91706
91472
|
td: 'tableCell',
|
|
91707
91473
|
};
|
|
91708
|
-
const
|
|
91709
|
-
|
|
91474
|
+
const tableNodeProcessor = unified()
|
|
91475
|
+
.use(remarkParse)
|
|
91476
|
+
.use(remarkMdx)
|
|
91477
|
+
.use(normalize_malformed_md_syntax)
|
|
91478
|
+
.use([callouts, gemoji_])
|
|
91479
|
+
.use(remarkGfm);
|
|
91710
91480
|
/**
|
|
91711
91481
|
* Check if children are only text nodes that might contain markdown
|
|
91712
91482
|
*/
|
|
@@ -91736,14 +91506,14 @@ const extractTextFromChildren = (children) => {
|
|
|
91736
91506
|
.join('');
|
|
91737
91507
|
};
|
|
91738
91508
|
/**
|
|
91739
|
-
*
|
|
91509
|
+
* Returns true if any node in the array is block-level (non-phrasing) content.
|
|
91740
91510
|
*/
|
|
91741
|
-
const
|
|
91742
|
-
|
|
91743
|
-
return (tree.children || []);
|
|
91511
|
+
const hasFlowContent = (nodes) => {
|
|
91512
|
+
return nodes.some(node => !phrasing(node) && node.type !== 'paragraph');
|
|
91744
91513
|
};
|
|
91745
91514
|
/**
|
|
91746
|
-
* Process a Table node
|
|
91515
|
+
* Process a Table node: re-parse text-only cell content, then output as
|
|
91516
|
+
* a markdown table (phrasing-only) or keep as JSX <Table> (has flow content).
|
|
91747
91517
|
*/
|
|
91748
91518
|
const processTableNode = (node, index, parent) => {
|
|
91749
91519
|
if (node.name !== 'Table')
|
|
@@ -91751,54 +91521,88 @@ const processTableNode = (node, index, parent) => {
|
|
|
91751
91521
|
const { position } = node;
|
|
91752
91522
|
const { align: alignAttr } = getAttrs(node);
|
|
91753
91523
|
const align = Array.isArray(alignAttr) ? alignAttr : null;
|
|
91754
|
-
|
|
91755
|
-
//
|
|
91756
|
-
|
|
91757
|
-
|
|
91758
|
-
|
|
91759
|
-
|
|
91760
|
-
|
|
91761
|
-
|
|
91762
|
-
|
|
91763
|
-
|
|
91764
|
-
|
|
91765
|
-
|
|
91766
|
-
|
|
91767
|
-
|
|
91768
|
-
|
|
91769
|
-
|
|
91770
|
-
|
|
91771
|
-
if (parsedNode.type === 'paragraph' && 'children' in parsedNode && parsedNode.children) {
|
|
91772
|
-
return parsedNode.children;
|
|
91773
|
-
}
|
|
91774
|
-
return [parsedNode];
|
|
91775
|
-
});
|
|
91776
|
-
}
|
|
91777
|
-
}
|
|
91778
|
-
catch {
|
|
91779
|
-
// If parsing fails, keep original children
|
|
91780
|
-
}
|
|
91524
|
+
let tableHasFlowContent = false;
|
|
91525
|
+
// Re-parse text-only cells through markdown and detect flow content
|
|
91526
|
+
visit(node, isTableCell, (cell) => {
|
|
91527
|
+
if (!isTextOnly(cell.children))
|
|
91528
|
+
return;
|
|
91529
|
+
const textContent = extractTextFromChildren(cell.children);
|
|
91530
|
+
if (!textContent.trim())
|
|
91531
|
+
return;
|
|
91532
|
+
// Since now we are using remarkMdx, which can fail and error, we need to
|
|
91533
|
+
// gate this behind a try/catch to ensure that malformed syntaxes do not
|
|
91534
|
+
// crash the page
|
|
91535
|
+
try {
|
|
91536
|
+
const parsed = tableNodeProcessor.runSync(tableNodeProcessor.parse(textContent));
|
|
91537
|
+
if (parsed.children.length > 0) {
|
|
91538
|
+
cell.children = parsed.children;
|
|
91539
|
+
if (hasFlowContent(parsed.children)) {
|
|
91540
|
+
tableHasFlowContent = true;
|
|
91781
91541
|
}
|
|
91782
91542
|
}
|
|
91783
|
-
|
|
91784
|
-
|
|
91785
|
-
|
|
91786
|
-
|
|
91787
|
-
|
|
91788
|
-
|
|
91789
|
-
|
|
91790
|
-
|
|
91791
|
-
|
|
91792
|
-
|
|
91543
|
+
}
|
|
91544
|
+
catch {
|
|
91545
|
+
// If parsing fails, keep original children
|
|
91546
|
+
}
|
|
91547
|
+
});
|
|
91548
|
+
// mdast's table node always treats the first tableRow as <thead>, so we can't
|
|
91549
|
+
// represent a header-less table in mdast without the first body row getting
|
|
91550
|
+
// promoted. Keep as JSX instead so remarkRehype renders it correctly
|
|
91551
|
+
let hasThead = false;
|
|
91552
|
+
visit(node, isMDXElement, (child) => {
|
|
91553
|
+
if (child.name === 'thead')
|
|
91554
|
+
hasThead = true;
|
|
91555
|
+
});
|
|
91556
|
+
if (tableHasFlowContent || !hasThead) {
|
|
91557
|
+
// remarkMdx wraps inline elements in paragraph nodes (e.g. <td> on the
|
|
91558
|
+
// same line as content becomes mdxJsxTextElement inside a paragraph).
|
|
91559
|
+
// Unwrap these so <td>/<th> sit directly under <tr>, and strip
|
|
91560
|
+
// whitespace-only text nodes to avoid rendering empty <p>/<br>.
|
|
91561
|
+
const cleanChildren = (children) => children
|
|
91562
|
+
.flatMap(child => {
|
|
91563
|
+
if (child.type === 'paragraph' && 'children' in child && Array.isArray(child.children)) {
|
|
91564
|
+
return child.children;
|
|
91565
|
+
}
|
|
91566
|
+
return [child];
|
|
91567
|
+
})
|
|
91568
|
+
.filter(child => !(child.type === 'text' && 'value' in child && typeof child.value === 'string' && !child.value.trim()));
|
|
91569
|
+
visit(node, isMDXElement, (el) => {
|
|
91570
|
+
if ('children' in el && Array.isArray(el.children)) {
|
|
91571
|
+
el.children = cleanChildren(el.children);
|
|
91572
|
+
}
|
|
91793
91573
|
});
|
|
91794
|
-
|
|
91795
|
-
|
|
91574
|
+
parent.children[index] = {
|
|
91575
|
+
...node,
|
|
91576
|
+
position,
|
|
91577
|
+
};
|
|
91578
|
+
return;
|
|
91579
|
+
}
|
|
91580
|
+
// All cells are phrasing-only — convert to markdown table
|
|
91581
|
+
const children = [];
|
|
91796
91582
|
visit(node, isMDXElement, (child) => {
|
|
91797
91583
|
if (child.name === 'thead' || child.name === 'tbody') {
|
|
91798
91584
|
visit(child, isMDXElement, (row) => {
|
|
91799
|
-
if (row.name
|
|
91800
|
-
|
|
91801
|
-
|
|
91585
|
+
if (row.name !== 'tr')
|
|
91586
|
+
return;
|
|
91587
|
+
const rowChildren = [];
|
|
91588
|
+
visit(row, isTableCell, ({ name, children: cellChildren, position: cellPosition }) => {
|
|
91589
|
+
const parsedChildren = cellChildren.flatMap(parsedNode => {
|
|
91590
|
+
if (parsedNode.type === 'paragraph' && 'children' in parsedNode && parsedNode.children) {
|
|
91591
|
+
return parsedNode.children;
|
|
91592
|
+
}
|
|
91593
|
+
return [parsedNode];
|
|
91594
|
+
});
|
|
91595
|
+
rowChildren.push({
|
|
91596
|
+
type: tableTypes[name],
|
|
91597
|
+
children: parsedChildren,
|
|
91598
|
+
position: cellPosition,
|
|
91599
|
+
});
|
|
91600
|
+
});
|
|
91601
|
+
children.push({
|
|
91602
|
+
type: 'tableRow',
|
|
91603
|
+
children: rowChildren,
|
|
91604
|
+
position: row.position,
|
|
91605
|
+
});
|
|
91802
91606
|
});
|
|
91803
91607
|
}
|
|
91804
91608
|
});
|
|
@@ -91818,54 +91622,35 @@ const processTableNode = (node, index, parent) => {
|
|
|
91818
91622
|
/**
|
|
91819
91623
|
* Converts JSX Table elements to markdown table nodes and re-parses markdown in cells.
|
|
91820
91624
|
*
|
|
91821
|
-
*
|
|
91822
|
-
*
|
|
91625
|
+
* The jsxTable micromark tokenizer captures `<Table>...</Table>` as a single html node,
|
|
91626
|
+
* preventing CommonMark HTML block type 6 from fragmenting it at blank lines. This
|
|
91627
|
+
* transformer then re-parses the html node with remarkMdx to produce proper JSX AST nodes
|
|
91628
|
+
* and converts them to MDAST table/tableRow/tableCell nodes.
|
|
91629
|
+
*
|
|
91630
|
+
* When cell content contains block-level nodes (callouts, code blocks, etc.), the table
|
|
91631
|
+
* is kept as a JSX <Table> element so that remarkRehype can properly handle the flow content.
|
|
91823
91632
|
*/
|
|
91824
91633
|
const mdxishTables = () => tree => {
|
|
91825
|
-
|
|
91826
|
-
|
|
91827
|
-
if (node.name === 'Table') {
|
|
91828
|
-
processTableNode(node, index, parent);
|
|
91829
|
-
return SKIP;
|
|
91830
|
-
}
|
|
91831
|
-
});
|
|
91832
|
-
// Also handle HTML and raw nodes that contain Table tags (in case mdxishComponentBlocks didn't convert them)
|
|
91833
|
-
// This happens when the entire <Table>...</Table> block is in a single HTML node, which mdxishComponentBlocks
|
|
91834
|
-
// doesn't handle (it only handles split nodes: opening tag, content paragraph, closing tag)
|
|
91835
|
-
const handleTableInNode = (node, index, parent) => {
|
|
91634
|
+
visit(tree, 'html', (_node, index, parent) => {
|
|
91635
|
+
const node = _node;
|
|
91836
91636
|
if (typeof index !== 'number' || !parent || !('children' in parent))
|
|
91837
91637
|
return;
|
|
91838
|
-
if (
|
|
91839
|
-
return;
|
|
91840
|
-
if (!node.value.includes('<Table') || !node.value.includes('</Table>'))
|
|
91638
|
+
if (!node.value.startsWith('<Table'))
|
|
91841
91639
|
return;
|
|
91842
91640
|
try {
|
|
91843
|
-
// Parse the HTML content with remarkMdx and mdxishComponentBlocks to convert it to MDX JSX elements
|
|
91844
|
-
// This creates a proper AST that we can then process
|
|
91845
91641
|
const parsed = tableNodeProcessor.runSync(tableNodeProcessor.parse(node.value));
|
|
91846
|
-
// Find the Table element in the parsed result and process it
|
|
91847
91642
|
visit(parsed, isMDXElement, (tableNode) => {
|
|
91848
91643
|
if (tableNode.name === 'Table') {
|
|
91849
|
-
// Process the table and replace the HTML node with a markdown table node
|
|
91850
91644
|
processTableNode(tableNode, index, parent);
|
|
91645
|
+
// Stop after the outermost Table so nested Tables don't overwrite parent.children[index]
|
|
91646
|
+
// we let it get handled naturally
|
|
91647
|
+
return EXIT;
|
|
91851
91648
|
}
|
|
91852
91649
|
});
|
|
91853
91650
|
}
|
|
91854
91651
|
catch {
|
|
91855
91652
|
// If parsing fails, leave the node as-is
|
|
91856
91653
|
}
|
|
91857
|
-
};
|
|
91858
|
-
// Handle HTML nodes (created by remark-parse for HTML blocks)
|
|
91859
|
-
visit(tree, 'html', (node, index, parent) => {
|
|
91860
|
-
if (typeof index === 'number' && parent && 'children' in parent) {
|
|
91861
|
-
handleTableInNode(node, index, parent);
|
|
91862
|
-
}
|
|
91863
|
-
});
|
|
91864
|
-
// Handle raw nodes (created by remark-parse for certain HTML structures)
|
|
91865
|
-
visit(tree, 'raw', (node, index, parent) => {
|
|
91866
|
-
if (typeof index === 'number' && parent && 'children' in parent) {
|
|
91867
|
-
handleTableInNode(node, index, parent);
|
|
91868
|
-
}
|
|
91869
91654
|
});
|
|
91870
91655
|
return tree;
|
|
91871
91656
|
};
|
|
@@ -112361,10 +112146,6 @@ const compile_list_item_listItem = (node, parent, state, info) => {
|
|
|
112361
112146
|
const plain_plain = (node) => node.value;
|
|
112362
112147
|
/* harmony default export */ const compile_plain = (plain_plain);
|
|
112363
112148
|
|
|
112364
|
-
;// ./processor/compile/variable.ts
|
|
112365
|
-
const variable = (node) => `{user.${node.data?.hProperties?.name || ''}}`;
|
|
112366
|
-
/* harmony default export */ const compile_variable = (variable);
|
|
112367
|
-
|
|
112368
112149
|
;// ./processor/compile/index.ts
|
|
112369
112150
|
|
|
112370
112151
|
|
|
@@ -114488,10 +114269,14 @@ function extractBalancedBraces(content, start) {
|
|
|
114488
114269
|
return { content: content.slice(start, pos - 1), end: pos };
|
|
114489
114270
|
}
|
|
114490
114271
|
/**
|
|
114491
|
-
* Escapes
|
|
114492
|
-
* Handles
|
|
114272
|
+
* Escapes problematic braces in content to prevent MDX expression parsing errors.
|
|
114273
|
+
* Handles three cases:
|
|
114274
|
+
* 1. Unbalanced braces (e.g., `{foo` without closing `}`)
|
|
114275
|
+
* 2. Paragraph-spanning expressions (e.g., `{\n\n}` where blank line splits paragraphs)
|
|
114276
|
+
* 3. Skips HTML elements to prevent backslashes appearing in output
|
|
114277
|
+
*
|
|
114493
114278
|
*/
|
|
114494
|
-
function
|
|
114279
|
+
function escapeProblematicBraces(content) {
|
|
114495
114280
|
// Skip HTML elements — their content should never be escaped because
|
|
114496
114281
|
// rehypeRaw parses them into hast elements, making `\` literal text in output
|
|
114497
114282
|
const htmlElements = [];
|
|
@@ -114500,16 +114285,19 @@ function escapeUnbalancedBraces(content) {
|
|
|
114500
114285
|
htmlElements.push(match);
|
|
114501
114286
|
return `___HTML_ELEM_${idx}___`;
|
|
114502
114287
|
});
|
|
114503
|
-
const
|
|
114504
|
-
const unbalanced = new Set();
|
|
114505
|
-
let strDelim = null;
|
|
114506
|
-
let strEscaped = false;
|
|
114288
|
+
const toEscape = new Set();
|
|
114507
114289
|
// Convert to array of Unicode code points to handle emojis and multi-byte characters correctly
|
|
114508
114290
|
const chars = Array.from(safe);
|
|
114291
|
+
let strDelim = null;
|
|
114292
|
+
let strEscaped = false;
|
|
114293
|
+
// Stack of open braces with their state
|
|
114294
|
+
const openStack = [];
|
|
114295
|
+
// Track position of last newline (outside strings) to detect blank lines
|
|
114296
|
+
let lastNewlinePos = -2; // -2 means no recent newline
|
|
114509
114297
|
for (let i = 0; i < chars.length; i += 1) {
|
|
114510
114298
|
const ch = chars[i];
|
|
114511
|
-
// Track
|
|
114512
|
-
if (
|
|
114299
|
+
// Track string delimiters inside expressions to ignore braces within them
|
|
114300
|
+
if (openStack.length > 0) {
|
|
114513
114301
|
if (strDelim) {
|
|
114514
114302
|
if (strEscaped)
|
|
114515
114303
|
strEscaped = false;
|
|
@@ -114525,6 +114313,20 @@ function escapeUnbalancedBraces(content) {
|
|
|
114525
114313
|
// eslint-disable-next-line no-continue
|
|
114526
114314
|
continue;
|
|
114527
114315
|
}
|
|
114316
|
+
// Track newlines to detect blank lines (paragraph boundaries)
|
|
114317
|
+
if (ch === '\n') {
|
|
114318
|
+
// Check if this newline creates a blank line (only whitespace since last newline)
|
|
114319
|
+
if (lastNewlinePos >= 0) {
|
|
114320
|
+
const between = chars.slice(lastNewlinePos + 1, i).join('');
|
|
114321
|
+
if (/^[ \t]*$/.test(between)) {
|
|
114322
|
+
// This is a blank line - mark all open expressions as paragraph-spanning
|
|
114323
|
+
openStack.forEach(entry => {
|
|
114324
|
+
entry.hasBlankLine = true;
|
|
114325
|
+
});
|
|
114326
|
+
}
|
|
114327
|
+
}
|
|
114328
|
+
lastNewlinePos = i;
|
|
114329
|
+
}
|
|
114528
114330
|
}
|
|
114529
114331
|
// Skip already-escaped braces (count preceding backslashes)
|
|
114530
114332
|
if (ch === '{' || ch === '}') {
|
|
@@ -114536,21 +114338,33 @@ function escapeUnbalancedBraces(content) {
|
|
|
114536
114338
|
continue;
|
|
114537
114339
|
}
|
|
114538
114340
|
}
|
|
114539
|
-
if (ch === '{')
|
|
114540
|
-
|
|
114341
|
+
if (ch === '{') {
|
|
114342
|
+
openStack.push({ pos: i, hasBlankLine: false });
|
|
114343
|
+
lastNewlinePos = -2; // Reset newline tracking for new expression
|
|
114344
|
+
}
|
|
114541
114345
|
else if (ch === '}') {
|
|
114542
|
-
if (
|
|
114543
|
-
|
|
114544
|
-
|
|
114545
|
-
|
|
114346
|
+
if (openStack.length > 0) {
|
|
114347
|
+
const entry = openStack.pop();
|
|
114348
|
+
// If expression spans paragraph boundary, escape both braces
|
|
114349
|
+
if (entry.hasBlankLine) {
|
|
114350
|
+
toEscape.add(entry.pos);
|
|
114351
|
+
toEscape.add(i);
|
|
114352
|
+
}
|
|
114353
|
+
}
|
|
114354
|
+
else {
|
|
114355
|
+
// Unbalanced closing brace (no matching open)
|
|
114356
|
+
toEscape.add(i);
|
|
114357
|
+
}
|
|
114546
114358
|
}
|
|
114547
114359
|
}
|
|
114548
|
-
|
|
114549
|
-
|
|
114550
|
-
//
|
|
114551
|
-
|
|
114360
|
+
// Any remaining open braces are unbalanced
|
|
114361
|
+
openStack.forEach(entry => toEscape.add(entry.pos));
|
|
114362
|
+
// If there are no problematic braces, return safe content as-is;
|
|
114363
|
+
// otherwise, escape each problematic `{` or `}` so MDX doesn't treat them as expressions.
|
|
114364
|
+
let result = toEscape.size === 0
|
|
114552
114365
|
? safe
|
|
114553
|
-
: chars.map((ch, i) => (
|
|
114366
|
+
: chars.map((ch, i) => (toEscape.has(i) ? `\\${ch}` : ch)).join('');
|
|
114367
|
+
// Restore HTML elements
|
|
114554
114368
|
if (htmlElements.length > 0) {
|
|
114555
114369
|
result = result.replace(/___HTML_ELEM_(\d+)___/g, (_m, idx) => htmlElements[parseInt(idx, 10)]);
|
|
114556
114370
|
}
|
|
@@ -114648,8 +114462,9 @@ function preprocessJSXExpressions(content, context = {}) {
|
|
|
114648
114462
|
// For inline expressions, we use a library to parse the expression & evaluate it later
|
|
114649
114463
|
// For attribute expressions, it was difficult to use a library to parse them, so do it manually
|
|
114650
114464
|
processed = evaluateAttributeExpressions(protectedContent, context, protectedCode);
|
|
114651
|
-
// Step 3: Escape
|
|
114652
|
-
|
|
114465
|
+
// Step 3: Escape problematic braces to prevent MDX expression parsing errors
|
|
114466
|
+
// This handles both unbalanced braces and paragraph-spanning expressions in one pass
|
|
114467
|
+
processed = escapeProblematicBraces(processed);
|
|
114653
114468
|
// Step 4: Restore protected code blocks
|
|
114654
114469
|
processed = restoreCodeBlocks(processed, protectedCode);
|
|
114655
114470
|
return processed;
|
|
@@ -114709,110 +114524,468 @@ const evaluateExpressions = ({ context = {} } = {}) => tree => {
|
|
|
114709
114524
|
};
|
|
114710
114525
|
/* harmony default export */ const evaluate_expressions = (evaluateExpressions);
|
|
114711
114526
|
|
|
114712
|
-
;// ./processor/transform/mdxish/heading-slugs.ts
|
|
114527
|
+
;// ./processor/transform/mdxish/heading-slugs.ts
|
|
114528
|
+
|
|
114529
|
+
|
|
114530
|
+
function isHeading(node) {
|
|
114531
|
+
return /^h[1-6]$/.test(node.tagName);
|
|
114532
|
+
}
|
|
114533
|
+
function textContent(node) {
|
|
114534
|
+
if (node.type === 'text')
|
|
114535
|
+
return node.value;
|
|
114536
|
+
// Process variable nodes by using their variable name for the id generation
|
|
114537
|
+
if (node.type === 'element' && node.tagName === 'variable' && node.properties?.name) {
|
|
114538
|
+
if (node.properties.isLegacy) {
|
|
114539
|
+
return node.properties.name;
|
|
114540
|
+
}
|
|
114541
|
+
return `user.${node.properties.name}`;
|
|
114542
|
+
}
|
|
114543
|
+
if ('children' in node)
|
|
114544
|
+
return node.children.map(textContent).join('');
|
|
114545
|
+
return '';
|
|
114546
|
+
}
|
|
114547
|
+
/**
|
|
114548
|
+
* Rehype plugin that constructs ids for headings
|
|
114549
|
+
* Id's are used to construct slug anchor links & Table of Contents during rendering
|
|
114550
|
+
* Use the text / nodes that make up the heading to generate the id
|
|
114551
|
+
*/
|
|
114552
|
+
const generateSlugForHeadings = () => (tree) => {
|
|
114553
|
+
const slugger = new BananaSlug();
|
|
114554
|
+
visit(tree, 'element', (node) => {
|
|
114555
|
+
if (isHeading(node) && !node.properties.id) {
|
|
114556
|
+
const text = node.children.map(textContent).join('');
|
|
114557
|
+
node.properties.id = slugger.slug(text);
|
|
114558
|
+
}
|
|
114559
|
+
});
|
|
114560
|
+
return tree;
|
|
114561
|
+
};
|
|
114562
|
+
/* harmony default export */ const heading_slugs = (generateSlugForHeadings);
|
|
114563
|
+
|
|
114564
|
+
// EXTERNAL MODULE: ./node_modules/@readme/variable/dist/index.js
|
|
114565
|
+
var variable_dist = __webpack_require__(4355);
|
|
114566
|
+
var variable_dist_default = /*#__PURE__*/__webpack_require__.n(variable_dist);
|
|
114567
|
+
;// ./node_modules/rehype-parse/lib/index.js
|
|
114568
|
+
/**
|
|
114569
|
+
* @import {Root} from 'hast'
|
|
114570
|
+
* @import {Options as FromHtmlOptions} from 'hast-util-from-html'
|
|
114571
|
+
* @import {Parser, Processor} from 'unified'
|
|
114572
|
+
*/
|
|
114573
|
+
|
|
114574
|
+
/**
|
|
114575
|
+
* @typedef {Omit<FromHtmlOptions, 'onerror'> & RehypeParseFields} Options
|
|
114576
|
+
* Configuration.
|
|
114577
|
+
*
|
|
114578
|
+
* @typedef RehypeParseFields
|
|
114579
|
+
* Extra fields.
|
|
114580
|
+
* @property {boolean | null | undefined} [emitParseErrors=false]
|
|
114581
|
+
* Whether to emit parse errors while parsing (default: `false`).
|
|
114582
|
+
*
|
|
114583
|
+
* > 👉 **Note**: parse errors are currently being added to HTML.
|
|
114584
|
+
* > Not all errors emitted by parse5 (or us) are specced yet.
|
|
114585
|
+
* > Some documentation may still be missing.
|
|
114586
|
+
*/
|
|
114587
|
+
|
|
114588
|
+
|
|
114589
|
+
|
|
114590
|
+
/**
|
|
114591
|
+
* Plugin to add support for parsing from HTML.
|
|
114592
|
+
*
|
|
114593
|
+
* > 👉 **Note**: this is not an XML parser.
|
|
114594
|
+
* > It supports SVG as embedded in HTML.
|
|
114595
|
+
* > It does not support the features available in XML.
|
|
114596
|
+
* > Passing SVG files might break but fragments of modern SVG should be fine.
|
|
114597
|
+
* > Use [`xast-util-from-xml`][xast-util-from-xml] to parse XML.
|
|
114598
|
+
*
|
|
114599
|
+
* @param {Options | null | undefined} [options]
|
|
114600
|
+
* Configuration (optional).
|
|
114601
|
+
* @returns {undefined}
|
|
114602
|
+
* Nothing.
|
|
114603
|
+
*/
|
|
114604
|
+
function rehypeParse(options) {
|
|
114605
|
+
/** @type {Processor<Root>} */
|
|
114606
|
+
// @ts-expect-error: TS in JSDoc generates wrong types if `this` is typed regularly.
|
|
114607
|
+
const self = this
|
|
114608
|
+
const {emitParseErrors, ...settings} = {...self.data('settings'), ...options}
|
|
114609
|
+
|
|
114610
|
+
self.parser = parser
|
|
114611
|
+
|
|
114612
|
+
/**
|
|
114613
|
+
* @type {Parser<Root>}
|
|
114614
|
+
*/
|
|
114615
|
+
function parser(document, file) {
|
|
114616
|
+
return fromHtml(document, {
|
|
114617
|
+
...settings,
|
|
114618
|
+
onerror: emitParseErrors
|
|
114619
|
+
? function (message) {
|
|
114620
|
+
if (file.path) {
|
|
114621
|
+
message.name = file.path + ':' + message.name
|
|
114622
|
+
message.file = file.path
|
|
114623
|
+
}
|
|
114624
|
+
|
|
114625
|
+
file.messages.push(message)
|
|
114626
|
+
}
|
|
114627
|
+
: undefined
|
|
114628
|
+
})
|
|
114629
|
+
}
|
|
114630
|
+
}
|
|
114631
|
+
|
|
114632
|
+
;// ./lib/mdast-util/empty-task-list-item/index.ts
|
|
114633
|
+
/**
|
|
114634
|
+
* Normalizes list items that are written as only `[ ]` or `[x]` into GFM task
|
|
114635
|
+
* list items during parse, but only when at least one whitespace character
|
|
114636
|
+
* follows the closing bracket (`]`). This matches legacy behaviour for checkboxes
|
|
114637
|
+
*
|
|
114638
|
+
* The issue is `remark-gfm` does not actually classify these as task items when they have no content
|
|
114639
|
+
* after the checkbox, which leaves them as plain text (`"[ ]"`). So a custom extension is needed to
|
|
114640
|
+
* treat these as task items
|
|
114641
|
+
*/
|
|
114642
|
+
function exitListItemWithEmptyTaskListItem(token) {
|
|
114643
|
+
const node = this.stack[this.stack.length - 1];
|
|
114644
|
+
if (node &&
|
|
114645
|
+
node.type === 'listItem' &&
|
|
114646
|
+
typeof node.checked !== 'boolean') {
|
|
114647
|
+
const listItem = node;
|
|
114648
|
+
const head = listItem.children[0];
|
|
114649
|
+
if (head && head.type === 'paragraph' && head.children.length === 1) {
|
|
114650
|
+
const text = head.children[0];
|
|
114651
|
+
if (text.type === 'text') {
|
|
114652
|
+
const hasTrailingWhitespace = typeof head.position?.end.offset === 'number' &&
|
|
114653
|
+
typeof text.position?.end.offset === 'number' &&
|
|
114654
|
+
head.position.end.offset > text.position.end.offset;
|
|
114655
|
+
if (!hasTrailingWhitespace) {
|
|
114656
|
+
this.exit(token);
|
|
114657
|
+
return;
|
|
114658
|
+
}
|
|
114659
|
+
const value = text.value;
|
|
114660
|
+
if (value === '[ ]') {
|
|
114661
|
+
listItem.checked = false;
|
|
114662
|
+
head.children = [];
|
|
114663
|
+
}
|
|
114664
|
+
else if (value === '[x]' || value === '[X]') {
|
|
114665
|
+
listItem.checked = true;
|
|
114666
|
+
head.children = [];
|
|
114667
|
+
}
|
|
114668
|
+
}
|
|
114669
|
+
}
|
|
114670
|
+
}
|
|
114671
|
+
this.exit(token);
|
|
114672
|
+
}
|
|
114673
|
+
function emptyTaskListItemFromMarkdown() {
|
|
114674
|
+
return {
|
|
114675
|
+
exit: {
|
|
114676
|
+
listItem: exitListItemWithEmptyTaskListItem,
|
|
114677
|
+
},
|
|
114678
|
+
};
|
|
114679
|
+
}
|
|
114680
|
+
|
|
114681
|
+
;// ./lib/mdast-util/legacy-variable/index.ts
|
|
114682
|
+
|
|
114683
|
+
const contextMap = new WeakMap();
|
|
114684
|
+
function findlegacyVariableToken() {
|
|
114685
|
+
// tokenStack is micromark's current open token ancestry; find the nearest legacyVariable token.
|
|
114686
|
+
const events = this.tokenStack;
|
|
114687
|
+
for (let i = events.length - 1; i >= 0; i -= 1) {
|
|
114688
|
+
const token = events[i][0];
|
|
114689
|
+
if (token.type === 'legacyVariable')
|
|
114690
|
+
return token;
|
|
114691
|
+
}
|
|
114692
|
+
return undefined;
|
|
114693
|
+
}
|
|
114694
|
+
function enterlegacyVariable(token) {
|
|
114695
|
+
contextMap.set(token, { value: '' });
|
|
114696
|
+
}
|
|
114697
|
+
function exitlegacyVariableValue(token) {
|
|
114698
|
+
const variableToken = findlegacyVariableToken.call(this);
|
|
114699
|
+
if (!variableToken)
|
|
114700
|
+
return;
|
|
114701
|
+
const ctx = contextMap.get(variableToken);
|
|
114702
|
+
// Build up the variable characters
|
|
114703
|
+
if (ctx)
|
|
114704
|
+
ctx.value += this.sliceSerialize(token);
|
|
114705
|
+
}
|
|
114706
|
+
function exitlegacyVariable(token) {
|
|
114707
|
+
const ctx = contextMap.get(token);
|
|
114708
|
+
const serialized = this.sliceSerialize(token);
|
|
114709
|
+
const variableName = serialized.startsWith('<<') && serialized.endsWith('>>')
|
|
114710
|
+
? serialized.slice(2, -2)
|
|
114711
|
+
: ctx?.value ?? '';
|
|
114712
|
+
const nodePosition = {
|
|
114713
|
+
start: {
|
|
114714
|
+
offset: token.start.offset,
|
|
114715
|
+
line: token.start.line,
|
|
114716
|
+
column: token.start.column,
|
|
114717
|
+
},
|
|
114718
|
+
end: {
|
|
114719
|
+
offset: token.end.offset,
|
|
114720
|
+
line: token.end.line,
|
|
114721
|
+
column: token.end.column,
|
|
114722
|
+
},
|
|
114723
|
+
};
|
|
114724
|
+
if (variableName.startsWith('glossary:')) {
|
|
114725
|
+
const term = variableName.slice('glossary:'.length).trim();
|
|
114726
|
+
this.enter({
|
|
114727
|
+
type: NodeTypes.glossary,
|
|
114728
|
+
data: {
|
|
114729
|
+
hName: 'Glossary',
|
|
114730
|
+
hProperties: { term },
|
|
114731
|
+
},
|
|
114732
|
+
children: [{ type: 'text', value: term }],
|
|
114733
|
+
position: nodePosition,
|
|
114734
|
+
}, token);
|
|
114735
|
+
this.exit(token);
|
|
114736
|
+
contextMap.delete(token);
|
|
114737
|
+
return;
|
|
114738
|
+
}
|
|
114739
|
+
this.enter({
|
|
114740
|
+
type: NodeTypes.variable,
|
|
114741
|
+
data: {
|
|
114742
|
+
hName: 'Variable',
|
|
114743
|
+
hProperties: { name: variableName.trim(), isLegacy: true },
|
|
114744
|
+
},
|
|
114745
|
+
value: `<<${variableName}>>`,
|
|
114746
|
+
}, token);
|
|
114747
|
+
this.exit(token);
|
|
114748
|
+
contextMap.delete(token);
|
|
114749
|
+
}
|
|
114750
|
+
function legacyVariableFromMarkdown() {
|
|
114751
|
+
return {
|
|
114752
|
+
enter: {
|
|
114753
|
+
legacyVariable: enterlegacyVariable,
|
|
114754
|
+
},
|
|
114755
|
+
exit: {
|
|
114756
|
+
legacyVariableValue: exitlegacyVariableValue,
|
|
114757
|
+
legacyVariable: exitlegacyVariable,
|
|
114758
|
+
},
|
|
114759
|
+
};
|
|
114760
|
+
}
|
|
114761
|
+
|
|
114762
|
+
;// ./node_modules/micromark-util-symbol/lib/codes.js
|
|
114763
|
+
/**
|
|
114764
|
+
* Character codes.
|
|
114765
|
+
*
|
|
114766
|
+
* This module is compiled away!
|
|
114767
|
+
*
|
|
114768
|
+
* micromark works based on character codes.
|
|
114769
|
+
* This module contains constants for the ASCII block and the replacement
|
|
114770
|
+
* character.
|
|
114771
|
+
* A couple of them are handled in a special way, such as the line endings
|
|
114772
|
+
* (CR, LF, and CR+LF, commonly known as end-of-line: EOLs), the tab (horizontal
|
|
114773
|
+
* tab) and its expansion based on what column it’s at (virtual space),
|
|
114774
|
+
* and the end-of-file (eof) character.
|
|
114775
|
+
* As values are preprocessed before handling them, the actual characters LF,
|
|
114776
|
+
* CR, HT, and NUL (which is present as the replacement character), are
|
|
114777
|
+
* guaranteed to not exist.
|
|
114778
|
+
*
|
|
114779
|
+
* Unicode basic latin block.
|
|
114780
|
+
*/
|
|
114781
|
+
const codes = /** @type {const} */ ({
|
|
114782
|
+
carriageReturn: -5,
|
|
114783
|
+
lineFeed: -4,
|
|
114784
|
+
carriageReturnLineFeed: -3,
|
|
114785
|
+
horizontalTab: -2,
|
|
114786
|
+
virtualSpace: -1,
|
|
114787
|
+
eof: null,
|
|
114788
|
+
nul: 0,
|
|
114789
|
+
soh: 1,
|
|
114790
|
+
stx: 2,
|
|
114791
|
+
etx: 3,
|
|
114792
|
+
eot: 4,
|
|
114793
|
+
enq: 5,
|
|
114794
|
+
ack: 6,
|
|
114795
|
+
bel: 7,
|
|
114796
|
+
bs: 8,
|
|
114797
|
+
ht: 9, // `\t`
|
|
114798
|
+
lf: 10, // `\n`
|
|
114799
|
+
vt: 11, // `\v`
|
|
114800
|
+
ff: 12, // `\f`
|
|
114801
|
+
cr: 13, // `\r`
|
|
114802
|
+
so: 14,
|
|
114803
|
+
si: 15,
|
|
114804
|
+
dle: 16,
|
|
114805
|
+
dc1: 17,
|
|
114806
|
+
dc2: 18,
|
|
114807
|
+
dc3: 19,
|
|
114808
|
+
dc4: 20,
|
|
114809
|
+
nak: 21,
|
|
114810
|
+
syn: 22,
|
|
114811
|
+
etb: 23,
|
|
114812
|
+
can: 24,
|
|
114813
|
+
em: 25,
|
|
114814
|
+
sub: 26,
|
|
114815
|
+
esc: 27,
|
|
114816
|
+
fs: 28,
|
|
114817
|
+
gs: 29,
|
|
114818
|
+
rs: 30,
|
|
114819
|
+
us: 31,
|
|
114820
|
+
space: 32,
|
|
114821
|
+
exclamationMark: 33, // `!`
|
|
114822
|
+
quotationMark: 34, // `"`
|
|
114823
|
+
numberSign: 35, // `#`
|
|
114824
|
+
dollarSign: 36, // `$`
|
|
114825
|
+
percentSign: 37, // `%`
|
|
114826
|
+
ampersand: 38, // `&`
|
|
114827
|
+
apostrophe: 39, // `'`
|
|
114828
|
+
leftParenthesis: 40, // `(`
|
|
114829
|
+
rightParenthesis: 41, // `)`
|
|
114830
|
+
asterisk: 42, // `*`
|
|
114831
|
+
plusSign: 43, // `+`
|
|
114832
|
+
comma: 44, // `,`
|
|
114833
|
+
dash: 45, // `-`
|
|
114834
|
+
dot: 46, // `.`
|
|
114835
|
+
slash: 47, // `/`
|
|
114836
|
+
digit0: 48, // `0`
|
|
114837
|
+
digit1: 49, // `1`
|
|
114838
|
+
digit2: 50, // `2`
|
|
114839
|
+
digit3: 51, // `3`
|
|
114840
|
+
digit4: 52, // `4`
|
|
114841
|
+
digit5: 53, // `5`
|
|
114842
|
+
digit6: 54, // `6`
|
|
114843
|
+
digit7: 55, // `7`
|
|
114844
|
+
digit8: 56, // `8`
|
|
114845
|
+
digit9: 57, // `9`
|
|
114846
|
+
colon: 58, // `:`
|
|
114847
|
+
semicolon: 59, // `;`
|
|
114848
|
+
lessThan: 60, // `<`
|
|
114849
|
+
equalsTo: 61, // `=`
|
|
114850
|
+
greaterThan: 62, // `>`
|
|
114851
|
+
questionMark: 63, // `?`
|
|
114852
|
+
atSign: 64, // `@`
|
|
114853
|
+
uppercaseA: 65, // `A`
|
|
114854
|
+
uppercaseB: 66, // `B`
|
|
114855
|
+
uppercaseC: 67, // `C`
|
|
114856
|
+
uppercaseD: 68, // `D`
|
|
114857
|
+
uppercaseE: 69, // `E`
|
|
114858
|
+
uppercaseF: 70, // `F`
|
|
114859
|
+
uppercaseG: 71, // `G`
|
|
114860
|
+
uppercaseH: 72, // `H`
|
|
114861
|
+
uppercaseI: 73, // `I`
|
|
114862
|
+
uppercaseJ: 74, // `J`
|
|
114863
|
+
uppercaseK: 75, // `K`
|
|
114864
|
+
uppercaseL: 76, // `L`
|
|
114865
|
+
uppercaseM: 77, // `M`
|
|
114866
|
+
uppercaseN: 78, // `N`
|
|
114867
|
+
uppercaseO: 79, // `O`
|
|
114868
|
+
uppercaseP: 80, // `P`
|
|
114869
|
+
uppercaseQ: 81, // `Q`
|
|
114870
|
+
uppercaseR: 82, // `R`
|
|
114871
|
+
uppercaseS: 83, // `S`
|
|
114872
|
+
uppercaseT: 84, // `T`
|
|
114873
|
+
uppercaseU: 85, // `U`
|
|
114874
|
+
uppercaseV: 86, // `V`
|
|
114875
|
+
uppercaseW: 87, // `W`
|
|
114876
|
+
uppercaseX: 88, // `X`
|
|
114877
|
+
uppercaseY: 89, // `Y`
|
|
114878
|
+
uppercaseZ: 90, // `Z`
|
|
114879
|
+
leftSquareBracket: 91, // `[`
|
|
114880
|
+
backslash: 92, // `\`
|
|
114881
|
+
rightSquareBracket: 93, // `]`
|
|
114882
|
+
caret: 94, // `^`
|
|
114883
|
+
underscore: 95, // `_`
|
|
114884
|
+
graveAccent: 96, // `` ` ``
|
|
114885
|
+
lowercaseA: 97, // `a`
|
|
114886
|
+
lowercaseB: 98, // `b`
|
|
114887
|
+
lowercaseC: 99, // `c`
|
|
114888
|
+
lowercaseD: 100, // `d`
|
|
114889
|
+
lowercaseE: 101, // `e`
|
|
114890
|
+
lowercaseF: 102, // `f`
|
|
114891
|
+
lowercaseG: 103, // `g`
|
|
114892
|
+
lowercaseH: 104, // `h`
|
|
114893
|
+
lowercaseI: 105, // `i`
|
|
114894
|
+
lowercaseJ: 106, // `j`
|
|
114895
|
+
lowercaseK: 107, // `k`
|
|
114896
|
+
lowercaseL: 108, // `l`
|
|
114897
|
+
lowercaseM: 109, // `m`
|
|
114898
|
+
lowercaseN: 110, // `n`
|
|
114899
|
+
lowercaseO: 111, // `o`
|
|
114900
|
+
lowercaseP: 112, // `p`
|
|
114901
|
+
lowercaseQ: 113, // `q`
|
|
114902
|
+
lowercaseR: 114, // `r`
|
|
114903
|
+
lowercaseS: 115, // `s`
|
|
114904
|
+
lowercaseT: 116, // `t`
|
|
114905
|
+
lowercaseU: 117, // `u`
|
|
114906
|
+
lowercaseV: 118, // `v`
|
|
114907
|
+
lowercaseW: 119, // `w`
|
|
114908
|
+
lowercaseX: 120, // `x`
|
|
114909
|
+
lowercaseY: 121, // `y`
|
|
114910
|
+
lowercaseZ: 122, // `z`
|
|
114911
|
+
leftCurlyBrace: 123, // `{`
|
|
114912
|
+
verticalBar: 124, // `|`
|
|
114913
|
+
rightCurlyBrace: 125, // `}`
|
|
114914
|
+
tilde: 126, // `~`
|
|
114915
|
+
del: 127,
|
|
114916
|
+
// Unicode Specials block.
|
|
114917
|
+
byteOrderMarker: 65_279,
|
|
114918
|
+
// Unicode Specials block.
|
|
114919
|
+
replacementCharacter: 65_533 // `�`
|
|
114920
|
+
})
|
|
114921
|
+
|
|
114922
|
+
;// ./lib/micromark/legacy-variable/syntax.ts
|
|
114713
114923
|
|
|
114714
114924
|
|
|
114715
|
-
function
|
|
114716
|
-
return
|
|
114925
|
+
function isAllowedValueChar(code) {
|
|
114926
|
+
return (code !== null &&
|
|
114927
|
+
code !== codes.lessThan &&
|
|
114928
|
+
code !== codes.greaterThan &&
|
|
114929
|
+
!markdownLineEnding(code));
|
|
114717
114930
|
}
|
|
114718
|
-
|
|
114719
|
-
|
|
114720
|
-
|
|
114721
|
-
|
|
114722
|
-
|
|
114723
|
-
|
|
114724
|
-
|
|
114931
|
+
const legacyVariableConstruct = {
|
|
114932
|
+
name: 'legacyVariable',
|
|
114933
|
+
tokenize,
|
|
114934
|
+
};
|
|
114935
|
+
function tokenize(effects, ok, nok) {
|
|
114936
|
+
let hasValue = false;
|
|
114937
|
+
const start = (code) => {
|
|
114938
|
+
if (code !== codes.lessThan)
|
|
114939
|
+
return nok(code);
|
|
114940
|
+
effects.enter('legacyVariable');
|
|
114941
|
+
effects.enter('legacyVariableMarkerStart');
|
|
114942
|
+
effects.consume(code); // <
|
|
114943
|
+
return open2;
|
|
114944
|
+
};
|
|
114945
|
+
const open2 = (code) => {
|
|
114946
|
+
if (code !== codes.lessThan)
|
|
114947
|
+
return nok(code);
|
|
114948
|
+
effects.consume(code); // <<
|
|
114949
|
+
effects.exit('legacyVariableMarkerStart');
|
|
114950
|
+
effects.enter('legacyVariableValue');
|
|
114951
|
+
return value;
|
|
114952
|
+
};
|
|
114953
|
+
const value = (code) => {
|
|
114954
|
+
if (code === codes.greaterThan) {
|
|
114955
|
+
if (!hasValue)
|
|
114956
|
+
return nok(code);
|
|
114957
|
+
effects.exit('legacyVariableValue');
|
|
114958
|
+
effects.enter('legacyVariableMarkerEnd');
|
|
114959
|
+
effects.consume(code); // >
|
|
114960
|
+
return close2;
|
|
114725
114961
|
}
|
|
114726
|
-
|
|
114727
|
-
|
|
114728
|
-
|
|
114729
|
-
|
|
114730
|
-
|
|
114962
|
+
if (!isAllowedValueChar(code))
|
|
114963
|
+
return nok(code);
|
|
114964
|
+
hasValue = true;
|
|
114965
|
+
effects.consume(code);
|
|
114966
|
+
return value;
|
|
114967
|
+
};
|
|
114968
|
+
const close2 = (code) => {
|
|
114969
|
+
if (code !== codes.greaterThan)
|
|
114970
|
+
return nok(code);
|
|
114971
|
+
effects.consume(code); // >>
|
|
114972
|
+
effects.exit('legacyVariableMarkerEnd');
|
|
114973
|
+
effects.exit('legacyVariable');
|
|
114974
|
+
return ok;
|
|
114975
|
+
};
|
|
114976
|
+
return start;
|
|
114977
|
+
}
|
|
114978
|
+
function legacyVariable() {
|
|
114979
|
+
return {
|
|
114980
|
+
text: { [codes.lessThan]: legacyVariableConstruct },
|
|
114981
|
+
};
|
|
114731
114982
|
}
|
|
114732
|
-
/**
|
|
114733
|
-
* Rehype plugin that constructs ids for headings
|
|
114734
|
-
* Id's are used to construct slug anchor links & Table of Contents during rendering
|
|
114735
|
-
* Use the text / nodes that make up the heading to generate the id
|
|
114736
|
-
*/
|
|
114737
|
-
const generateSlugForHeadings = () => (tree) => {
|
|
114738
|
-
const slugger = new BananaSlug();
|
|
114739
|
-
visit(tree, 'element', (node) => {
|
|
114740
|
-
if (isHeading(node) && !node.properties.id) {
|
|
114741
|
-
const text = node.children.map(textContent).join('');
|
|
114742
|
-
node.properties.id = slugger.slug(text);
|
|
114743
|
-
}
|
|
114744
|
-
});
|
|
114745
|
-
return tree;
|
|
114746
|
-
};
|
|
114747
|
-
/* harmony default export */ const heading_slugs = (generateSlugForHeadings);
|
|
114748
|
-
|
|
114749
|
-
// EXTERNAL MODULE: ./node_modules/@readme/variable/dist/index.js
|
|
114750
|
-
var variable_dist = __webpack_require__(4355);
|
|
114751
|
-
var variable_dist_default = /*#__PURE__*/__webpack_require__.n(variable_dist);
|
|
114752
|
-
;// ./node_modules/rehype-parse/lib/index.js
|
|
114753
|
-
/**
|
|
114754
|
-
* @import {Root} from 'hast'
|
|
114755
|
-
* @import {Options as FromHtmlOptions} from 'hast-util-from-html'
|
|
114756
|
-
* @import {Parser, Processor} from 'unified'
|
|
114757
|
-
*/
|
|
114758
|
-
|
|
114759
|
-
/**
|
|
114760
|
-
* @typedef {Omit<FromHtmlOptions, 'onerror'> & RehypeParseFields} Options
|
|
114761
|
-
* Configuration.
|
|
114762
|
-
*
|
|
114763
|
-
* @typedef RehypeParseFields
|
|
114764
|
-
* Extra fields.
|
|
114765
|
-
* @property {boolean | null | undefined} [emitParseErrors=false]
|
|
114766
|
-
* Whether to emit parse errors while parsing (default: `false`).
|
|
114767
|
-
*
|
|
114768
|
-
* > 👉 **Note**: parse errors are currently being added to HTML.
|
|
114769
|
-
* > Not all errors emitted by parse5 (or us) are specced yet.
|
|
114770
|
-
* > Some documentation may still be missing.
|
|
114771
|
-
*/
|
|
114772
|
-
|
|
114773
|
-
|
|
114774
114983
|
|
|
114984
|
+
;// ./lib/micromark/legacy-variable/index.ts
|
|
114775
114985
|
/**
|
|
114776
|
-
*
|
|
114777
|
-
*
|
|
114778
|
-
* > 👉 **Note**: this is not an XML parser.
|
|
114779
|
-
* > It supports SVG as embedded in HTML.
|
|
114780
|
-
* > It does not support the features available in XML.
|
|
114781
|
-
* > Passing SVG files might break but fragments of modern SVG should be fine.
|
|
114782
|
-
* > Use [`xast-util-from-xml`][xast-util-from-xml] to parse XML.
|
|
114783
|
-
*
|
|
114784
|
-
* @param {Options | null | undefined} [options]
|
|
114785
|
-
* Configuration (optional).
|
|
114786
|
-
* @returns {undefined}
|
|
114787
|
-
* Nothing.
|
|
114986
|
+
* Micromark extension for <<variable>> / <<glossary:term>> inline syntax.
|
|
114788
114987
|
*/
|
|
114789
|
-
function rehypeParse(options) {
|
|
114790
|
-
/** @type {Processor<Root>} */
|
|
114791
|
-
// @ts-expect-error: TS in JSDoc generates wrong types if `this` is typed regularly.
|
|
114792
|
-
const self = this
|
|
114793
|
-
const {emitParseErrors, ...settings} = {...self.data('settings'), ...options}
|
|
114794
|
-
|
|
114795
|
-
self.parser = parser
|
|
114796
|
-
|
|
114797
|
-
/**
|
|
114798
|
-
* @type {Parser<Root>}
|
|
114799
|
-
*/
|
|
114800
|
-
function parser(document, file) {
|
|
114801
|
-
return fromHtml(document, {
|
|
114802
|
-
...settings,
|
|
114803
|
-
onerror: emitParseErrors
|
|
114804
|
-
? function (message) {
|
|
114805
|
-
if (file.path) {
|
|
114806
|
-
message.name = file.path + ':' + message.name
|
|
114807
|
-
message.file = file.path
|
|
114808
|
-
}
|
|
114809
114988
|
|
|
114810
|
-
file.messages.push(message)
|
|
114811
|
-
}
|
|
114812
|
-
: undefined
|
|
114813
|
-
})
|
|
114814
|
-
}
|
|
114815
|
-
}
|
|
114816
114989
|
|
|
114817
114990
|
;// ./node_modules/entities/lib/esm/generated/encode-html.js
|
|
114818
114991
|
// Generated using scripts/write-encode-map.ts
|
|
@@ -115119,349 +115292,6 @@ function looseHtmlEntityFromMarkdown() {
|
|
|
115119
115292
|
*/
|
|
115120
115293
|
|
|
115121
115294
|
|
|
115122
|
-
;// ./processor/transform/mdxish/normalize-malformed-md-syntax.ts
|
|
115123
|
-
|
|
115124
|
-
// Marker patterns for multi-node emphasis detection
|
|
115125
|
-
const MARKER_PATTERNS = [
|
|
115126
|
-
{ isBold: true, marker: '**' },
|
|
115127
|
-
{ isBold: true, marker: '__' },
|
|
115128
|
-
{ isBold: false, marker: '*' },
|
|
115129
|
-
{ isBold: false, marker: '_' },
|
|
115130
|
-
];
|
|
115131
|
-
// Patterns to detect for bold (** and __) and italic (* and _) syntax:
|
|
115132
|
-
// Bold: ** text**, **text **, word** text**, ** text **
|
|
115133
|
-
// Italic: * text*, *text *, word* text*, * text *
|
|
115134
|
-
// Same patterns for underscore variants
|
|
115135
|
-
// We use separate patterns for each marker type to allow this flexibility.
|
|
115136
|
-
// Pattern for ** bold **
|
|
115137
|
-
// Groups: 1=wordBefore, 2=marker, 3=contentWithSpaceAfter, 4=trailingSpace1, 5=contentWithSpaceBefore, 6=trailingSpace2, 7=afterChar
|
|
115138
|
-
// trailingSpace1 is for "** text **" pattern, trailingSpace2 is for "**text **" pattern
|
|
115139
|
-
const asteriskBoldRegex = /([^*\s]+)?\s*(\*\*)(?:\s+((?:[^*\n]|\*(?!\*))+?)(\s*)\2|((?:[^*\n]|\*(?!\*))+?)(\s+)\2)(\S|$)?/g;
|
|
115140
|
-
// Pattern for __ bold __
|
|
115141
|
-
const underscoreBoldRegex = /([^_\s]+)?\s*(__)(?:\s+((?:__(?! )|_(?!_)|[^_\n])+?)(\s*)\2|((?:__(?! )|_(?!_)|[^_\n])+?)(\s+)\2)(\S|$)?/g;
|
|
115142
|
-
// Pattern for * italic *
|
|
115143
|
-
const asteriskItalicRegex = /([^*\s]+)?\s*(\*)(?!\*)(?:\s+([^*\n]+?)(\s*)\2|([^*\n]+?)(\s+)\2)(\S|$)?/g;
|
|
115144
|
-
// Pattern for _ italic _
|
|
115145
|
-
const underscoreItalicRegex = /([^_\s]+)?\s*(_)(?!_)(?:\s+((?:[^_\n]|_(?! ))+?)(\s*)\2|((?:[^_\n]|_(?! ))+?)(\s+)\2)(\S|$)?/g;
|
|
115146
|
-
// CommonMark ignores intraword underscores or asteriks, but we want to italicize/bold the inner part
|
|
115147
|
-
// Pattern for intraword _word_ in words like hello_world_
|
|
115148
|
-
const intrawordUnderscoreItalicRegex = /(\w)_(?!_)([a-zA-Z0-9]+)_(?![\w_])/g;
|
|
115149
|
-
// Pattern for intraword __word__ in words like hello__world__
|
|
115150
|
-
const intrawordUnderscoreBoldRegex = /(\w)__([a-zA-Z0-9]+)__(?![\w_])/g;
|
|
115151
|
-
// Pattern for intraword *word* in words like hello*world*
|
|
115152
|
-
const intrawordAsteriskItalicRegex = /(\w)\*(?!\*)([a-zA-Z0-9]+)\*(?![\w*])/g;
|
|
115153
|
-
// Pattern for intraword **word** in words like hello**world**
|
|
115154
|
-
const intrawordAsteriskBoldRegex = /(\w)\*\*([a-zA-Z0-9]+)\*\*(?![\w*])/g;
|
|
115155
|
-
/**
|
|
115156
|
-
* Finds opening emphasis marker in a text value.
|
|
115157
|
-
* Returns marker info if found, null otherwise.
|
|
115158
|
-
*/
|
|
115159
|
-
function findOpeningMarker(text) {
|
|
115160
|
-
const results = MARKER_PATTERNS.map(({ isBold, marker }) => {
|
|
115161
|
-
if (marker === '*' && text.startsWith('**'))
|
|
115162
|
-
return null;
|
|
115163
|
-
if (marker === '_' && text.startsWith('__'))
|
|
115164
|
-
return null;
|
|
115165
|
-
if (text.startsWith(marker) && text.length > marker.length) {
|
|
115166
|
-
return { isBold, marker, textAfter: text.slice(marker.length), textBefore: '' };
|
|
115167
|
-
}
|
|
115168
|
-
const idx = text.indexOf(marker);
|
|
115169
|
-
if (idx > 0 && !/\s/.test(text[idx - 1])) {
|
|
115170
|
-
if (marker === '*' && text.slice(idx).startsWith('**'))
|
|
115171
|
-
return null;
|
|
115172
|
-
if (marker === '_' && text.slice(idx).startsWith('__'))
|
|
115173
|
-
return null;
|
|
115174
|
-
const after = text.slice(idx + marker.length);
|
|
115175
|
-
if (after.length > 0) {
|
|
115176
|
-
return { isBold, marker, textAfter: after, textBefore: text.slice(0, idx) };
|
|
115177
|
-
}
|
|
115178
|
-
}
|
|
115179
|
-
return null;
|
|
115180
|
-
});
|
|
115181
|
-
return results.find(r => r !== null) ?? null;
|
|
115182
|
-
}
|
|
115183
|
-
/**
|
|
115184
|
-
* Finds the end/closing marker in a text node for multi-node emphasis.
|
|
115185
|
-
*/
|
|
115186
|
-
function findEndMarker(text, marker) {
|
|
115187
|
-
const spacePattern = ` ${marker}`;
|
|
115188
|
-
const spaceIdx = text.indexOf(spacePattern);
|
|
115189
|
-
if (spaceIdx >= 0) {
|
|
115190
|
-
if (marker === '*' && text.slice(spaceIdx + 1).startsWith('**'))
|
|
115191
|
-
return null;
|
|
115192
|
-
if (marker === '_' && text.slice(spaceIdx + 1).startsWith('__'))
|
|
115193
|
-
return null;
|
|
115194
|
-
return {
|
|
115195
|
-
textAfter: text.slice(spaceIdx + spacePattern.length),
|
|
115196
|
-
textBefore: text.slice(0, spaceIdx),
|
|
115197
|
-
};
|
|
115198
|
-
}
|
|
115199
|
-
if (text.startsWith(marker)) {
|
|
115200
|
-
if (marker === '*' && text.startsWith('**'))
|
|
115201
|
-
return null;
|
|
115202
|
-
if (marker === '_' && text.startsWith('__'))
|
|
115203
|
-
return null;
|
|
115204
|
-
return {
|
|
115205
|
-
textAfter: text.slice(marker.length),
|
|
115206
|
-
textBefore: '',
|
|
115207
|
-
};
|
|
115208
|
-
}
|
|
115209
|
-
return null;
|
|
115210
|
-
}
|
|
115211
|
-
/**
|
|
115212
|
-
* Scan children for an opening emphasis marker in a text node.
|
|
115213
|
-
*/
|
|
115214
|
-
function findOpeningInChildren(children) {
|
|
115215
|
-
let result = null;
|
|
115216
|
-
children.some((child, idx) => {
|
|
115217
|
-
if (child.type !== 'text')
|
|
115218
|
-
return false;
|
|
115219
|
-
const found = findOpeningMarker(child.value);
|
|
115220
|
-
if (found) {
|
|
115221
|
-
result = { idx, opening: found };
|
|
115222
|
-
return true;
|
|
115223
|
-
}
|
|
115224
|
-
return false;
|
|
115225
|
-
});
|
|
115226
|
-
return result;
|
|
115227
|
-
}
|
|
115228
|
-
/**
|
|
115229
|
-
* Scan children (after openingIdx) for a closing emphasis marker.
|
|
115230
|
-
*/
|
|
115231
|
-
function findClosingInChildren(children, openingIdx, marker) {
|
|
115232
|
-
let result = null;
|
|
115233
|
-
children.slice(openingIdx + 1).some((child, relativeIdx) => {
|
|
115234
|
-
if (child.type !== 'text')
|
|
115235
|
-
return false;
|
|
115236
|
-
const found = findEndMarker(child.value, marker);
|
|
115237
|
-
if (found) {
|
|
115238
|
-
result = { closingIdx: openingIdx + 1 + relativeIdx, closing: found };
|
|
115239
|
-
return true;
|
|
115240
|
-
}
|
|
115241
|
-
return false;
|
|
115242
|
-
});
|
|
115243
|
-
return result;
|
|
115244
|
-
}
|
|
115245
|
-
/**
|
|
115246
|
-
* Build the replacement nodes for a matched emphasis pair.
|
|
115247
|
-
*/
|
|
115248
|
-
function buildReplacementNodes(container, { opening, openingIdx, closing, closingIdx }) {
|
|
115249
|
-
const newNodes = [];
|
|
115250
|
-
if (opening.textBefore) {
|
|
115251
|
-
newNodes.push({ type: 'text', value: `${opening.textBefore} ` });
|
|
115252
|
-
}
|
|
115253
|
-
const emphasisChildren = [];
|
|
115254
|
-
const openingText = opening.textAfter.replace(/^\s+/, '');
|
|
115255
|
-
if (openingText) {
|
|
115256
|
-
emphasisChildren.push({ type: 'text', value: openingText });
|
|
115257
|
-
}
|
|
115258
|
-
container.children.slice(openingIdx + 1, closingIdx).forEach(child => {
|
|
115259
|
-
emphasisChildren.push(child);
|
|
115260
|
-
});
|
|
115261
|
-
const closingText = closing.textBefore.replace(/\s+$/, '');
|
|
115262
|
-
if (closingText) {
|
|
115263
|
-
emphasisChildren.push({ type: 'text', value: closingText });
|
|
115264
|
-
}
|
|
115265
|
-
if (emphasisChildren.length > 0) {
|
|
115266
|
-
const emphasisNode = opening.isBold
|
|
115267
|
-
? { type: 'strong', children: emphasisChildren }
|
|
115268
|
-
: { type: 'emphasis', children: emphasisChildren };
|
|
115269
|
-
newNodes.push(emphasisNode);
|
|
115270
|
-
}
|
|
115271
|
-
if (closing.textAfter) {
|
|
115272
|
-
newNodes.push({ type: 'text', value: closing.textAfter });
|
|
115273
|
-
}
|
|
115274
|
-
return newNodes;
|
|
115275
|
-
}
|
|
115276
|
-
/**
|
|
115277
|
-
* Find and transform one multi-node emphasis pair in the container.
|
|
115278
|
-
* Returns true if a pair was found and transformed, false otherwise.
|
|
115279
|
-
*/
|
|
115280
|
-
function processOneEmphasisPair(container) {
|
|
115281
|
-
const openingResult = findOpeningInChildren(container.children);
|
|
115282
|
-
if (!openingResult)
|
|
115283
|
-
return false;
|
|
115284
|
-
const { idx: openingIdx, opening } = openingResult;
|
|
115285
|
-
const closingResult = findClosingInChildren(container.children, openingIdx, opening.marker);
|
|
115286
|
-
if (!closingResult)
|
|
115287
|
-
return false;
|
|
115288
|
-
const { closingIdx, closing } = closingResult;
|
|
115289
|
-
const newNodes = buildReplacementNodes(container, { opening, openingIdx, closing, closingIdx });
|
|
115290
|
-
const deleteCount = closingIdx - openingIdx + 1;
|
|
115291
|
-
container.children.splice(openingIdx, deleteCount, ...newNodes);
|
|
115292
|
-
return true;
|
|
115293
|
-
}
|
|
115294
|
-
/**
|
|
115295
|
-
* Handle malformed emphasis that spans multiple AST nodes.
|
|
115296
|
-
* E.g., "**bold [link](url)**" where markers are in different text nodes.
|
|
115297
|
-
*/
|
|
115298
|
-
function visitMultiNodeEmphasis(tree) {
|
|
115299
|
-
const containerTypes = ['paragraph', 'heading', 'tableCell', 'listItem', 'blockquote'];
|
|
115300
|
-
visit(tree, node => {
|
|
115301
|
-
if (!containerTypes.includes(node.type))
|
|
115302
|
-
return;
|
|
115303
|
-
if (!('children' in node) || !Array.isArray(node.children))
|
|
115304
|
-
return;
|
|
115305
|
-
const container = node;
|
|
115306
|
-
let foundPair = true;
|
|
115307
|
-
while (foundPair) {
|
|
115308
|
-
foundPair = processOneEmphasisPair(container);
|
|
115309
|
-
}
|
|
115310
|
-
});
|
|
115311
|
-
}
|
|
115312
|
-
/**
|
|
115313
|
-
* A remark plugin that normalizes malformed bold and italic markers in text nodes.
|
|
115314
|
-
* Detects patterns like `** bold**`, `Hello** Wrong Bold**`, `__ bold__`, `Hello__ Wrong Bold__`,
|
|
115315
|
-
* `* italic*`, `Hello* Wrong Italic*`, `_ italic_`, or `Hello_ Wrong Italic_`
|
|
115316
|
-
* and converts them to proper strong/emphasis nodes, matching the behavior of the legacy rdmd engine.
|
|
115317
|
-
*
|
|
115318
|
-
* Supports both asterisk (`**bold**`, `*italic*`) and underscore (`__bold__`, `_italic_`) syntax.
|
|
115319
|
-
* Also supports snake_case content like `** some_snake_case**`.
|
|
115320
|
-
*
|
|
115321
|
-
* This runs after remark-parse, which (in v11+) is strict and doesn't parse
|
|
115322
|
-
* malformed emphasis syntax. This plugin post-processes the AST to handle these cases.
|
|
115323
|
-
*/
|
|
115324
|
-
const normalizeEmphasisAST = () => (tree) => {
|
|
115325
|
-
visit(tree, 'text', function visitor(node, index, parent) {
|
|
115326
|
-
if (index === undefined || !parent)
|
|
115327
|
-
return undefined;
|
|
115328
|
-
// Skip if inside code blocks or inline code
|
|
115329
|
-
if (parent.type === 'inlineCode' || parent.type === 'code') {
|
|
115330
|
-
return undefined;
|
|
115331
|
-
}
|
|
115332
|
-
const text = node.value;
|
|
115333
|
-
const allMatches = [];
|
|
115334
|
-
[...text.matchAll(asteriskBoldRegex)].forEach(match => {
|
|
115335
|
-
allMatches.push({ isBold: true, marker: '**', match });
|
|
115336
|
-
});
|
|
115337
|
-
[...text.matchAll(underscoreBoldRegex)].forEach(match => {
|
|
115338
|
-
allMatches.push({ isBold: true, marker: '__', match });
|
|
115339
|
-
});
|
|
115340
|
-
[...text.matchAll(asteriskItalicRegex)].forEach(match => {
|
|
115341
|
-
allMatches.push({ isBold: false, marker: '*', match });
|
|
115342
|
-
});
|
|
115343
|
-
[...text.matchAll(underscoreItalicRegex)].forEach(match => {
|
|
115344
|
-
allMatches.push({ isBold: false, marker: '_', match });
|
|
115345
|
-
});
|
|
115346
|
-
[...text.matchAll(intrawordUnderscoreItalicRegex)].forEach(match => {
|
|
115347
|
-
allMatches.push({ isBold: false, isIntraword: true, marker: '_', match });
|
|
115348
|
-
});
|
|
115349
|
-
[...text.matchAll(intrawordUnderscoreBoldRegex)].forEach(match => {
|
|
115350
|
-
allMatches.push({ isBold: true, isIntraword: true, marker: '__', match });
|
|
115351
|
-
});
|
|
115352
|
-
[...text.matchAll(intrawordAsteriskItalicRegex)].forEach(match => {
|
|
115353
|
-
allMatches.push({ isBold: false, isIntraword: true, marker: '*', match });
|
|
115354
|
-
});
|
|
115355
|
-
[...text.matchAll(intrawordAsteriskBoldRegex)].forEach(match => {
|
|
115356
|
-
allMatches.push({ isBold: true, isIntraword: true, marker: '**', match });
|
|
115357
|
-
});
|
|
115358
|
-
if (allMatches.length === 0)
|
|
115359
|
-
return undefined;
|
|
115360
|
-
allMatches.sort((a, b) => (a.match.index ?? 0) - (b.match.index ?? 0));
|
|
115361
|
-
const filteredMatches = [];
|
|
115362
|
-
let lastEnd = 0;
|
|
115363
|
-
allMatches.forEach(info => {
|
|
115364
|
-
const start = info.match.index ?? 0;
|
|
115365
|
-
const end = start + info.match[0].length;
|
|
115366
|
-
if (start >= lastEnd) {
|
|
115367
|
-
filteredMatches.push(info);
|
|
115368
|
-
lastEnd = end;
|
|
115369
|
-
}
|
|
115370
|
-
});
|
|
115371
|
-
if (filteredMatches.length === 0)
|
|
115372
|
-
return undefined;
|
|
115373
|
-
const parts = [];
|
|
115374
|
-
let lastIndex = 0;
|
|
115375
|
-
filteredMatches.forEach(({ isBold, isIntraword, marker, match }) => {
|
|
115376
|
-
const matchIndex = match.index ?? 0;
|
|
115377
|
-
const fullMatch = match[0];
|
|
115378
|
-
if (isIntraword) {
|
|
115379
|
-
// handles cases like hello_world_ where we only want to italicize 'world'
|
|
115380
|
-
const charBefore = match[1] || ''; // e.g., "l" in "hello_world_"
|
|
115381
|
-
const content = match[2]; // e.g., "world"
|
|
115382
|
-
const combinedBefore = text.slice(lastIndex, matchIndex) + charBefore;
|
|
115383
|
-
if (combinedBefore) {
|
|
115384
|
-
parts.push({ type: 'text', value: combinedBefore });
|
|
115385
|
-
}
|
|
115386
|
-
if (isBold) {
|
|
115387
|
-
parts.push({
|
|
115388
|
-
type: 'strong',
|
|
115389
|
-
children: [{ type: 'text', value: content }],
|
|
115390
|
-
});
|
|
115391
|
-
}
|
|
115392
|
-
else {
|
|
115393
|
-
parts.push({
|
|
115394
|
-
type: 'emphasis',
|
|
115395
|
-
children: [{ type: 'text', value: content }],
|
|
115396
|
-
});
|
|
115397
|
-
}
|
|
115398
|
-
lastIndex = matchIndex + fullMatch.length;
|
|
115399
|
-
return;
|
|
115400
|
-
}
|
|
115401
|
-
if (matchIndex > lastIndex) {
|
|
115402
|
-
const beforeText = text.slice(lastIndex, matchIndex);
|
|
115403
|
-
if (beforeText) {
|
|
115404
|
-
parts.push({ type: 'text', value: beforeText });
|
|
115405
|
-
}
|
|
115406
|
-
}
|
|
115407
|
-
const wordBefore = match[1]; // e.g., "Hello" in "Hello** Wrong Bold**"
|
|
115408
|
-
const contentWithSpaceAfter = match[3]; // Content when there's a space after opening markers
|
|
115409
|
-
const trailingSpace1 = match[4] || ''; // Space before closing markers (for "** text **" pattern)
|
|
115410
|
-
const contentWithSpaceBefore = match[5]; // Content when there's only a space before closing markers
|
|
115411
|
-
const trailingSpace2 = match[6] || ''; // Space before closing markers (for "**text **" pattern)
|
|
115412
|
-
const trailingSpace = trailingSpace1 || trailingSpace2; // Combined trailing space
|
|
115413
|
-
const content = (contentWithSpaceAfter || contentWithSpaceBefore || '').trim();
|
|
115414
|
-
const afterChar = match[7]; // Character after closing markers (if any)
|
|
115415
|
-
const markerPos = fullMatch.indexOf(marker);
|
|
115416
|
-
const spacesBeforeMarkers = wordBefore
|
|
115417
|
-
? fullMatch.slice(wordBefore.length, markerPos)
|
|
115418
|
-
: fullMatch.slice(0, markerPos);
|
|
115419
|
-
const shouldAddSpace = !!contentWithSpaceAfter && !!wordBefore && !spacesBeforeMarkers;
|
|
115420
|
-
if (wordBefore) {
|
|
115421
|
-
const spacing = spacesBeforeMarkers + (shouldAddSpace ? ' ' : '');
|
|
115422
|
-
parts.push({ type: 'text', value: wordBefore + spacing });
|
|
115423
|
-
}
|
|
115424
|
-
else if (spacesBeforeMarkers) {
|
|
115425
|
-
parts.push({ type: 'text', value: spacesBeforeMarkers });
|
|
115426
|
-
}
|
|
115427
|
-
if (content) {
|
|
115428
|
-
if (isBold) {
|
|
115429
|
-
parts.push({
|
|
115430
|
-
type: 'strong',
|
|
115431
|
-
children: [{ type: 'text', value: content }],
|
|
115432
|
-
});
|
|
115433
|
-
}
|
|
115434
|
-
else {
|
|
115435
|
-
parts.push({
|
|
115436
|
-
type: 'emphasis',
|
|
115437
|
-
children: [{ type: 'text', value: content }],
|
|
115438
|
-
});
|
|
115439
|
-
}
|
|
115440
|
-
}
|
|
115441
|
-
if (afterChar) {
|
|
115442
|
-
const prefix = trailingSpace ? ' ' : '';
|
|
115443
|
-
parts.push({ type: 'text', value: prefix + afterChar });
|
|
115444
|
-
}
|
|
115445
|
-
lastIndex = matchIndex + fullMatch.length;
|
|
115446
|
-
});
|
|
115447
|
-
if (lastIndex < text.length) {
|
|
115448
|
-
const remainingText = text.slice(lastIndex);
|
|
115449
|
-
if (remainingText) {
|
|
115450
|
-
parts.push({ type: 'text', value: remainingText });
|
|
115451
|
-
}
|
|
115452
|
-
}
|
|
115453
|
-
if (parts.length > 0) {
|
|
115454
|
-
parent.children.splice(index, 1, ...parts);
|
|
115455
|
-
return [SKIP, index + parts.length];
|
|
115456
|
-
}
|
|
115457
|
-
return undefined;
|
|
115458
|
-
});
|
|
115459
|
-
// Handle malformed emphasis spanning multiple nodes (e.g., **text [link](url) **)
|
|
115460
|
-
visitMultiNodeEmphasis(tree);
|
|
115461
|
-
return tree;
|
|
115462
|
-
};
|
|
115463
|
-
/* harmony default export */ const normalize_malformed_md_syntax = (normalizeEmphasisAST);
|
|
115464
|
-
|
|
115465
115295
|
;// ./processor/transform/mdxish/magic-blocks/patterns.ts
|
|
115466
115296
|
/** Matches HTML tags (open, close, self-closing) with optional attributes. */
|
|
115467
115297
|
const HTML_TAG_RE = /<\/?([a-zA-Z][a-zA-Z0-9-]*)((?:[^>"']*(?:"[^"]*"|'[^']*'))*[^>"']*)>/g;
|
|
@@ -116079,6 +115909,336 @@ const magicBlockTransformer = (options = {}) => tree => {
|
|
|
116079
115909
|
};
|
|
116080
115910
|
/* harmony default export */ const magic_block_transformer = (magicBlockTransformer);
|
|
116081
115911
|
|
|
115912
|
+
;// ./processor/transform/mdxish/constants.ts
|
|
115913
|
+
/**
|
|
115914
|
+
* Inline component tags handled by mdxish-inline-components.ts.
|
|
115915
|
+
* Also excluded from block-level handling in mdxish-component-blocks.ts.
|
|
115916
|
+
*/
|
|
115917
|
+
const constants_INLINE_COMPONENT_TAGS = new Set(['Anchor']);
|
|
115918
|
+
|
|
115919
|
+
;// ./processor/transform/mdxish/mdxish-component-blocks.ts
|
|
115920
|
+
|
|
115921
|
+
|
|
115922
|
+
|
|
115923
|
+
|
|
115924
|
+
|
|
115925
|
+
|
|
115926
|
+
|
|
115927
|
+
const pascalCaseTagPattern = /^<([A-Z][A-Za-z0-9_]*)([^>]*?)(\/?)>([\s\S]*)?$/;
|
|
115928
|
+
const tagAttributePattern = /([a-zA-Z_:][-a-zA-Z0-9_:.]*)(?:\s*=\s*("[^"]*"|'[^']*'|[^\s"'>]+))?/g;
|
|
115929
|
+
/**
|
|
115930
|
+
* Maximum number of siblings to scan forward when looking for a closing tag
|
|
115931
|
+
* to avoid scanning too far and degrading performance
|
|
115932
|
+
*/
|
|
115933
|
+
const MAX_LOOKAHEAD = 30;
|
|
115934
|
+
/**
|
|
115935
|
+
* Tags that have dedicated transformers and should NOT be handled by this plugin.
|
|
115936
|
+
* These components either have special parsing requirements that the generic component
|
|
115937
|
+
* block transformer cannot handle correctly, or are inline components that we don't
|
|
115938
|
+
* want to convert to mdxJsxFlowElement which is a block level element.
|
|
115939
|
+
*/
|
|
115940
|
+
const EXCLUDED_TAGS = new Set(['HTMLBlock', 'Table', 'Glossary', ...constants_INLINE_COMPONENT_TAGS]);
|
|
115941
|
+
const inlineMdProcessor = unified()
|
|
115942
|
+
.data('micromarkExtensions', [legacyVariable()])
|
|
115943
|
+
.data('fromMarkdownExtensions', [legacyVariableFromMarkdown(), emptyTaskListItemFromMarkdown()])
|
|
115944
|
+
.use(remarkParse)
|
|
115945
|
+
.use(remarkGfm);
|
|
115946
|
+
const isClosingTag = (value, tag) => value.trim() === `</${tag}>`;
|
|
115947
|
+
/**
|
|
115948
|
+
* Parse markdown content into mdast children nodes.
|
|
115949
|
+
*/
|
|
115950
|
+
const parseMdChildren = (value) => {
|
|
115951
|
+
const parsed = inlineMdProcessor.parse(value);
|
|
115952
|
+
return parsed.children || [];
|
|
115953
|
+
};
|
|
115954
|
+
/**
|
|
115955
|
+
* Convert raw attribute string into mdxJsxAttribute entries.
|
|
115956
|
+
* Handles both key-value attributes (theme="info") and boolean attributes (empty).
|
|
115957
|
+
*/
|
|
115958
|
+
const parseAttributes = (raw) => {
|
|
115959
|
+
const attributes = [];
|
|
115960
|
+
const attrString = raw.trim();
|
|
115961
|
+
if (!attrString)
|
|
115962
|
+
return attributes;
|
|
115963
|
+
tagAttributePattern.lastIndex = 0;
|
|
115964
|
+
let match = tagAttributePattern.exec(attrString);
|
|
115965
|
+
while (match !== null) {
|
|
115966
|
+
const [, attrName, attrValue] = match;
|
|
115967
|
+
const value = attrValue ? attrValue.replace(/^['"]|['"]$/g, '') : null;
|
|
115968
|
+
attributes.push({ type: 'mdxJsxAttribute', name: attrName, value });
|
|
115969
|
+
match = tagAttributePattern.exec(attrString);
|
|
115970
|
+
}
|
|
115971
|
+
return attributes;
|
|
115972
|
+
};
|
|
115973
|
+
/**
|
|
115974
|
+
* Parse an HTML tag string into structured data.
|
|
115975
|
+
*/
|
|
115976
|
+
const parseTag = (value) => {
|
|
115977
|
+
const match = value.match(pascalCaseTagPattern);
|
|
115978
|
+
if (!match)
|
|
115979
|
+
return null;
|
|
115980
|
+
const [, tag, attrString = '', selfClosing = '', contentAfterTag = ''] = match;
|
|
115981
|
+
return {
|
|
115982
|
+
tag,
|
|
115983
|
+
attributes: parseAttributes(attrString),
|
|
115984
|
+
selfClosing: !!selfClosing,
|
|
115985
|
+
contentAfterTag,
|
|
115986
|
+
};
|
|
115987
|
+
};
|
|
115988
|
+
/**
|
|
115989
|
+
* Parse substring content of a node and update the parent's children to include the new nodes.
|
|
115990
|
+
*/
|
|
115991
|
+
const parseSibling = (stack, parent, index, sibling) => {
|
|
115992
|
+
const siblingNodes = parseMdChildren(sibling);
|
|
115993
|
+
// The new sibling nodes might contain new components to be processed
|
|
115994
|
+
if (siblingNodes.length > 0) {
|
|
115995
|
+
parent.children.splice(index + 1, 0, ...siblingNodes);
|
|
115996
|
+
stack.push(parent);
|
|
115997
|
+
}
|
|
115998
|
+
};
|
|
115999
|
+
/**
|
|
116000
|
+
* Create an MdxJsxFlowElement node from component data.
|
|
116001
|
+
*/
|
|
116002
|
+
const createComponentNode = ({ tag, attributes, children, startPosition, endPosition }) => ({
|
|
116003
|
+
type: 'mdxJsxFlowElement',
|
|
116004
|
+
name: tag,
|
|
116005
|
+
attributes,
|
|
116006
|
+
children,
|
|
116007
|
+
position: {
|
|
116008
|
+
start: startPosition?.start,
|
|
116009
|
+
end: endPosition?.end ?? startPosition?.end,
|
|
116010
|
+
},
|
|
116011
|
+
});
|
|
116012
|
+
/**
|
|
116013
|
+
* Remove a closing tag from a paragraph's children and return the updated paragraph.
|
|
116014
|
+
*/
|
|
116015
|
+
const stripClosingTagFromParagraph = (node, tag) => {
|
|
116016
|
+
if (!Array.isArray(node.children))
|
|
116017
|
+
return { paragraph: node, found: false };
|
|
116018
|
+
const children = [...node.children];
|
|
116019
|
+
const closingIndex = children.findIndex(child => child.type === 'html' && isClosingTag(child.value || '', tag));
|
|
116020
|
+
if (closingIndex === -1)
|
|
116021
|
+
return { paragraph: node, found: false };
|
|
116022
|
+
children.splice(closingIndex, 1);
|
|
116023
|
+
return { paragraph: { ...node, children }, found: true };
|
|
116024
|
+
};
|
|
116025
|
+
/**
|
|
116026
|
+
* Scan forward through siblings to find a closing tag.
|
|
116027
|
+
* Handles:
|
|
116028
|
+
* - Exact match HTML siblings (e.g., `</Tag>`)
|
|
116029
|
+
* - HTML siblings with embedded closing tag (e.g., `...\n</Tag>`)
|
|
116030
|
+
* - Paragraph siblings containing the closing tag as a child
|
|
116031
|
+
*
|
|
116032
|
+
* Returns null if not found within MAX_LOOKAHEAD siblings
|
|
116033
|
+
*/
|
|
116034
|
+
const scanForClosingTag = (parent, startIndex, tag) => {
|
|
116035
|
+
const closingTagStr = `</${tag}>`;
|
|
116036
|
+
const maxIndex = Math.min(startIndex + MAX_LOOKAHEAD, parent.children.length);
|
|
116037
|
+
let i = startIndex + 1;
|
|
116038
|
+
for (; i < maxIndex; i += 1) {
|
|
116039
|
+
const sibling = parent.children[i];
|
|
116040
|
+
// Check HTML siblings
|
|
116041
|
+
if (sibling.type === 'html') {
|
|
116042
|
+
const siblingValue = sibling.value || '';
|
|
116043
|
+
// Exact match (standalone closing tag)
|
|
116044
|
+
if (isClosingTag(siblingValue, tag)) {
|
|
116045
|
+
return { closingIndex: i, extraClosingChildren: [] };
|
|
116046
|
+
}
|
|
116047
|
+
// Embedded closing tag (closing tag within HTML block content)
|
|
116048
|
+
if (siblingValue.includes(closingTagStr)) {
|
|
116049
|
+
const closeTagPos = siblingValue.indexOf(closingTagStr);
|
|
116050
|
+
const contentBeforeClose = siblingValue.substring(0, closeTagPos).trim();
|
|
116051
|
+
const contentAfterClose = siblingValue.substring(closeTagPos + closingTagStr.length).trim();
|
|
116052
|
+
const extraChildren = contentBeforeClose
|
|
116053
|
+
? parseMdChildren(contentBeforeClose)
|
|
116054
|
+
: [];
|
|
116055
|
+
return { closingIndex: i, extraClosingChildren: extraChildren, contentAfterClose: contentAfterClose || undefined };
|
|
116056
|
+
}
|
|
116057
|
+
}
|
|
116058
|
+
// Check paragraph siblings
|
|
116059
|
+
if (sibling.type === 'paragraph') {
|
|
116060
|
+
const { paragraph, found } = stripClosingTagFromParagraph(sibling, tag);
|
|
116061
|
+
if (found) {
|
|
116062
|
+
return { closingIndex: i, extraClosingChildren: [], strippedParagraph: paragraph };
|
|
116063
|
+
}
|
|
116064
|
+
}
|
|
116065
|
+
}
|
|
116066
|
+
if (i < parent.children.length) {
|
|
116067
|
+
// eslint-disable-next-line no-console
|
|
116068
|
+
console.warn(`Closing tag </${tag}> not found within ${MAX_LOOKAHEAD} siblings, stopping scan`);
|
|
116069
|
+
}
|
|
116070
|
+
return null;
|
|
116071
|
+
};
|
|
116072
|
+
const substituteNodeWithMdxNode = (parent, index, mdxNode) => {
|
|
116073
|
+
parent.children.splice(index, 1, mdxNode);
|
|
116074
|
+
};
|
|
116075
|
+
/**
|
|
116076
|
+
* Transform PascalCase HTML nodes into mdxJsxFlowElement nodes.
|
|
116077
|
+
*
|
|
116078
|
+
* Remark parses unknown/custom component tags as raw HTML nodes.
|
|
116079
|
+
* These are the custom readme MDX syntax for components.
|
|
116080
|
+
* This transformer identifies these patterns and converts them to proper MDX JSX elements so they
|
|
116081
|
+
* can be accurately recognized and rendered later with their component definition code.
|
|
116082
|
+
* Though for some tags, we need to handle them specially
|
|
116083
|
+
*
|
|
116084
|
+
* ## Supported HTML Structures
|
|
116085
|
+
*
|
|
116086
|
+
* ### 1. Self-closing tags
|
|
116087
|
+
* ```
|
|
116088
|
+
* <Component />
|
|
116089
|
+
* ```
|
|
116090
|
+
* Parsed as: `html: "<Component />"`
|
|
116091
|
+
*
|
|
116092
|
+
* ### 2. Self-contained blocks (entire component in single HTML node)
|
|
116093
|
+
* ```
|
|
116094
|
+
* <Button>Click me</Button>
|
|
116095
|
+
* ```
|
|
116096
|
+
* ```
|
|
116097
|
+
* <Component>
|
|
116098
|
+
* <h2>Title</h2>
|
|
116099
|
+
* <p>Content</p>
|
|
116100
|
+
* </Component>
|
|
116101
|
+
* ```
|
|
116102
|
+
* Parsed as: `html: "<Component>\n <h2>Title</h2>\n <p>Content</p>\n</Component>"`
|
|
116103
|
+
* The opening tag, content, and closing tag are all captured in one HTML node.
|
|
116104
|
+
*
|
|
116105
|
+
* ### 3. Multi-sibling components (closing tag in a following sibling)
|
|
116106
|
+
* Handles various structures where the closing tag is in a later sibling, such as:
|
|
116107
|
+
*
|
|
116108
|
+
* #### 3a. Block components (closing tag in sibling paragraph)
|
|
116109
|
+
* ```
|
|
116110
|
+
* <Callout>
|
|
116111
|
+
* Some **markdown** content
|
|
116112
|
+
* </Callout>
|
|
116113
|
+
* ```
|
|
116114
|
+
*
|
|
116115
|
+
* #### 3b. Multi-paragraph components (closing tag several siblings away)
|
|
116116
|
+
* ```
|
|
116117
|
+
* <Callout>
|
|
116118
|
+
*
|
|
116119
|
+
* First paragraph
|
|
116120
|
+
*
|
|
116121
|
+
* Second paragraph
|
|
116122
|
+
* </Callout>
|
|
116123
|
+
* ```
|
|
116124
|
+
*
|
|
116125
|
+
* #### 3c. Nested components split by blank lines (closing tag embedded in HTML sibling)
|
|
116126
|
+
* ```
|
|
116127
|
+
* <Outer>
|
|
116128
|
+
* <Inner>content</Inner>
|
|
116129
|
+
*
|
|
116130
|
+
* <Inner>content</Inner>
|
|
116131
|
+
* </Outer>
|
|
116132
|
+
* ```
|
|
116133
|
+
*/
|
|
116134
|
+
const mdxishComponentBlocks = () => tree => {
|
|
116135
|
+
const stack = [tree];
|
|
116136
|
+
const processChildNode = (parent, index) => {
|
|
116137
|
+
const node = parent.children[index];
|
|
116138
|
+
if (!node)
|
|
116139
|
+
return;
|
|
116140
|
+
if ('children' in node && Array.isArray(node.children)) {
|
|
116141
|
+
stack.push(node);
|
|
116142
|
+
}
|
|
116143
|
+
// Only visit HTML nodes with an actual html tag,
|
|
116144
|
+
// which means a potential unparsed MDX component
|
|
116145
|
+
const value = node.value;
|
|
116146
|
+
if (node.type !== 'html' || typeof value !== 'string')
|
|
116147
|
+
return;
|
|
116148
|
+
const parsed = parseTag(value.trim());
|
|
116149
|
+
if (!parsed)
|
|
116150
|
+
return;
|
|
116151
|
+
const { tag, attributes, selfClosing, contentAfterTag = '' } = parsed;
|
|
116152
|
+
// Skip tags that have dedicated transformers
|
|
116153
|
+
if (EXCLUDED_TAGS.has(tag))
|
|
116154
|
+
return;
|
|
116155
|
+
const closingTagStr = `</${tag}>`;
|
|
116156
|
+
// Case 1: Self-closing tag
|
|
116157
|
+
if (selfClosing) {
|
|
116158
|
+
const componentNode = createComponentNode({
|
|
116159
|
+
tag,
|
|
116160
|
+
attributes,
|
|
116161
|
+
children: [],
|
|
116162
|
+
startPosition: node.position,
|
|
116163
|
+
});
|
|
116164
|
+
substituteNodeWithMdxNode(parent, index, componentNode);
|
|
116165
|
+
// Check and parse if there's relevant content after the current closing tag
|
|
116166
|
+
const remainingContent = contentAfterTag.trim();
|
|
116167
|
+
if (remainingContent) {
|
|
116168
|
+
parseSibling(stack, parent, index, remainingContent);
|
|
116169
|
+
}
|
|
116170
|
+
return;
|
|
116171
|
+
}
|
|
116172
|
+
// Case 2: Self-contained block (closing tag in content)
|
|
116173
|
+
if (contentAfterTag.includes(closingTagStr)) {
|
|
116174
|
+
// Find the first closing tag
|
|
116175
|
+
const closingTagIndex = contentAfterTag.indexOf(closingTagStr);
|
|
116176
|
+
const componentInnerContent = contentAfterTag.substring(0, closingTagIndex).trim();
|
|
116177
|
+
const contentAfterClose = contentAfterTag.substring(closingTagIndex + closingTagStr.length).trim();
|
|
116178
|
+
const componentNode = createComponentNode({
|
|
116179
|
+
tag,
|
|
116180
|
+
attributes,
|
|
116181
|
+
children: componentInnerContent ? parseMdChildren(componentInnerContent) : [],
|
|
116182
|
+
startPosition: node.position,
|
|
116183
|
+
});
|
|
116184
|
+
substituteNodeWithMdxNode(parent, index, componentNode);
|
|
116185
|
+
// After the closing tag, there might be more content to be processed
|
|
116186
|
+
if (contentAfterClose) {
|
|
116187
|
+
parseSibling(stack, parent, index, contentAfterClose);
|
|
116188
|
+
}
|
|
116189
|
+
else if (componentNode.children.length > 0) {
|
|
116190
|
+
// The content inside the component block might contain new components to be processed
|
|
116191
|
+
stack.push(componentNode);
|
|
116192
|
+
}
|
|
116193
|
+
return;
|
|
116194
|
+
}
|
|
116195
|
+
// Case 3: Multi-sibling component (closing tag in a following sibling)
|
|
116196
|
+
// Scans forward through siblings to find closing tag in HTML or paragraph nodes
|
|
116197
|
+
const scanResult = scanForClosingTag(parent, index, tag);
|
|
116198
|
+
if (!scanResult)
|
|
116199
|
+
return;
|
|
116200
|
+
const { closingIndex, extraClosingChildren, strippedParagraph, contentAfterClose: remainingAfterClose } = scanResult;
|
|
116201
|
+
const extraChildren = contentAfterTag ? parseMdChildren(contentAfterTag.trimStart()) : [];
|
|
116202
|
+
// Collect all intermediate siblings between opening tag and closing tag
|
|
116203
|
+
const intermediateChildren = parent.children.slice(index + 1, closingIndex);
|
|
116204
|
+
// For paragraph siblings, include the full paragraph (with closing tag stripped)
|
|
116205
|
+
// For HTML siblings, include any content parsed from before the closing tag
|
|
116206
|
+
const closingChildren = strippedParagraph
|
|
116207
|
+
? (strippedParagraph.children.length > 0 ? [strippedParagraph] : [])
|
|
116208
|
+
: extraClosingChildren;
|
|
116209
|
+
const componentNode = createComponentNode({
|
|
116210
|
+
tag,
|
|
116211
|
+
attributes,
|
|
116212
|
+
children: [...extraChildren, ...intermediateChildren, ...closingChildren],
|
|
116213
|
+
startPosition: node.position,
|
|
116214
|
+
endPosition: parent.children[closingIndex]?.position,
|
|
116215
|
+
});
|
|
116216
|
+
// Remove all nodes from opening tag to closing tag (inclusive) and replace with component node
|
|
116217
|
+
parent.children.splice(index, closingIndex - index + 1, componentNode);
|
|
116218
|
+
// Since we might be merging sibling nodes together and combining content,
|
|
116219
|
+
// there might be new components to process
|
|
116220
|
+
if (componentNode.children.length > 0) {
|
|
116221
|
+
stack.push(componentNode);
|
|
116222
|
+
}
|
|
116223
|
+
// If the closing tag sibling had content after it (e.g., another component opening tag),
|
|
116224
|
+
// re-insert it as a sibling so it can be processed in subsequent iterations
|
|
116225
|
+
if (remainingAfterClose) {
|
|
116226
|
+
parseSibling(stack, parent, index, remainingAfterClose);
|
|
116227
|
+
}
|
|
116228
|
+
};
|
|
116229
|
+
// Process the nodes with the components depth-first to maintain the correct order of the nodes
|
|
116230
|
+
while (stack.length) {
|
|
116231
|
+
const parent = stack.pop();
|
|
116232
|
+
if (parent?.children) {
|
|
116233
|
+
parent.children.forEach((_child, index) => {
|
|
116234
|
+
processChildNode(parent, index);
|
|
116235
|
+
});
|
|
116236
|
+
}
|
|
116237
|
+
}
|
|
116238
|
+
return tree;
|
|
116239
|
+
};
|
|
116240
|
+
/* harmony default export */ const mdxish_component_blocks = (mdxishComponentBlocks);
|
|
116241
|
+
|
|
116082
116242
|
;// ./processor/transform/mdxish/mdxish-html-blocks.ts
|
|
116083
116243
|
|
|
116084
116244
|
|
|
@@ -116414,10 +116574,82 @@ const mdxishHtmlBlocks = () => tree => {
|
|
|
116414
116574
|
};
|
|
116415
116575
|
/* harmony default export */ const mdxish_html_blocks = (mdxishHtmlBlocks);
|
|
116416
116576
|
|
|
116577
|
+
;// ./processor/transform/mdxish/mdxish-inline-components.ts
|
|
116578
|
+
|
|
116579
|
+
|
|
116580
|
+
|
|
116581
|
+
// Matches any PascalCase inline component opening tag. Groups: (name, attrs).
|
|
116582
|
+
// Uses [A-Za-z0-9_]* to match block version in mdxish-component-blocks.ts
|
|
116583
|
+
const INLINE_COMPONENT_OPEN_RE = /^<([A-Z][A-Za-z0-9_]*)(\s[^>]*)?>$/;
|
|
116584
|
+
function toMdxJsxTextElement(name, attributes, children) {
|
|
116585
|
+
return {
|
|
116586
|
+
type: 'mdxJsxTextElement',
|
|
116587
|
+
name,
|
|
116588
|
+
attributes,
|
|
116589
|
+
children,
|
|
116590
|
+
};
|
|
116591
|
+
}
|
|
116592
|
+
/**
|
|
116593
|
+
* Transforms inline html component nodes (e.g. <Anchor>) into proper MDAST phrasing content.
|
|
116594
|
+
*
|
|
116595
|
+
* Inline components are excluded from mdxishComponentBlocks (which only handles block-level
|
|
116596
|
+
* elements), so they remain as scattered html/text/html sibling nodes inside a paragraph.
|
|
116597
|
+
* This plugin merges them into a single typed MDAST node.
|
|
116598
|
+
*/
|
|
116599
|
+
const mdxishInlineComponents = () => tree => {
|
|
116600
|
+
visit(tree, 'html', (node, index, parent) => {
|
|
116601
|
+
if (!parent || index === undefined)
|
|
116602
|
+
return;
|
|
116603
|
+
const match = node.value?.match(INLINE_COMPONENT_OPEN_RE);
|
|
116604
|
+
if (!match)
|
|
116605
|
+
return;
|
|
116606
|
+
const [, name, attrStr] = match;
|
|
116607
|
+
if (!constants_INLINE_COMPONENT_TAGS.has(name))
|
|
116608
|
+
return;
|
|
116609
|
+
// Parse attributes directly - preserves all attribute types (strings, booleans, objects, arrays)
|
|
116610
|
+
const attributes = parseAttributes(attrStr ?? '');
|
|
116611
|
+
// Find closing tag with whitespace-tolerant matching
|
|
116612
|
+
let closeIdx = index + 1;
|
|
116613
|
+
while (closeIdx < parent.children.length) {
|
|
116614
|
+
const sib = parent.children[closeIdx];
|
|
116615
|
+
if (sib.type === 'html' && sib.value?.trim() === `</${name}>`)
|
|
116616
|
+
break;
|
|
116617
|
+
closeIdx += 1;
|
|
116618
|
+
}
|
|
116619
|
+
if (closeIdx >= parent.children.length)
|
|
116620
|
+
return;
|
|
116621
|
+
// Extract all nodes between opening tag (index) and closing tag (closeIdx).
|
|
116622
|
+
// These are the inline component's children (e.g., text, emphasis, links).
|
|
116623
|
+
// Example: "<Anchor>click **here**</Anchor>" → children = [text, strong]
|
|
116624
|
+
const children = parent.children.slice(index + 1, closeIdx);
|
|
116625
|
+
const newNode = toMdxJsxTextElement(name, attributes, children);
|
|
116626
|
+
parent.children.splice(index, closeIdx - index + 1, newNode);
|
|
116627
|
+
});
|
|
116628
|
+
};
|
|
116629
|
+
/* harmony default export */ const mdxish_inline_components = (mdxishInlineComponents);
|
|
116630
|
+
|
|
116417
116631
|
;// ./processor/transform/mdxish/mdxish-jsx-to-mdast.ts
|
|
116418
116632
|
|
|
116419
116633
|
|
|
116420
116634
|
|
|
116635
|
+
const transformAnchor = (jsx) => {
|
|
116636
|
+
const attrs = getAttrs(jsx);
|
|
116637
|
+
const { href = '', label, target, title } = attrs;
|
|
116638
|
+
return {
|
|
116639
|
+
type: NodeTypes.anchor,
|
|
116640
|
+
children: jsx.children,
|
|
116641
|
+
data: {
|
|
116642
|
+
hName: 'Anchor',
|
|
116643
|
+
hProperties: {
|
|
116644
|
+
href,
|
|
116645
|
+
...(label && { label }),
|
|
116646
|
+
...(target && { target }),
|
|
116647
|
+
...(title && { title }),
|
|
116648
|
+
},
|
|
116649
|
+
},
|
|
116650
|
+
position: jsx.position,
|
|
116651
|
+
};
|
|
116652
|
+
};
|
|
116421
116653
|
const transformImage = (jsx) => {
|
|
116422
116654
|
const attrs = getAttrs(jsx);
|
|
116423
116655
|
const { align, alt = '', border, caption, className, height, lazy, src = '', title = '', width } = attrs;
|
|
@@ -116471,7 +116703,7 @@ const transformCallout = (jsx) => {
|
|
|
116471
116703
|
};
|
|
116472
116704
|
const transformEmbed = (jsx) => {
|
|
116473
116705
|
const attrs = getAttrs(jsx);
|
|
116474
|
-
const { favicon, html, iframe, image, providerName, providerUrl, title = '', url = '' } = attrs;
|
|
116706
|
+
const { favicon, height, html, iframe, image, providerName, providerUrl, title = '', typeOfEmbed, url = '', width } = attrs;
|
|
116475
116707
|
return {
|
|
116476
116708
|
type: NodeTypes.embedBlock,
|
|
116477
116709
|
title,
|
|
@@ -116482,11 +116714,14 @@ const transformEmbed = (jsx) => {
|
|
|
116482
116714
|
title,
|
|
116483
116715
|
url,
|
|
116484
116716
|
...(favicon && { favicon }),
|
|
116717
|
+
...(height && { height }),
|
|
116485
116718
|
...(html && { html }),
|
|
116486
116719
|
...(iframe !== undefined && { iframe }),
|
|
116487
116720
|
...(image && { image }),
|
|
116488
116721
|
...(providerName && { providerName }),
|
|
116489
116722
|
...(providerUrl && { providerUrl }),
|
|
116723
|
+
...(typeOfEmbed && { typeOfEmbed }),
|
|
116724
|
+
...(width && { width }),
|
|
116490
116725
|
},
|
|
116491
116726
|
},
|
|
116492
116727
|
position: jsx.position,
|
|
@@ -116582,7 +116817,7 @@ const COMPONENT_MAP = {
|
|
|
116582
116817
|
* This is controlled by the `newEditorTypes` flag to maintain backwards compatibility.
|
|
116583
116818
|
*/
|
|
116584
116819
|
const mdxishJsxToMdast = () => tree => {
|
|
116585
|
-
//
|
|
116820
|
+
// Block JSX components (Image, Callout, Embed, Recipe)
|
|
116586
116821
|
visit(tree, 'mdxJsxFlowElement', (node, index, parent) => {
|
|
116587
116822
|
if (!parent || index === undefined || !node.name)
|
|
116588
116823
|
return;
|
|
@@ -116593,6 +116828,15 @@ const mdxishJsxToMdast = () => tree => {
|
|
|
116593
116828
|
// Replace the JSX node with the MDAST node
|
|
116594
116829
|
parent.children[index] = newNode;
|
|
116595
116830
|
});
|
|
116831
|
+
// Inline JSX components (Anchor)
|
|
116832
|
+
visit(tree, 'mdxJsxTextElement', (node, index, parent) => {
|
|
116833
|
+
if (!parent || index === undefined || !node.name)
|
|
116834
|
+
return;
|
|
116835
|
+
if (node.name === 'Anchor') {
|
|
116836
|
+
const newNode = transformAnchor(node);
|
|
116837
|
+
parent.children[index] = newNode;
|
|
116838
|
+
}
|
|
116839
|
+
});
|
|
116596
116840
|
// Transform magic block images (type: 'image') to image-block
|
|
116597
116841
|
// Note: Standard markdown images are wrapped in paragraphs and handled by imageTransformer
|
|
116598
116842
|
// Magic block images are direct children of root, so we handle them here
|
|
@@ -116661,12 +116905,6 @@ const mdxishMermaidTransformer = () => (tree) => {
|
|
|
116661
116905
|
};
|
|
116662
116906
|
/* harmony default export */ const mdxish_mermaid = (mdxishMermaidTransformer);
|
|
116663
116907
|
|
|
116664
|
-
;// ./lib/constants.ts
|
|
116665
|
-
/**
|
|
116666
|
-
* Pattern to match component tags (PascalCase or snake_case)
|
|
116667
|
-
*/
|
|
116668
|
-
const componentTagPattern = /<(\/?[A-Z][A-Za-z0-9_]*)([^>]*?)(\/?)>/g;
|
|
116669
|
-
|
|
116670
116908
|
;// ./processor/transform/mdxish/mdxish-snake-case-components.ts
|
|
116671
116909
|
|
|
116672
116910
|
|
|
@@ -117102,6 +117340,49 @@ const variablesTextTransformer = () => tree => {
|
|
|
117102
117340
|
};
|
|
117103
117341
|
/* harmony default export */ const variables_text = (variablesTextTransformer);
|
|
117104
117342
|
|
|
117343
|
+
;// ./lib/mdast-util/jsx-table/index.ts
|
|
117344
|
+
const jsx_table_contextMap = new WeakMap();
|
|
117345
|
+
function findJsxTableToken() {
|
|
117346
|
+
const events = this.tokenStack;
|
|
117347
|
+
for (let i = events.length - 1; i >= 0; i -= 1) {
|
|
117348
|
+
if (events[i][0].type === 'jsxTable')
|
|
117349
|
+
return events[i][0];
|
|
117350
|
+
}
|
|
117351
|
+
return undefined;
|
|
117352
|
+
}
|
|
117353
|
+
function enterJsxTable(token) {
|
|
117354
|
+
jsx_table_contextMap.set(token, { chunks: [] });
|
|
117355
|
+
this.enter({ type: 'html', value: '' }, token);
|
|
117356
|
+
}
|
|
117357
|
+
function exitJsxTableData(token) {
|
|
117358
|
+
const tableToken = findJsxTableToken.call(this);
|
|
117359
|
+
if (!tableToken)
|
|
117360
|
+
return;
|
|
117361
|
+
const ctx = jsx_table_contextMap.get(tableToken);
|
|
117362
|
+
if (ctx)
|
|
117363
|
+
ctx.chunks.push(this.sliceSerialize(token));
|
|
117364
|
+
}
|
|
117365
|
+
function exitJsxTable(token) {
|
|
117366
|
+
const ctx = jsx_table_contextMap.get(token);
|
|
117367
|
+
const node = this.stack[this.stack.length - 1];
|
|
117368
|
+
if (ctx) {
|
|
117369
|
+
node.value = ctx.chunks.join('\n');
|
|
117370
|
+
jsx_table_contextMap.delete(token);
|
|
117371
|
+
}
|
|
117372
|
+
this.exit(token);
|
|
117373
|
+
}
|
|
117374
|
+
function jsxTableFromMarkdown() {
|
|
117375
|
+
return {
|
|
117376
|
+
enter: {
|
|
117377
|
+
jsxTable: enterJsxTable,
|
|
117378
|
+
},
|
|
117379
|
+
exit: {
|
|
117380
|
+
jsxTableData: exitJsxTableData,
|
|
117381
|
+
jsxTable: exitJsxTable,
|
|
117382
|
+
},
|
|
117383
|
+
};
|
|
117384
|
+
}
|
|
117385
|
+
|
|
117105
117386
|
;// ./lib/mdast-util/magic-block/index.ts
|
|
117106
117387
|
const magic_block_contextMap = new WeakMap();
|
|
117107
117388
|
/**
|
|
@@ -117258,6 +117539,685 @@ function magicBlockToMarkdown() {
|
|
|
117258
117539
|
};
|
|
117259
117540
|
}
|
|
117260
117541
|
|
|
117542
|
+
;// ./node_modules/micromark-util-symbol/lib/types.js
|
|
117543
|
+
/**
|
|
117544
|
+
* This module is compiled away!
|
|
117545
|
+
*
|
|
117546
|
+
* Here is the list of all types of tokens exposed by micromark, with a short
|
|
117547
|
+
* explanation of what they include and where they are found.
|
|
117548
|
+
* In picking names, generally, the rule is to be as explicit as possible
|
|
117549
|
+
* instead of reusing names.
|
|
117550
|
+
* For example, there is a `definitionDestination` and a `resourceDestination`,
|
|
117551
|
+
* instead of one shared name.
|
|
117552
|
+
*/
|
|
117553
|
+
|
|
117554
|
+
// Note: when changing the next record, you must also change `TokenTypeMap`
|
|
117555
|
+
// in `micromark-util-types/index.d.ts`.
|
|
117556
|
+
const types_types = /** @type {const} */ ({
|
|
117557
|
+
// Generic type for data, such as in a title, a destination, etc.
|
|
117558
|
+
data: 'data',
|
|
117559
|
+
|
|
117560
|
+
// Generic type for syntactic whitespace (tabs, virtual spaces, spaces).
|
|
117561
|
+
// Such as, between a fenced code fence and an info string.
|
|
117562
|
+
whitespace: 'whitespace',
|
|
117563
|
+
|
|
117564
|
+
// Generic type for line endings (line feed, carriage return, carriage return +
|
|
117565
|
+
// line feed).
|
|
117566
|
+
lineEnding: 'lineEnding',
|
|
117567
|
+
|
|
117568
|
+
// A line ending, but ending a blank line.
|
|
117569
|
+
lineEndingBlank: 'lineEndingBlank',
|
|
117570
|
+
|
|
117571
|
+
// Generic type for whitespace (tabs, virtual spaces, spaces) at the start of a
|
|
117572
|
+
// line.
|
|
117573
|
+
linePrefix: 'linePrefix',
|
|
117574
|
+
|
|
117575
|
+
// Generic type for whitespace (tabs, virtual spaces, spaces) at the end of a
|
|
117576
|
+
// line.
|
|
117577
|
+
lineSuffix: 'lineSuffix',
|
|
117578
|
+
|
|
117579
|
+
// Whole ATX heading:
|
|
117580
|
+
//
|
|
117581
|
+
// ```markdown
|
|
117582
|
+
// #
|
|
117583
|
+
// ## Alpha
|
|
117584
|
+
// ### Bravo ###
|
|
117585
|
+
// ```
|
|
117586
|
+
//
|
|
117587
|
+
// Includes `atxHeadingSequence`, `whitespace`, `atxHeadingText`.
|
|
117588
|
+
atxHeading: 'atxHeading',
|
|
117589
|
+
|
|
117590
|
+
// Sequence of number signs in an ATX heading (`###`).
|
|
117591
|
+
atxHeadingSequence: 'atxHeadingSequence',
|
|
117592
|
+
|
|
117593
|
+
// Content in an ATX heading (`alpha`).
|
|
117594
|
+
// Includes text.
|
|
117595
|
+
atxHeadingText: 'atxHeadingText',
|
|
117596
|
+
|
|
117597
|
+
// Whole autolink (`<https://example.com>` or `<admin@example.com>`)
|
|
117598
|
+
// Includes `autolinkMarker` and `autolinkProtocol` or `autolinkEmail`.
|
|
117599
|
+
autolink: 'autolink',
|
|
117600
|
+
|
|
117601
|
+
// Email autolink w/o markers (`admin@example.com`)
|
|
117602
|
+
autolinkEmail: 'autolinkEmail',
|
|
117603
|
+
|
|
117604
|
+
// Marker around an `autolinkProtocol` or `autolinkEmail` (`<` or `>`).
|
|
117605
|
+
autolinkMarker: 'autolinkMarker',
|
|
117606
|
+
|
|
117607
|
+
// Protocol autolink w/o markers (`https://example.com`)
|
|
117608
|
+
autolinkProtocol: 'autolinkProtocol',
|
|
117609
|
+
|
|
117610
|
+
// A whole character escape (`\-`).
|
|
117611
|
+
// Includes `escapeMarker` and `characterEscapeValue`.
|
|
117612
|
+
characterEscape: 'characterEscape',
|
|
117613
|
+
|
|
117614
|
+
// The escaped character (`-`).
|
|
117615
|
+
characterEscapeValue: 'characterEscapeValue',
|
|
117616
|
+
|
|
117617
|
+
// A whole character reference (`&`, `≠`, or `𝌆`).
|
|
117618
|
+
// Includes `characterReferenceMarker`, an optional
|
|
117619
|
+
// `characterReferenceMarkerNumeric`, in which case an optional
|
|
117620
|
+
// `characterReferenceMarkerHexadecimal`, and a `characterReferenceValue`.
|
|
117621
|
+
characterReference: 'characterReference',
|
|
117622
|
+
|
|
117623
|
+
// The start or end marker (`&` or `;`).
|
|
117624
|
+
characterReferenceMarker: 'characterReferenceMarker',
|
|
117625
|
+
|
|
117626
|
+
// Mark reference as numeric (`#`).
|
|
117627
|
+
characterReferenceMarkerNumeric: 'characterReferenceMarkerNumeric',
|
|
117628
|
+
|
|
117629
|
+
// Mark reference as numeric (`x` or `X`).
|
|
117630
|
+
characterReferenceMarkerHexadecimal: 'characterReferenceMarkerHexadecimal',
|
|
117631
|
+
|
|
117632
|
+
// Value of character reference w/o markers (`amp`, `8800`, or `1D306`).
|
|
117633
|
+
characterReferenceValue: 'characterReferenceValue',
|
|
117634
|
+
|
|
117635
|
+
// Whole fenced code:
|
|
117636
|
+
//
|
|
117637
|
+
// ````markdown
|
|
117638
|
+
// ```js
|
|
117639
|
+
// alert(1)
|
|
117640
|
+
// ```
|
|
117641
|
+
// ````
|
|
117642
|
+
codeFenced: 'codeFenced',
|
|
117643
|
+
|
|
117644
|
+
// A fenced code fence, including whitespace, sequence, info, and meta
|
|
117645
|
+
// (` ```js `).
|
|
117646
|
+
codeFencedFence: 'codeFencedFence',
|
|
117647
|
+
|
|
117648
|
+
// Sequence of grave accent or tilde characters (` ``` `) in a fence.
|
|
117649
|
+
codeFencedFenceSequence: 'codeFencedFenceSequence',
|
|
117650
|
+
|
|
117651
|
+
// Info word (`js`) in a fence.
|
|
117652
|
+
// Includes string.
|
|
117653
|
+
codeFencedFenceInfo: 'codeFencedFenceInfo',
|
|
117654
|
+
|
|
117655
|
+
// Meta words (`highlight="1"`) in a fence.
|
|
117656
|
+
// Includes string.
|
|
117657
|
+
codeFencedFenceMeta: 'codeFencedFenceMeta',
|
|
117658
|
+
|
|
117659
|
+
// A line of code.
|
|
117660
|
+
codeFlowValue: 'codeFlowValue',
|
|
117661
|
+
|
|
117662
|
+
// Whole indented code:
|
|
117663
|
+
//
|
|
117664
|
+
// ```markdown
|
|
117665
|
+
// alert(1)
|
|
117666
|
+
// ```
|
|
117667
|
+
//
|
|
117668
|
+
// Includes `lineEnding`, `linePrefix`, and `codeFlowValue`.
|
|
117669
|
+
codeIndented: 'codeIndented',
|
|
117670
|
+
|
|
117671
|
+
// A text code (``` `alpha` ```).
|
|
117672
|
+
// Includes `codeTextSequence`, `codeTextData`, `lineEnding`, and can include
|
|
117673
|
+
// `codeTextPadding`.
|
|
117674
|
+
codeText: 'codeText',
|
|
117675
|
+
|
|
117676
|
+
codeTextData: 'codeTextData',
|
|
117677
|
+
|
|
117678
|
+
// A space or line ending right after or before a tick.
|
|
117679
|
+
codeTextPadding: 'codeTextPadding',
|
|
117680
|
+
|
|
117681
|
+
// A text code fence (` `` `).
|
|
117682
|
+
codeTextSequence: 'codeTextSequence',
|
|
117683
|
+
|
|
117684
|
+
// Whole content:
|
|
117685
|
+
//
|
|
117686
|
+
// ```markdown
|
|
117687
|
+
// [a]: b
|
|
117688
|
+
// c
|
|
117689
|
+
// =
|
|
117690
|
+
// d
|
|
117691
|
+
// ```
|
|
117692
|
+
//
|
|
117693
|
+
// Includes `paragraph` and `definition`.
|
|
117694
|
+
content: 'content',
|
|
117695
|
+
// Whole definition:
|
|
117696
|
+
//
|
|
117697
|
+
// ```markdown
|
|
117698
|
+
// [micromark]: https://github.com/micromark/micromark
|
|
117699
|
+
// ```
|
|
117700
|
+
//
|
|
117701
|
+
// Includes `definitionLabel`, `definitionMarker`, `whitespace`,
|
|
117702
|
+
// `definitionDestination`, and optionally `lineEnding` and `definitionTitle`.
|
|
117703
|
+
definition: 'definition',
|
|
117704
|
+
|
|
117705
|
+
// Destination of a definition (`https://github.com/micromark/micromark` or
|
|
117706
|
+
// `<https://github.com/micromark/micromark>`).
|
|
117707
|
+
// Includes `definitionDestinationLiteral` or `definitionDestinationRaw`.
|
|
117708
|
+
definitionDestination: 'definitionDestination',
|
|
117709
|
+
|
|
117710
|
+
// Enclosed destination of a definition
|
|
117711
|
+
// (`<https://github.com/micromark/micromark>`).
|
|
117712
|
+
// Includes `definitionDestinationLiteralMarker` and optionally
|
|
117713
|
+
// `definitionDestinationString`.
|
|
117714
|
+
definitionDestinationLiteral: 'definitionDestinationLiteral',
|
|
117715
|
+
|
|
117716
|
+
// Markers of an enclosed definition destination (`<` or `>`).
|
|
117717
|
+
definitionDestinationLiteralMarker: 'definitionDestinationLiteralMarker',
|
|
117718
|
+
|
|
117719
|
+
// Unenclosed destination of a definition
|
|
117720
|
+
// (`https://github.com/micromark/micromark`).
|
|
117721
|
+
// Includes `definitionDestinationString`.
|
|
117722
|
+
definitionDestinationRaw: 'definitionDestinationRaw',
|
|
117723
|
+
|
|
117724
|
+
// Text in an destination (`https://github.com/micromark/micromark`).
|
|
117725
|
+
// Includes string.
|
|
117726
|
+
definitionDestinationString: 'definitionDestinationString',
|
|
117727
|
+
|
|
117728
|
+
// Label of a definition (`[micromark]`).
|
|
117729
|
+
// Includes `definitionLabelMarker` and `definitionLabelString`.
|
|
117730
|
+
definitionLabel: 'definitionLabel',
|
|
117731
|
+
|
|
117732
|
+
// Markers of a definition label (`[` or `]`).
|
|
117733
|
+
definitionLabelMarker: 'definitionLabelMarker',
|
|
117734
|
+
|
|
117735
|
+
// Value of a definition label (`micromark`).
|
|
117736
|
+
// Includes string.
|
|
117737
|
+
definitionLabelString: 'definitionLabelString',
|
|
117738
|
+
|
|
117739
|
+
// Marker between a label and a destination (`:`).
|
|
117740
|
+
definitionMarker: 'definitionMarker',
|
|
117741
|
+
|
|
117742
|
+
// Title of a definition (`"x"`, `'y'`, or `(z)`).
|
|
117743
|
+
// Includes `definitionTitleMarker` and optionally `definitionTitleString`.
|
|
117744
|
+
definitionTitle: 'definitionTitle',
|
|
117745
|
+
|
|
117746
|
+
// Marker around a title of a definition (`"`, `'`, `(`, or `)`).
|
|
117747
|
+
definitionTitleMarker: 'definitionTitleMarker',
|
|
117748
|
+
|
|
117749
|
+
// Data without markers in a title (`z`).
|
|
117750
|
+
// Includes string.
|
|
117751
|
+
definitionTitleString: 'definitionTitleString',
|
|
117752
|
+
|
|
117753
|
+
// Emphasis (`*alpha*`).
|
|
117754
|
+
// Includes `emphasisSequence` and `emphasisText`.
|
|
117755
|
+
emphasis: 'emphasis',
|
|
117756
|
+
|
|
117757
|
+
// Sequence of emphasis markers (`*` or `_`).
|
|
117758
|
+
emphasisSequence: 'emphasisSequence',
|
|
117759
|
+
|
|
117760
|
+
// Emphasis text (`alpha`).
|
|
117761
|
+
// Includes text.
|
|
117762
|
+
emphasisText: 'emphasisText',
|
|
117763
|
+
|
|
117764
|
+
// The character escape marker (`\`).
|
|
117765
|
+
escapeMarker: 'escapeMarker',
|
|
117766
|
+
|
|
117767
|
+
// A hard break created with a backslash (`\\n`).
|
|
117768
|
+
// Note: does not include the line ending.
|
|
117769
|
+
hardBreakEscape: 'hardBreakEscape',
|
|
117770
|
+
|
|
117771
|
+
// A hard break created with trailing spaces (` \n`).
|
|
117772
|
+
// Does not include the line ending.
|
|
117773
|
+
hardBreakTrailing: 'hardBreakTrailing',
|
|
117774
|
+
|
|
117775
|
+
// Flow HTML:
|
|
117776
|
+
//
|
|
117777
|
+
// ```markdown
|
|
117778
|
+
// <div
|
|
117779
|
+
// ```
|
|
117780
|
+
//
|
|
117781
|
+
// Inlcudes `lineEnding`, `htmlFlowData`.
|
|
117782
|
+
htmlFlow: 'htmlFlow',
|
|
117783
|
+
|
|
117784
|
+
htmlFlowData: 'htmlFlowData',
|
|
117785
|
+
|
|
117786
|
+
// HTML in text (the tag in `a <i> b`).
|
|
117787
|
+
// Includes `lineEnding`, `htmlTextData`.
|
|
117788
|
+
htmlText: 'htmlText',
|
|
117789
|
+
|
|
117790
|
+
htmlTextData: 'htmlTextData',
|
|
117791
|
+
|
|
117792
|
+
// Whole image (``, `![alpha][bravo]`, `![alpha][]`, or
|
|
117793
|
+
// `![alpha]`).
|
|
117794
|
+
// Includes `label` and an optional `resource` or `reference`.
|
|
117795
|
+
image: 'image',
|
|
117796
|
+
|
|
117797
|
+
// Whole link label (`[*alpha*]`).
|
|
117798
|
+
// Includes `labelLink` or `labelImage`, `labelText`, and `labelEnd`.
|
|
117799
|
+
label: 'label',
|
|
117800
|
+
|
|
117801
|
+
// Text in an label (`*alpha*`).
|
|
117802
|
+
// Includes text.
|
|
117803
|
+
labelText: 'labelText',
|
|
117804
|
+
|
|
117805
|
+
// Start a link label (`[`).
|
|
117806
|
+
// Includes a `labelMarker`.
|
|
117807
|
+
labelLink: 'labelLink',
|
|
117808
|
+
|
|
117809
|
+
// Start an image label (`![`).
|
|
117810
|
+
// Includes `labelImageMarker` and `labelMarker`.
|
|
117811
|
+
labelImage: 'labelImage',
|
|
117812
|
+
|
|
117813
|
+
// Marker of a label (`[` or `]`).
|
|
117814
|
+
labelMarker: 'labelMarker',
|
|
117815
|
+
|
|
117816
|
+
// Marker to start an image (`!`).
|
|
117817
|
+
labelImageMarker: 'labelImageMarker',
|
|
117818
|
+
|
|
117819
|
+
// End a label (`]`).
|
|
117820
|
+
// Includes `labelMarker`.
|
|
117821
|
+
labelEnd: 'labelEnd',
|
|
117822
|
+
|
|
117823
|
+
// Whole link (`[alpha](bravo)`, `[alpha][bravo]`, `[alpha][]`, or `[alpha]`).
|
|
117824
|
+
// Includes `label` and an optional `resource` or `reference`.
|
|
117825
|
+
link: 'link',
|
|
117826
|
+
|
|
117827
|
+
// Whole paragraph:
|
|
117828
|
+
//
|
|
117829
|
+
// ```markdown
|
|
117830
|
+
// alpha
|
|
117831
|
+
// bravo.
|
|
117832
|
+
// ```
|
|
117833
|
+
//
|
|
117834
|
+
// Includes text.
|
|
117835
|
+
paragraph: 'paragraph',
|
|
117836
|
+
|
|
117837
|
+
// A reference (`[alpha]` or `[]`).
|
|
117838
|
+
// Includes `referenceMarker` and an optional `referenceString`.
|
|
117839
|
+
reference: 'reference',
|
|
117840
|
+
|
|
117841
|
+
// A reference marker (`[` or `]`).
|
|
117842
|
+
referenceMarker: 'referenceMarker',
|
|
117843
|
+
|
|
117844
|
+
// Reference text (`alpha`).
|
|
117845
|
+
// Includes string.
|
|
117846
|
+
referenceString: 'referenceString',
|
|
117847
|
+
|
|
117848
|
+
// A resource (`(https://example.com "alpha")`).
|
|
117849
|
+
// Includes `resourceMarker`, an optional `resourceDestination` with an optional
|
|
117850
|
+
// `whitespace` and `resourceTitle`.
|
|
117851
|
+
resource: 'resource',
|
|
117852
|
+
|
|
117853
|
+
// A resource destination (`https://example.com`).
|
|
117854
|
+
// Includes `resourceDestinationLiteral` or `resourceDestinationRaw`.
|
|
117855
|
+
resourceDestination: 'resourceDestination',
|
|
117856
|
+
|
|
117857
|
+
// A literal resource destination (`<https://example.com>`).
|
|
117858
|
+
// Includes `resourceDestinationLiteralMarker` and optionally
|
|
117859
|
+
// `resourceDestinationString`.
|
|
117860
|
+
resourceDestinationLiteral: 'resourceDestinationLiteral',
|
|
117861
|
+
|
|
117862
|
+
// A resource destination marker (`<` or `>`).
|
|
117863
|
+
resourceDestinationLiteralMarker: 'resourceDestinationLiteralMarker',
|
|
117864
|
+
|
|
117865
|
+
// A raw resource destination (`https://example.com`).
|
|
117866
|
+
// Includes `resourceDestinationString`.
|
|
117867
|
+
resourceDestinationRaw: 'resourceDestinationRaw',
|
|
117868
|
+
|
|
117869
|
+
// Resource destination text (`https://example.com`).
|
|
117870
|
+
// Includes string.
|
|
117871
|
+
resourceDestinationString: 'resourceDestinationString',
|
|
117872
|
+
|
|
117873
|
+
// A resource marker (`(` or `)`).
|
|
117874
|
+
resourceMarker: 'resourceMarker',
|
|
117875
|
+
|
|
117876
|
+
// A resource title (`"alpha"`, `'alpha'`, or `(alpha)`).
|
|
117877
|
+
// Includes `resourceTitleMarker` and optionally `resourceTitleString`.
|
|
117878
|
+
resourceTitle: 'resourceTitle',
|
|
117879
|
+
|
|
117880
|
+
// A resource title marker (`"`, `'`, `(`, or `)`).
|
|
117881
|
+
resourceTitleMarker: 'resourceTitleMarker',
|
|
117882
|
+
|
|
117883
|
+
// Resource destination title (`alpha`).
|
|
117884
|
+
// Includes string.
|
|
117885
|
+
resourceTitleString: 'resourceTitleString',
|
|
117886
|
+
|
|
117887
|
+
// Whole setext heading:
|
|
117888
|
+
//
|
|
117889
|
+
// ```markdown
|
|
117890
|
+
// alpha
|
|
117891
|
+
// bravo
|
|
117892
|
+
// =====
|
|
117893
|
+
// ```
|
|
117894
|
+
//
|
|
117895
|
+
// Includes `setextHeadingText`, `lineEnding`, `linePrefix`, and
|
|
117896
|
+
// `setextHeadingLine`.
|
|
117897
|
+
setextHeading: 'setextHeading',
|
|
117898
|
+
|
|
117899
|
+
// Content in a setext heading (`alpha\nbravo`).
|
|
117900
|
+
// Includes text.
|
|
117901
|
+
setextHeadingText: 'setextHeadingText',
|
|
117902
|
+
|
|
117903
|
+
// Underline in a setext heading, including whitespace suffix (`==`).
|
|
117904
|
+
// Includes `setextHeadingLineSequence`.
|
|
117905
|
+
setextHeadingLine: 'setextHeadingLine',
|
|
117906
|
+
|
|
117907
|
+
// Sequence of equals or dash characters in underline in a setext heading (`-`).
|
|
117908
|
+
setextHeadingLineSequence: 'setextHeadingLineSequence',
|
|
117909
|
+
|
|
117910
|
+
// Strong (`**alpha**`).
|
|
117911
|
+
// Includes `strongSequence` and `strongText`.
|
|
117912
|
+
strong: 'strong',
|
|
117913
|
+
|
|
117914
|
+
// Sequence of strong markers (`**` or `__`).
|
|
117915
|
+
strongSequence: 'strongSequence',
|
|
117916
|
+
|
|
117917
|
+
// Strong text (`alpha`).
|
|
117918
|
+
// Includes text.
|
|
117919
|
+
strongText: 'strongText',
|
|
117920
|
+
|
|
117921
|
+
// Whole thematic break:
|
|
117922
|
+
//
|
|
117923
|
+
// ```markdown
|
|
117924
|
+
// * * *
|
|
117925
|
+
// ```
|
|
117926
|
+
//
|
|
117927
|
+
// Includes `thematicBreakSequence` and `whitespace`.
|
|
117928
|
+
thematicBreak: 'thematicBreak',
|
|
117929
|
+
|
|
117930
|
+
// A sequence of one or more thematic break markers (`***`).
|
|
117931
|
+
thematicBreakSequence: 'thematicBreakSequence',
|
|
117932
|
+
|
|
117933
|
+
// Whole block quote:
|
|
117934
|
+
//
|
|
117935
|
+
// ```markdown
|
|
117936
|
+
// > a
|
|
117937
|
+
// >
|
|
117938
|
+
// > b
|
|
117939
|
+
// ```
|
|
117940
|
+
//
|
|
117941
|
+
// Includes `blockQuotePrefix` and flow.
|
|
117942
|
+
blockQuote: 'blockQuote',
|
|
117943
|
+
// The `>` or `> ` of a block quote.
|
|
117944
|
+
blockQuotePrefix: 'blockQuotePrefix',
|
|
117945
|
+
// The `>` of a block quote prefix.
|
|
117946
|
+
blockQuoteMarker: 'blockQuoteMarker',
|
|
117947
|
+
// The optional ` ` of a block quote prefix.
|
|
117948
|
+
blockQuotePrefixWhitespace: 'blockQuotePrefixWhitespace',
|
|
117949
|
+
|
|
117950
|
+
// Whole ordered list:
|
|
117951
|
+
//
|
|
117952
|
+
// ```markdown
|
|
117953
|
+
// 1. a
|
|
117954
|
+
// b
|
|
117955
|
+
// ```
|
|
117956
|
+
//
|
|
117957
|
+
// Includes `listItemPrefix`, flow, and optionally `listItemIndent` on further
|
|
117958
|
+
// lines.
|
|
117959
|
+
listOrdered: 'listOrdered',
|
|
117960
|
+
|
|
117961
|
+
// Whole unordered list:
|
|
117962
|
+
//
|
|
117963
|
+
// ```markdown
|
|
117964
|
+
// - a
|
|
117965
|
+
// b
|
|
117966
|
+
// ```
|
|
117967
|
+
//
|
|
117968
|
+
// Includes `listItemPrefix`, flow, and optionally `listItemIndent` on further
|
|
117969
|
+
// lines.
|
|
117970
|
+
listUnordered: 'listUnordered',
|
|
117971
|
+
|
|
117972
|
+
// The indent of further list item lines.
|
|
117973
|
+
listItemIndent: 'listItemIndent',
|
|
117974
|
+
|
|
117975
|
+
// A marker, as in, `*`, `+`, `-`, `.`, or `)`.
|
|
117976
|
+
listItemMarker: 'listItemMarker',
|
|
117977
|
+
|
|
117978
|
+
// The thing that starts a list item, such as `1. `.
|
|
117979
|
+
// Includes `listItemValue` if ordered, `listItemMarker`, and
|
|
117980
|
+
// `listItemPrefixWhitespace` (unless followed by a line ending).
|
|
117981
|
+
listItemPrefix: 'listItemPrefix',
|
|
117982
|
+
|
|
117983
|
+
// The whitespace after a marker.
|
|
117984
|
+
listItemPrefixWhitespace: 'listItemPrefixWhitespace',
|
|
117985
|
+
|
|
117986
|
+
// The numerical value of an ordered item.
|
|
117987
|
+
listItemValue: 'listItemValue',
|
|
117988
|
+
|
|
117989
|
+
// Internal types used for subtokenizers, compiled away
|
|
117990
|
+
chunkDocument: 'chunkDocument',
|
|
117991
|
+
chunkContent: 'chunkContent',
|
|
117992
|
+
chunkFlow: 'chunkFlow',
|
|
117993
|
+
chunkText: 'chunkText',
|
|
117994
|
+
chunkString: 'chunkString'
|
|
117995
|
+
})
|
|
117996
|
+
|
|
117997
|
+
;// ./lib/micromark/jsx-table/syntax.ts
|
|
117998
|
+
|
|
117999
|
+
|
|
118000
|
+
const syntax_nonLazyContinuationStart = {
|
|
118001
|
+
tokenize: syntax_tokenizeNonLazyContinuationStart,
|
|
118002
|
+
partial: true,
|
|
118003
|
+
};
|
|
118004
|
+
function resolveToJsxTable(events) {
|
|
118005
|
+
let index = events.length;
|
|
118006
|
+
while (index > 0) {
|
|
118007
|
+
index -= 1;
|
|
118008
|
+
if (events[index][0] === 'enter' && events[index][1].type === 'jsxTable') {
|
|
118009
|
+
break;
|
|
118010
|
+
}
|
|
118011
|
+
}
|
|
118012
|
+
if (index > 1 && events[index - 2][1].type === types_types.linePrefix) {
|
|
118013
|
+
events[index][1].start = events[index - 2][1].start;
|
|
118014
|
+
events[index + 1][1].start = events[index - 2][1].start;
|
|
118015
|
+
events.splice(index - 2, 2);
|
|
118016
|
+
}
|
|
118017
|
+
return events;
|
|
118018
|
+
}
|
|
118019
|
+
const jsxTableConstruct = {
|
|
118020
|
+
name: 'jsxTable',
|
|
118021
|
+
tokenize: tokenizeJsxTable,
|
|
118022
|
+
resolveTo: resolveToJsxTable,
|
|
118023
|
+
concrete: true,
|
|
118024
|
+
};
|
|
118025
|
+
function tokenizeJsxTable(effects, ok, nok) {
|
|
118026
|
+
let codeSpanOpenSize = 0;
|
|
118027
|
+
let codeSpanCloseSize = 0;
|
|
118028
|
+
let depth = 1;
|
|
118029
|
+
const TABLE_NAME = [codes.uppercaseT, codes.lowercaseA, codes.lowercaseB, codes.lowercaseL, codes.lowercaseE];
|
|
118030
|
+
const ABLE_SUFFIX = TABLE_NAME.slice(1);
|
|
118031
|
+
/** Build a state chain that matches a sequence of character codes. */
|
|
118032
|
+
function matchChars(chars, onMatch, onFail) {
|
|
118033
|
+
if (chars.length === 0)
|
|
118034
|
+
return onMatch;
|
|
118035
|
+
return ((code) => {
|
|
118036
|
+
if (code === chars[0]) {
|
|
118037
|
+
effects.consume(code);
|
|
118038
|
+
return matchChars(chars.slice(1), onMatch, onFail);
|
|
118039
|
+
}
|
|
118040
|
+
return onFail(code);
|
|
118041
|
+
});
|
|
118042
|
+
}
|
|
118043
|
+
return start;
|
|
118044
|
+
function start(code) {
|
|
118045
|
+
if (code !== codes.lessThan)
|
|
118046
|
+
return nok(code);
|
|
118047
|
+
effects.enter('jsxTable');
|
|
118048
|
+
effects.enter('jsxTableData');
|
|
118049
|
+
effects.consume(code);
|
|
118050
|
+
return matchChars(TABLE_NAME, afterTagName, nok);
|
|
118051
|
+
}
|
|
118052
|
+
function afterTagName(code) {
|
|
118053
|
+
if (code === codes.greaterThan || code === codes.slash || code === codes.space || code === codes.horizontalTab) {
|
|
118054
|
+
effects.consume(code);
|
|
118055
|
+
return body;
|
|
118056
|
+
}
|
|
118057
|
+
return nok(code);
|
|
118058
|
+
}
|
|
118059
|
+
function body(code) {
|
|
118060
|
+
// Reject unclosed <Table> so it falls back to normal HTML block parsing
|
|
118061
|
+
// instead of swallowing all subsequent content to EOF
|
|
118062
|
+
if (code === null) {
|
|
118063
|
+
return nok(code);
|
|
118064
|
+
}
|
|
118065
|
+
if (markdownLineEnding(code)) {
|
|
118066
|
+
effects.exit('jsxTableData');
|
|
118067
|
+
return continuationStart(code);
|
|
118068
|
+
}
|
|
118069
|
+
if (code === codes.backslash) {
|
|
118070
|
+
effects.consume(code);
|
|
118071
|
+
return escapedChar;
|
|
118072
|
+
}
|
|
118073
|
+
if (code === codes.lessThan) {
|
|
118074
|
+
effects.consume(code);
|
|
118075
|
+
return closeSlash;
|
|
118076
|
+
}
|
|
118077
|
+
// Skip over backtick code spans so `</Table>` in inline code isn't
|
|
118078
|
+
// treated as the closing tag
|
|
118079
|
+
if (code === codes.graveAccent) {
|
|
118080
|
+
codeSpanOpenSize = 0;
|
|
118081
|
+
return countOpenTicks(code);
|
|
118082
|
+
}
|
|
118083
|
+
effects.consume(code);
|
|
118084
|
+
return body;
|
|
118085
|
+
}
|
|
118086
|
+
function countOpenTicks(code) {
|
|
118087
|
+
if (code === codes.graveAccent) {
|
|
118088
|
+
codeSpanOpenSize += 1;
|
|
118089
|
+
effects.consume(code);
|
|
118090
|
+
return countOpenTicks;
|
|
118091
|
+
}
|
|
118092
|
+
return inCodeSpan(code);
|
|
118093
|
+
}
|
|
118094
|
+
function inCodeSpan(code) {
|
|
118095
|
+
if (code === null || markdownLineEnding(code))
|
|
118096
|
+
return body(code);
|
|
118097
|
+
if (code === codes.graveAccent) {
|
|
118098
|
+
codeSpanCloseSize = 0;
|
|
118099
|
+
return countCloseTicks(code);
|
|
118100
|
+
}
|
|
118101
|
+
effects.consume(code);
|
|
118102
|
+
return inCodeSpan;
|
|
118103
|
+
}
|
|
118104
|
+
function countCloseTicks(code) {
|
|
118105
|
+
if (code === codes.graveAccent) {
|
|
118106
|
+
codeSpanCloseSize += 1;
|
|
118107
|
+
effects.consume(code);
|
|
118108
|
+
return countCloseTicks;
|
|
118109
|
+
}
|
|
118110
|
+
return codeSpanCloseSize === codeSpanOpenSize ? body(code) : inCodeSpan(code);
|
|
118111
|
+
}
|
|
118112
|
+
function escapedChar(code) {
|
|
118113
|
+
if (code === null || markdownLineEnding(code)) {
|
|
118114
|
+
return body(code);
|
|
118115
|
+
}
|
|
118116
|
+
effects.consume(code);
|
|
118117
|
+
return body;
|
|
118118
|
+
}
|
|
118119
|
+
function closeSlash(code) {
|
|
118120
|
+
if (code === codes.slash) {
|
|
118121
|
+
effects.consume(code);
|
|
118122
|
+
return matchChars(TABLE_NAME, closeGt, body);
|
|
118123
|
+
}
|
|
118124
|
+
if (code === codes.uppercaseT) {
|
|
118125
|
+
effects.consume(code);
|
|
118126
|
+
return matchChars(ABLE_SUFFIX, openAfterTagName, body);
|
|
118127
|
+
}
|
|
118128
|
+
return body(code);
|
|
118129
|
+
}
|
|
118130
|
+
function openAfterTagName(code) {
|
|
118131
|
+
if (code === codes.greaterThan || code === codes.slash || code === codes.space || code === codes.horizontalTab) {
|
|
118132
|
+
depth += 1;
|
|
118133
|
+
effects.consume(code);
|
|
118134
|
+
return body;
|
|
118135
|
+
}
|
|
118136
|
+
return body(code);
|
|
118137
|
+
}
|
|
118138
|
+
function closeGt(code) {
|
|
118139
|
+
if (code === codes.greaterThan) {
|
|
118140
|
+
depth -= 1;
|
|
118141
|
+
effects.consume(code);
|
|
118142
|
+
if (depth === 0) {
|
|
118143
|
+
return afterClose;
|
|
118144
|
+
}
|
|
118145
|
+
return body;
|
|
118146
|
+
}
|
|
118147
|
+
return body(code);
|
|
118148
|
+
}
|
|
118149
|
+
function afterClose(code) {
|
|
118150
|
+
if (code === null || markdownLineEnding(code)) {
|
|
118151
|
+
effects.exit('jsxTableData');
|
|
118152
|
+
effects.exit('jsxTable');
|
|
118153
|
+
return ok(code);
|
|
118154
|
+
}
|
|
118155
|
+
effects.consume(code);
|
|
118156
|
+
return afterClose;
|
|
118157
|
+
}
|
|
118158
|
+
// Line ending handling — follows the htmlFlow pattern
|
|
118159
|
+
function continuationStart(code) {
|
|
118160
|
+
return effects.check(syntax_nonLazyContinuationStart, continuationStartNonLazy, continuationAfter)(code);
|
|
118161
|
+
}
|
|
118162
|
+
function continuationStartNonLazy(code) {
|
|
118163
|
+
effects.enter(types_types.lineEnding);
|
|
118164
|
+
effects.consume(code);
|
|
118165
|
+
effects.exit(types_types.lineEnding);
|
|
118166
|
+
return continuationBefore;
|
|
118167
|
+
}
|
|
118168
|
+
function continuationBefore(code) {
|
|
118169
|
+
if (code === null || markdownLineEnding(code)) {
|
|
118170
|
+
return continuationStart(code);
|
|
118171
|
+
}
|
|
118172
|
+
effects.enter('jsxTableData');
|
|
118173
|
+
return body(code);
|
|
118174
|
+
}
|
|
118175
|
+
function continuationAfter(code) {
|
|
118176
|
+
// At EOF without </Table>, reject so content isn't swallowed
|
|
118177
|
+
if (code === null) {
|
|
118178
|
+
return nok(code);
|
|
118179
|
+
}
|
|
118180
|
+
effects.exit('jsxTable');
|
|
118181
|
+
return ok(code);
|
|
118182
|
+
}
|
|
118183
|
+
}
|
|
118184
|
+
function syntax_tokenizeNonLazyContinuationStart(effects, ok, nok) {
|
|
118185
|
+
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
118186
|
+
const self = this;
|
|
118187
|
+
return start;
|
|
118188
|
+
function start(code) {
|
|
118189
|
+
if (markdownLineEnding(code)) {
|
|
118190
|
+
effects.enter(types_types.lineEnding);
|
|
118191
|
+
effects.consume(code);
|
|
118192
|
+
effects.exit(types_types.lineEnding);
|
|
118193
|
+
return after;
|
|
118194
|
+
}
|
|
118195
|
+
return nok(code);
|
|
118196
|
+
}
|
|
118197
|
+
function after(code) {
|
|
118198
|
+
if (self.parser.lazy[self.now().line]) {
|
|
118199
|
+
return nok(code);
|
|
118200
|
+
}
|
|
118201
|
+
return ok(code);
|
|
118202
|
+
}
|
|
118203
|
+
}
|
|
118204
|
+
/**
|
|
118205
|
+
* Micromark extension that tokenizes `<Table>...</Table>` as a single flow block.
|
|
118206
|
+
*
|
|
118207
|
+
* Prevents CommonMark HTML block type 6 from matching `<Table>` (case-insensitive
|
|
118208
|
+
* match against `table`) and fragmenting it at blank lines.
|
|
118209
|
+
*/
|
|
118210
|
+
function jsxTable() {
|
|
118211
|
+
return {
|
|
118212
|
+
flow: {
|
|
118213
|
+
[codes.lessThan]: [jsxTableConstruct],
|
|
118214
|
+
},
|
|
118215
|
+
};
|
|
118216
|
+
}
|
|
118217
|
+
|
|
118218
|
+
;// ./lib/micromark/jsx-table/index.ts
|
|
118219
|
+
|
|
118220
|
+
|
|
117261
118221
|
;// ./lib/micromark/magic-block/syntax.ts
|
|
117262
118222
|
|
|
117263
118223
|
|
|
@@ -118184,6 +119144,9 @@ function loadComponents() {
|
|
|
118184
119144
|
|
|
118185
119145
|
|
|
118186
119146
|
|
|
119147
|
+
|
|
119148
|
+
|
|
119149
|
+
|
|
118187
119150
|
|
|
118188
119151
|
|
|
118189
119152
|
|
|
@@ -118232,11 +119195,11 @@ function mdxishAstProcessor(mdContent, opts = {}) {
|
|
|
118232
119195
|
};
|
|
118233
119196
|
const processor = unified()
|
|
118234
119197
|
.data('micromarkExtensions', safeMode
|
|
118235
|
-
? [magicBlock(), legacyVariable(), looseHtmlEntity()]
|
|
118236
|
-
: [magicBlock(), mdxExprTextOnly, legacyVariable(), looseHtmlEntity()])
|
|
119198
|
+
? [jsxTable(), magicBlock(), legacyVariable(), looseHtmlEntity()]
|
|
119199
|
+
: [jsxTable(), magicBlock(), mdxExprTextOnly, legacyVariable(), looseHtmlEntity()])
|
|
118237
119200
|
.data('fromMarkdownExtensions', safeMode
|
|
118238
|
-
? [magicBlockFromMarkdown(), legacyVariableFromMarkdown(), emptyTaskListItemFromMarkdown(), looseHtmlEntityFromMarkdown()]
|
|
118239
|
-
: [magicBlockFromMarkdown(), mdxExpressionFromMarkdown(), legacyVariableFromMarkdown(), emptyTaskListItemFromMarkdown(), looseHtmlEntityFromMarkdown()])
|
|
119201
|
+
? [jsxTableFromMarkdown(), magicBlockFromMarkdown(), legacyVariableFromMarkdown(), emptyTaskListItemFromMarkdown(), looseHtmlEntityFromMarkdown()]
|
|
119202
|
+
: [jsxTableFromMarkdown(), magicBlockFromMarkdown(), mdxExpressionFromMarkdown(), legacyVariableFromMarkdown(), emptyTaskListItemFromMarkdown(), looseHtmlEntityFromMarkdown()])
|
|
118240
119203
|
.use(remarkParse)
|
|
118241
119204
|
.use(remarkFrontmatter)
|
|
118242
119205
|
.use(normalize_malformed_md_syntax)
|
|
@@ -118247,7 +119210,9 @@ function mdxishAstProcessor(mdContent, opts = {}) {
|
|
|
118247
119210
|
.use(restore_snake_case_component_name, { mapping: snakeCaseMapping })
|
|
118248
119211
|
.use(mdxish_tables)
|
|
118249
119212
|
.use(mdxish_html_blocks)
|
|
118250
|
-
.use(newEditorTypes ?
|
|
119213
|
+
.use(newEditorTypes ? mdxish_inline_components : undefined) // Merge inline html components (e.g. <Anchor>) into MDAST nodes
|
|
119214
|
+
.use(newEditorTypes ? mdxish_jsx_to_mdast : undefined) // Convert block JSX elements to MDAST types
|
|
119215
|
+
.use(safeMode ? undefined : evaluate_expressions, { context: jsxContext }) // Evaluate MDX expressions using jsxContext
|
|
118251
119216
|
.use(variables_text) // Parse {user.*} patterns from text nodes
|
|
118252
119217
|
.use(useTailwind ? transform_tailwind : undefined, { components: tempComponentsMap })
|
|
118253
119218
|
.use(remarkGfm);
|
|
@@ -118854,6 +119819,8 @@ function restoreMagicBlocks(replaced, blocks) {
|
|
|
118854
119819
|
|
|
118855
119820
|
|
|
118856
119821
|
|
|
119822
|
+
|
|
119823
|
+
|
|
118857
119824
|
/**
|
|
118858
119825
|
* Removes Markdown and MDX comments.
|
|
118859
119826
|
*/
|
|
@@ -118865,8 +119832,8 @@ async function stripComments(doc, { mdx, mdxish } = {}) {
|
|
|
118865
119832
|
// 2. we need to parse JSX comments into mdxTextExpression nodes so that the transformers can pick them up
|
|
118866
119833
|
if (mdxish) {
|
|
118867
119834
|
processor
|
|
118868
|
-
.data('micromarkExtensions', [mdxExpression({ allowEmpty: true })])
|
|
118869
|
-
.data('fromMarkdownExtensions', [mdxExpressionFromMarkdown()])
|
|
119835
|
+
.data('micromarkExtensions', [jsxTable(), mdxExpression({ allowEmpty: true })])
|
|
119836
|
+
.data('fromMarkdownExtensions', [jsxTableFromMarkdown(), mdxExpressionFromMarkdown()])
|
|
118870
119837
|
.data('toMarkdownExtensions', [mdxExpressionToMarkdown()]);
|
|
118871
119838
|
}
|
|
118872
119839
|
processor
|