@readme/markdown 13.6.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/dist/index.d.ts +1 -1
- 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.js +1969 -1194
- package/dist/main.node.js +1969 -1194
- package/dist/main.node.js.map +1 -1
- package/dist/processor/transform/mdxish/mdxish-tables.d.ts +7 -2
- package/package.json +2 -2
package/dist/main.js
CHANGED
|
@@ -11357,6 +11357,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
11357
11357
|
// EXPORTS
|
|
11358
11358
|
__webpack_require__.d(__webpack_exports__, {
|
|
11359
11359
|
Components: () => (/* reexport */ components_namespaceObject),
|
|
11360
|
+
FLOW_TYPES: () => (/* reexport */ FLOW_TYPES),
|
|
11360
11361
|
Owlmoji: () => (/* reexport */ Owlmoji),
|
|
11361
11362
|
compile: () => (/* reexport */ lib_compile),
|
|
11362
11363
|
exports: () => (/* reexport */ lib_exports),
|
|
@@ -12538,6 +12539,28 @@ var parseOptions = function parseOptions() {
|
|
|
12538
12539
|
return opts;
|
|
12539
12540
|
};
|
|
12540
12541
|
|
|
12542
|
+
;// ./lib/constants.ts
|
|
12543
|
+
/**
|
|
12544
|
+
* Pattern to match component tags (PascalCase or snake_case)
|
|
12545
|
+
*/
|
|
12546
|
+
const componentTagPattern = /<(\/?[A-Z][A-Za-z0-9_]*)([^>]*?)(\/?)>/g;
|
|
12547
|
+
/**
|
|
12548
|
+
* MDAST flow (block-level) content types that cannot be represented
|
|
12549
|
+
* inside GFM table cells. Used to decide whether a table should be
|
|
12550
|
+
* serialized as GFM or as JSX `<Table>` syntax.
|
|
12551
|
+
*
|
|
12552
|
+
* @see https://github.com/syntax-tree/mdast#flowcontent
|
|
12553
|
+
*/
|
|
12554
|
+
const FLOW_TYPES = new Set([
|
|
12555
|
+
'blockquote',
|
|
12556
|
+
'code',
|
|
12557
|
+
'heading',
|
|
12558
|
+
'html',
|
|
12559
|
+
'list',
|
|
12560
|
+
'table',
|
|
12561
|
+
'thematicBreak',
|
|
12562
|
+
]);
|
|
12563
|
+
|
|
12541
12564
|
;// ./node_modules/github-slugger/regex.js
|
|
12542
12565
|
// This module is generated by `script/`.
|
|
12543
12566
|
/* eslint-disable no-control-regex, no-misleading-character-class, no-useless-escape */
|
|
@@ -53003,6 +53026,10 @@ const plain = (node, opts = {}) => {
|
|
|
53003
53026
|
};
|
|
53004
53027
|
/* harmony default export */ const lib_plain = (plain);
|
|
53005
53028
|
|
|
53029
|
+
;// ./processor/compile/variable.ts
|
|
53030
|
+
const variable = (node) => `{user.${node.data?.hProperties?.name || ''}}`;
|
|
53031
|
+
/* harmony default export */ const compile_variable = (variable);
|
|
53032
|
+
|
|
53006
53033
|
;// ./processor/transform/extract-text.ts
|
|
53007
53034
|
/**
|
|
53008
53035
|
* Extracts text content from a single AST node recursively.
|
|
@@ -53014,7 +53041,7 @@ const plain = (node, opts = {}) => {
|
|
|
53014
53041
|
* @returns The concatenated text content
|
|
53015
53042
|
*/
|
|
53016
53043
|
const extractText = (node) => {
|
|
53017
|
-
if (node.type === 'text' && typeof node.value === 'string') {
|
|
53044
|
+
if ((node.type === 'text' || node.type === 'html') && typeof node.value === 'string') {
|
|
53018
53045
|
return node.value;
|
|
53019
53046
|
}
|
|
53020
53047
|
// When a blockquote contains only an image (no text), treat it as having content
|
|
@@ -53047,8 +53074,18 @@ const extractText = (node) => {
|
|
|
53047
53074
|
|
|
53048
53075
|
|
|
53049
53076
|
|
|
53077
|
+
|
|
53078
|
+
|
|
53050
53079
|
const titleParser = unified().use(remarkParse).use(remarkGfm);
|
|
53051
|
-
|
|
53080
|
+
// The title paragraph may contain custom AST nodes that `toMarkdown` doesn't
|
|
53081
|
+
// natively understand
|
|
53082
|
+
const toMarkdownExtensions = [
|
|
53083
|
+
gfmStrikethroughToMarkdown(),
|
|
53084
|
+
// For mdx variable syntaxes (e.g., {user.name})
|
|
53085
|
+
mdxExpressionToMarkdown(),
|
|
53086
|
+
// Important: This is required and would crash the parser if there's no variable node handler
|
|
53087
|
+
{ handlers: { [NodeTypes.variable]: compile_variable } },
|
|
53088
|
+
];
|
|
53052
53089
|
const callouts_regex = `^(${emoji_regex().source}|⚠)(\\s+|$)`;
|
|
53053
53090
|
const findFirst = (node) => {
|
|
53054
53091
|
if ('children' in node)
|
|
@@ -70869,693 +70906,348 @@ const mdxToHast = () => tree => {
|
|
|
70869
70906
|
};
|
|
70870
70907
|
/* harmony default export */ const mdx_to_hast = (mdxToHast);
|
|
70871
70908
|
|
|
70872
|
-
;// ./
|
|
70909
|
+
;// ./processor/transform/mdxish/normalize-malformed-md-syntax.ts
|
|
70910
|
+
|
|
70911
|
+
// Marker patterns for multi-node emphasis detection
|
|
70912
|
+
const MARKER_PATTERNS = [
|
|
70913
|
+
{ isBold: true, marker: '**' },
|
|
70914
|
+
{ isBold: true, marker: '__' },
|
|
70915
|
+
{ isBold: false, marker: '*' },
|
|
70916
|
+
{ isBold: false, marker: '_' },
|
|
70917
|
+
];
|
|
70918
|
+
// Patterns to detect for bold (** and __) and italic (* and _) syntax:
|
|
70919
|
+
// Bold: ** text**, **text **, word** text**, ** text **
|
|
70920
|
+
// Italic: * text*, *text *, word* text*, * text *
|
|
70921
|
+
// Same patterns for underscore variants
|
|
70922
|
+
// We use separate patterns for each marker type to allow this flexibility.
|
|
70923
|
+
// Pattern for ** bold **
|
|
70924
|
+
// Groups: 1=wordBefore, 2=marker, 3=contentWithSpaceAfter, 4=trailingSpace1, 5=contentWithSpaceBefore, 6=trailingSpace2, 7=afterChar
|
|
70925
|
+
// trailingSpace1 is for "** text **" pattern, trailingSpace2 is for "**text **" pattern
|
|
70926
|
+
const asteriskBoldRegex = /([^*\s]+)?\s*(\*\*)(?:\s+((?:[^*\n]|\*(?!\*))+?)(\s*)\2|((?:[^*\n]|\*(?!\*))+?)(\s+)\2)(\S|$)?/g;
|
|
70927
|
+
// Pattern for __ bold __
|
|
70928
|
+
const underscoreBoldRegex = /([^_\s]+)?\s*(__)(?:\s+((?:__(?! )|_(?!_)|[^_\n])+?)(\s*)\2|((?:__(?! )|_(?!_)|[^_\n])+?)(\s+)\2)(\S|$)?/g;
|
|
70929
|
+
// Pattern for * italic *
|
|
70930
|
+
const asteriskItalicRegex = /([^*\s]+)?\s*(\*)(?!\*)(?:\s+([^*\n]+?)(\s*)\2|([^*\n]+?)(\s+)\2)(\S|$)?/g;
|
|
70931
|
+
// Pattern for _ italic _
|
|
70932
|
+
const underscoreItalicRegex = /([^_\s]+)?\s*(_)(?!_)(?:\s+((?:[^_\n]|_(?! ))+?)(\s*)\2|((?:[^_\n]|_(?! ))+?)(\s+)\2)(\S|$)?/g;
|
|
70933
|
+
// CommonMark ignores intraword underscores or asteriks, but we want to italicize/bold the inner part
|
|
70934
|
+
// Pattern for intraword _word_ in words like hello_world_
|
|
70935
|
+
const intrawordUnderscoreItalicRegex = /(\w)_(?!_)([a-zA-Z0-9]+)_(?![\w_])/g;
|
|
70936
|
+
// Pattern for intraword __word__ in words like hello__world__
|
|
70937
|
+
const intrawordUnderscoreBoldRegex = /(\w)__([a-zA-Z0-9]+)__(?![\w_])/g;
|
|
70938
|
+
// Pattern for intraword *word* in words like hello*world*
|
|
70939
|
+
const intrawordAsteriskItalicRegex = /(\w)\*(?!\*)([a-zA-Z0-9]+)\*(?![\w*])/g;
|
|
70940
|
+
// Pattern for intraword **word** in words like hello**world**
|
|
70941
|
+
const intrawordAsteriskBoldRegex = /(\w)\*\*([a-zA-Z0-9]+)\*\*(?![\w*])/g;
|
|
70873
70942
|
/**
|
|
70874
|
-
*
|
|
70875
|
-
*
|
|
70876
|
-
* follows the closing bracket (`]`). This matches legacy behaviour for checkboxes
|
|
70877
|
-
*
|
|
70878
|
-
* The issue is `remark-gfm` does not actually classify these as task items when they have no content
|
|
70879
|
-
* after the checkbox, which leaves them as plain text (`"[ ]"`). So a custom extension is needed to
|
|
70880
|
-
* treat these as task items
|
|
70943
|
+
* Finds opening emphasis marker in a text value.
|
|
70944
|
+
* Returns marker info if found, null otherwise.
|
|
70881
70945
|
*/
|
|
70882
|
-
function
|
|
70883
|
-
const
|
|
70884
|
-
|
|
70885
|
-
|
|
70886
|
-
|
|
70887
|
-
|
|
70888
|
-
|
|
70889
|
-
|
|
70890
|
-
|
|
70891
|
-
|
|
70892
|
-
|
|
70893
|
-
|
|
70894
|
-
|
|
70895
|
-
|
|
70896
|
-
|
|
70897
|
-
|
|
70898
|
-
|
|
70899
|
-
|
|
70900
|
-
if (value === '[ ]') {
|
|
70901
|
-
listItem.checked = false;
|
|
70902
|
-
head.children = [];
|
|
70903
|
-
}
|
|
70904
|
-
else if (value === '[x]' || value === '[X]') {
|
|
70905
|
-
listItem.checked = true;
|
|
70906
|
-
head.children = [];
|
|
70907
|
-
}
|
|
70946
|
+
function findOpeningMarker(text) {
|
|
70947
|
+
const results = MARKER_PATTERNS.map(({ isBold, marker }) => {
|
|
70948
|
+
if (marker === '*' && text.startsWith('**'))
|
|
70949
|
+
return null;
|
|
70950
|
+
if (marker === '_' && text.startsWith('__'))
|
|
70951
|
+
return null;
|
|
70952
|
+
if (text.startsWith(marker) && text.length > marker.length) {
|
|
70953
|
+
return { isBold, marker, textAfter: text.slice(marker.length), textBefore: '' };
|
|
70954
|
+
}
|
|
70955
|
+
const idx = text.indexOf(marker);
|
|
70956
|
+
if (idx > 0 && !/\s/.test(text[idx - 1])) {
|
|
70957
|
+
if (marker === '*' && text.slice(idx).startsWith('**'))
|
|
70958
|
+
return null;
|
|
70959
|
+
if (marker === '_' && text.slice(idx).startsWith('__'))
|
|
70960
|
+
return null;
|
|
70961
|
+
const after = text.slice(idx + marker.length);
|
|
70962
|
+
if (after.length > 0) {
|
|
70963
|
+
return { isBold, marker, textAfter: after, textBefore: text.slice(0, idx) };
|
|
70908
70964
|
}
|
|
70909
70965
|
}
|
|
70910
|
-
|
|
70911
|
-
|
|
70912
|
-
|
|
70913
|
-
function emptyTaskListItemFromMarkdown() {
|
|
70914
|
-
return {
|
|
70915
|
-
exit: {
|
|
70916
|
-
listItem: exitListItemWithEmptyTaskListItem,
|
|
70917
|
-
},
|
|
70918
|
-
};
|
|
70966
|
+
return null;
|
|
70967
|
+
});
|
|
70968
|
+
return results.find(r => r !== null) ?? null;
|
|
70919
70969
|
}
|
|
70920
|
-
|
|
70921
|
-
|
|
70922
|
-
|
|
70923
|
-
|
|
70924
|
-
|
|
70925
|
-
|
|
70926
|
-
|
|
70927
|
-
|
|
70928
|
-
|
|
70929
|
-
if (
|
|
70930
|
-
return
|
|
70970
|
+
/**
|
|
70971
|
+
* Finds the end/closing marker in a text node for multi-node emphasis.
|
|
70972
|
+
*/
|
|
70973
|
+
function findEndMarker(text, marker) {
|
|
70974
|
+
const spacePattern = ` ${marker}`;
|
|
70975
|
+
const spaceIdx = text.indexOf(spacePattern);
|
|
70976
|
+
if (spaceIdx >= 0) {
|
|
70977
|
+
if (marker === '*' && text.slice(spaceIdx + 1).startsWith('**'))
|
|
70978
|
+
return null;
|
|
70979
|
+
if (marker === '_' && text.slice(spaceIdx + 1).startsWith('__'))
|
|
70980
|
+
return null;
|
|
70981
|
+
return {
|
|
70982
|
+
textAfter: text.slice(spaceIdx + spacePattern.length),
|
|
70983
|
+
textBefore: text.slice(0, spaceIdx),
|
|
70984
|
+
};
|
|
70931
70985
|
}
|
|
70932
|
-
|
|
70933
|
-
|
|
70934
|
-
|
|
70935
|
-
|
|
70936
|
-
|
|
70937
|
-
|
|
70938
|
-
|
|
70939
|
-
|
|
70940
|
-
|
|
70941
|
-
const ctx = contextMap.get(variableToken);
|
|
70942
|
-
// Build up the variable characters
|
|
70943
|
-
if (ctx)
|
|
70944
|
-
ctx.value += this.sliceSerialize(token);
|
|
70945
|
-
}
|
|
70946
|
-
function exitlegacyVariable(token) {
|
|
70947
|
-
const ctx = contextMap.get(token);
|
|
70948
|
-
const serialized = this.sliceSerialize(token);
|
|
70949
|
-
const variableName = serialized.startsWith('<<') && serialized.endsWith('>>')
|
|
70950
|
-
? serialized.slice(2, -2)
|
|
70951
|
-
: ctx?.value ?? '';
|
|
70952
|
-
const nodePosition = {
|
|
70953
|
-
start: {
|
|
70954
|
-
offset: token.start.offset,
|
|
70955
|
-
line: token.start.line,
|
|
70956
|
-
column: token.start.column,
|
|
70957
|
-
},
|
|
70958
|
-
end: {
|
|
70959
|
-
offset: token.end.offset,
|
|
70960
|
-
line: token.end.line,
|
|
70961
|
-
column: token.end.column,
|
|
70962
|
-
},
|
|
70963
|
-
};
|
|
70964
|
-
if (variableName.startsWith('glossary:')) {
|
|
70965
|
-
const term = variableName.slice('glossary:'.length).trim();
|
|
70966
|
-
this.enter({
|
|
70967
|
-
type: NodeTypes.glossary,
|
|
70968
|
-
data: {
|
|
70969
|
-
hName: 'Glossary',
|
|
70970
|
-
hProperties: { term },
|
|
70971
|
-
},
|
|
70972
|
-
children: [{ type: 'text', value: term }],
|
|
70973
|
-
position: nodePosition,
|
|
70974
|
-
}, token);
|
|
70975
|
-
this.exit(token);
|
|
70976
|
-
contextMap.delete(token);
|
|
70977
|
-
return;
|
|
70986
|
+
if (text.startsWith(marker)) {
|
|
70987
|
+
if (marker === '*' && text.startsWith('**'))
|
|
70988
|
+
return null;
|
|
70989
|
+
if (marker === '_' && text.startsWith('__'))
|
|
70990
|
+
return null;
|
|
70991
|
+
return {
|
|
70992
|
+
textAfter: text.slice(marker.length),
|
|
70993
|
+
textBefore: '',
|
|
70994
|
+
};
|
|
70978
70995
|
}
|
|
70979
|
-
|
|
70980
|
-
type: NodeTypes.variable,
|
|
70981
|
-
data: {
|
|
70982
|
-
hName: 'Variable',
|
|
70983
|
-
hProperties: { name: variableName.trim(), isLegacy: true },
|
|
70984
|
-
},
|
|
70985
|
-
value: `<<${variableName}>>`,
|
|
70986
|
-
}, token);
|
|
70987
|
-
this.exit(token);
|
|
70988
|
-
contextMap.delete(token);
|
|
70989
|
-
}
|
|
70990
|
-
function legacyVariableFromMarkdown() {
|
|
70991
|
-
return {
|
|
70992
|
-
enter: {
|
|
70993
|
-
legacyVariable: enterlegacyVariable,
|
|
70994
|
-
},
|
|
70995
|
-
exit: {
|
|
70996
|
-
legacyVariableValue: exitlegacyVariableValue,
|
|
70997
|
-
legacyVariable: exitlegacyVariable,
|
|
70998
|
-
},
|
|
70999
|
-
};
|
|
70996
|
+
return null;
|
|
71000
70997
|
}
|
|
71001
|
-
|
|
71002
|
-
;// ./node_modules/micromark-util-symbol/lib/codes.js
|
|
71003
70998
|
/**
|
|
71004
|
-
*
|
|
71005
|
-
*
|
|
71006
|
-
* This module is compiled away!
|
|
71007
|
-
*
|
|
71008
|
-
* micromark works based on character codes.
|
|
71009
|
-
* This module contains constants for the ASCII block and the replacement
|
|
71010
|
-
* character.
|
|
71011
|
-
* A couple of them are handled in a special way, such as the line endings
|
|
71012
|
-
* (CR, LF, and CR+LF, commonly known as end-of-line: EOLs), the tab (horizontal
|
|
71013
|
-
* tab) and its expansion based on what column it’s at (virtual space),
|
|
71014
|
-
* and the end-of-file (eof) character.
|
|
71015
|
-
* As values are preprocessed before handling them, the actual characters LF,
|
|
71016
|
-
* CR, HT, and NUL (which is present as the replacement character), are
|
|
71017
|
-
* guaranteed to not exist.
|
|
71018
|
-
*
|
|
71019
|
-
* Unicode basic latin block.
|
|
70999
|
+
* Scan children for an opening emphasis marker in a text node.
|
|
71020
71000
|
*/
|
|
71021
|
-
|
|
71022
|
-
|
|
71023
|
-
|
|
71024
|
-
|
|
71025
|
-
|
|
71026
|
-
|
|
71027
|
-
|
|
71028
|
-
|
|
71029
|
-
|
|
71030
|
-
stx: 2,
|
|
71031
|
-
etx: 3,
|
|
71032
|
-
eot: 4,
|
|
71033
|
-
enq: 5,
|
|
71034
|
-
ack: 6,
|
|
71035
|
-
bel: 7,
|
|
71036
|
-
bs: 8,
|
|
71037
|
-
ht: 9, // `\t`
|
|
71038
|
-
lf: 10, // `\n`
|
|
71039
|
-
vt: 11, // `\v`
|
|
71040
|
-
ff: 12, // `\f`
|
|
71041
|
-
cr: 13, // `\r`
|
|
71042
|
-
so: 14,
|
|
71043
|
-
si: 15,
|
|
71044
|
-
dle: 16,
|
|
71045
|
-
dc1: 17,
|
|
71046
|
-
dc2: 18,
|
|
71047
|
-
dc3: 19,
|
|
71048
|
-
dc4: 20,
|
|
71049
|
-
nak: 21,
|
|
71050
|
-
syn: 22,
|
|
71051
|
-
etb: 23,
|
|
71052
|
-
can: 24,
|
|
71053
|
-
em: 25,
|
|
71054
|
-
sub: 26,
|
|
71055
|
-
esc: 27,
|
|
71056
|
-
fs: 28,
|
|
71057
|
-
gs: 29,
|
|
71058
|
-
rs: 30,
|
|
71059
|
-
us: 31,
|
|
71060
|
-
space: 32,
|
|
71061
|
-
exclamationMark: 33, // `!`
|
|
71062
|
-
quotationMark: 34, // `"`
|
|
71063
|
-
numberSign: 35, // `#`
|
|
71064
|
-
dollarSign: 36, // `$`
|
|
71065
|
-
percentSign: 37, // `%`
|
|
71066
|
-
ampersand: 38, // `&`
|
|
71067
|
-
apostrophe: 39, // `'`
|
|
71068
|
-
leftParenthesis: 40, // `(`
|
|
71069
|
-
rightParenthesis: 41, // `)`
|
|
71070
|
-
asterisk: 42, // `*`
|
|
71071
|
-
plusSign: 43, // `+`
|
|
71072
|
-
comma: 44, // `,`
|
|
71073
|
-
dash: 45, // `-`
|
|
71074
|
-
dot: 46, // `.`
|
|
71075
|
-
slash: 47, // `/`
|
|
71076
|
-
digit0: 48, // `0`
|
|
71077
|
-
digit1: 49, // `1`
|
|
71078
|
-
digit2: 50, // `2`
|
|
71079
|
-
digit3: 51, // `3`
|
|
71080
|
-
digit4: 52, // `4`
|
|
71081
|
-
digit5: 53, // `5`
|
|
71082
|
-
digit6: 54, // `6`
|
|
71083
|
-
digit7: 55, // `7`
|
|
71084
|
-
digit8: 56, // `8`
|
|
71085
|
-
digit9: 57, // `9`
|
|
71086
|
-
colon: 58, // `:`
|
|
71087
|
-
semicolon: 59, // `;`
|
|
71088
|
-
lessThan: 60, // `<`
|
|
71089
|
-
equalsTo: 61, // `=`
|
|
71090
|
-
greaterThan: 62, // `>`
|
|
71091
|
-
questionMark: 63, // `?`
|
|
71092
|
-
atSign: 64, // `@`
|
|
71093
|
-
uppercaseA: 65, // `A`
|
|
71094
|
-
uppercaseB: 66, // `B`
|
|
71095
|
-
uppercaseC: 67, // `C`
|
|
71096
|
-
uppercaseD: 68, // `D`
|
|
71097
|
-
uppercaseE: 69, // `E`
|
|
71098
|
-
uppercaseF: 70, // `F`
|
|
71099
|
-
uppercaseG: 71, // `G`
|
|
71100
|
-
uppercaseH: 72, // `H`
|
|
71101
|
-
uppercaseI: 73, // `I`
|
|
71102
|
-
uppercaseJ: 74, // `J`
|
|
71103
|
-
uppercaseK: 75, // `K`
|
|
71104
|
-
uppercaseL: 76, // `L`
|
|
71105
|
-
uppercaseM: 77, // `M`
|
|
71106
|
-
uppercaseN: 78, // `N`
|
|
71107
|
-
uppercaseO: 79, // `O`
|
|
71108
|
-
uppercaseP: 80, // `P`
|
|
71109
|
-
uppercaseQ: 81, // `Q`
|
|
71110
|
-
uppercaseR: 82, // `R`
|
|
71111
|
-
uppercaseS: 83, // `S`
|
|
71112
|
-
uppercaseT: 84, // `T`
|
|
71113
|
-
uppercaseU: 85, // `U`
|
|
71114
|
-
uppercaseV: 86, // `V`
|
|
71115
|
-
uppercaseW: 87, // `W`
|
|
71116
|
-
uppercaseX: 88, // `X`
|
|
71117
|
-
uppercaseY: 89, // `Y`
|
|
71118
|
-
uppercaseZ: 90, // `Z`
|
|
71119
|
-
leftSquareBracket: 91, // `[`
|
|
71120
|
-
backslash: 92, // `\`
|
|
71121
|
-
rightSquareBracket: 93, // `]`
|
|
71122
|
-
caret: 94, // `^`
|
|
71123
|
-
underscore: 95, // `_`
|
|
71124
|
-
graveAccent: 96, // `` ` ``
|
|
71125
|
-
lowercaseA: 97, // `a`
|
|
71126
|
-
lowercaseB: 98, // `b`
|
|
71127
|
-
lowercaseC: 99, // `c`
|
|
71128
|
-
lowercaseD: 100, // `d`
|
|
71129
|
-
lowercaseE: 101, // `e`
|
|
71130
|
-
lowercaseF: 102, // `f`
|
|
71131
|
-
lowercaseG: 103, // `g`
|
|
71132
|
-
lowercaseH: 104, // `h`
|
|
71133
|
-
lowercaseI: 105, // `i`
|
|
71134
|
-
lowercaseJ: 106, // `j`
|
|
71135
|
-
lowercaseK: 107, // `k`
|
|
71136
|
-
lowercaseL: 108, // `l`
|
|
71137
|
-
lowercaseM: 109, // `m`
|
|
71138
|
-
lowercaseN: 110, // `n`
|
|
71139
|
-
lowercaseO: 111, // `o`
|
|
71140
|
-
lowercaseP: 112, // `p`
|
|
71141
|
-
lowercaseQ: 113, // `q`
|
|
71142
|
-
lowercaseR: 114, // `r`
|
|
71143
|
-
lowercaseS: 115, // `s`
|
|
71144
|
-
lowercaseT: 116, // `t`
|
|
71145
|
-
lowercaseU: 117, // `u`
|
|
71146
|
-
lowercaseV: 118, // `v`
|
|
71147
|
-
lowercaseW: 119, // `w`
|
|
71148
|
-
lowercaseX: 120, // `x`
|
|
71149
|
-
lowercaseY: 121, // `y`
|
|
71150
|
-
lowercaseZ: 122, // `z`
|
|
71151
|
-
leftCurlyBrace: 123, // `{`
|
|
71152
|
-
verticalBar: 124, // `|`
|
|
71153
|
-
rightCurlyBrace: 125, // `}`
|
|
71154
|
-
tilde: 126, // `~`
|
|
71155
|
-
del: 127,
|
|
71156
|
-
// Unicode Specials block.
|
|
71157
|
-
byteOrderMarker: 65_279,
|
|
71158
|
-
// Unicode Specials block.
|
|
71159
|
-
replacementCharacter: 65_533 // `�`
|
|
71160
|
-
})
|
|
71161
|
-
|
|
71162
|
-
;// ./lib/micromark/legacy-variable/syntax.ts
|
|
71163
|
-
|
|
71164
|
-
|
|
71165
|
-
function isAllowedValueChar(code) {
|
|
71166
|
-
return (code !== null &&
|
|
71167
|
-
code !== codes.lessThan &&
|
|
71168
|
-
code !== codes.greaterThan &&
|
|
71169
|
-
!markdownLineEnding(code));
|
|
71170
|
-
}
|
|
71171
|
-
const legacyVariableConstruct = {
|
|
71172
|
-
name: 'legacyVariable',
|
|
71173
|
-
tokenize,
|
|
71174
|
-
};
|
|
71175
|
-
function tokenize(effects, ok, nok) {
|
|
71176
|
-
let hasValue = false;
|
|
71177
|
-
const start = (code) => {
|
|
71178
|
-
if (code !== codes.lessThan)
|
|
71179
|
-
return nok(code);
|
|
71180
|
-
effects.enter('legacyVariable');
|
|
71181
|
-
effects.enter('legacyVariableMarkerStart');
|
|
71182
|
-
effects.consume(code); // <
|
|
71183
|
-
return open2;
|
|
71184
|
-
};
|
|
71185
|
-
const open2 = (code) => {
|
|
71186
|
-
if (code !== codes.lessThan)
|
|
71187
|
-
return nok(code);
|
|
71188
|
-
effects.consume(code); // <<
|
|
71189
|
-
effects.exit('legacyVariableMarkerStart');
|
|
71190
|
-
effects.enter('legacyVariableValue');
|
|
71191
|
-
return value;
|
|
71192
|
-
};
|
|
71193
|
-
const value = (code) => {
|
|
71194
|
-
if (code === codes.greaterThan) {
|
|
71195
|
-
if (!hasValue)
|
|
71196
|
-
return nok(code);
|
|
71197
|
-
effects.exit('legacyVariableValue');
|
|
71198
|
-
effects.enter('legacyVariableMarkerEnd');
|
|
71199
|
-
effects.consume(code); // >
|
|
71200
|
-
return close2;
|
|
71001
|
+
function findOpeningInChildren(children) {
|
|
71002
|
+
let result = null;
|
|
71003
|
+
children.some((child, idx) => {
|
|
71004
|
+
if (child.type !== 'text')
|
|
71005
|
+
return false;
|
|
71006
|
+
const found = findOpeningMarker(child.value);
|
|
71007
|
+
if (found) {
|
|
71008
|
+
result = { idx, opening: found };
|
|
71009
|
+
return true;
|
|
71201
71010
|
}
|
|
71202
|
-
|
|
71203
|
-
|
|
71204
|
-
|
|
71205
|
-
effects.consume(code);
|
|
71206
|
-
return value;
|
|
71207
|
-
};
|
|
71208
|
-
const close2 = (code) => {
|
|
71209
|
-
if (code !== codes.greaterThan)
|
|
71210
|
-
return nok(code);
|
|
71211
|
-
effects.consume(code); // >>
|
|
71212
|
-
effects.exit('legacyVariableMarkerEnd');
|
|
71213
|
-
effects.exit('legacyVariable');
|
|
71214
|
-
return ok;
|
|
71215
|
-
};
|
|
71216
|
-
return start;
|
|
71011
|
+
return false;
|
|
71012
|
+
});
|
|
71013
|
+
return result;
|
|
71217
71014
|
}
|
|
71218
|
-
|
|
71219
|
-
|
|
71220
|
-
|
|
71221
|
-
|
|
71015
|
+
/**
|
|
71016
|
+
* Scan children (after openingIdx) for a closing emphasis marker.
|
|
71017
|
+
*/
|
|
71018
|
+
function findClosingInChildren(children, openingIdx, marker) {
|
|
71019
|
+
let result = null;
|
|
71020
|
+
children.slice(openingIdx + 1).some((child, relativeIdx) => {
|
|
71021
|
+
if (child.type !== 'text')
|
|
71022
|
+
return false;
|
|
71023
|
+
const found = findEndMarker(child.value, marker);
|
|
71024
|
+
if (found) {
|
|
71025
|
+
result = { closingIdx: openingIdx + 1 + relativeIdx, closing: found };
|
|
71026
|
+
return true;
|
|
71027
|
+
}
|
|
71028
|
+
return false;
|
|
71029
|
+
});
|
|
71030
|
+
return result;
|
|
71222
71031
|
}
|
|
71223
|
-
|
|
71224
|
-
;// ./lib/micromark/legacy-variable/index.ts
|
|
71225
71032
|
/**
|
|
71226
|
-
*
|
|
71033
|
+
* Build the replacement nodes for a matched emphasis pair.
|
|
71227
71034
|
*/
|
|
71228
|
-
|
|
71229
|
-
|
|
71230
|
-
|
|
71035
|
+
function buildReplacementNodes(container, { opening, openingIdx, closing, closingIdx }) {
|
|
71036
|
+
const newNodes = [];
|
|
71037
|
+
if (opening.textBefore) {
|
|
71038
|
+
newNodes.push({ type: 'text', value: `${opening.textBefore} ` });
|
|
71039
|
+
}
|
|
71040
|
+
const emphasisChildren = [];
|
|
71041
|
+
const openingText = opening.textAfter.replace(/^\s+/, '');
|
|
71042
|
+
if (openingText) {
|
|
71043
|
+
emphasisChildren.push({ type: 'text', value: openingText });
|
|
71044
|
+
}
|
|
71045
|
+
container.children.slice(openingIdx + 1, closingIdx).forEach(child => {
|
|
71046
|
+
emphasisChildren.push(child);
|
|
71047
|
+
});
|
|
71048
|
+
const closingText = closing.textBefore.replace(/\s+$/, '');
|
|
71049
|
+
if (closingText) {
|
|
71050
|
+
emphasisChildren.push({ type: 'text', value: closingText });
|
|
71051
|
+
}
|
|
71052
|
+
if (emphasisChildren.length > 0) {
|
|
71053
|
+
const emphasisNode = opening.isBold
|
|
71054
|
+
? { type: 'strong', children: emphasisChildren }
|
|
71055
|
+
: { type: 'emphasis', children: emphasisChildren };
|
|
71056
|
+
newNodes.push(emphasisNode);
|
|
71057
|
+
}
|
|
71058
|
+
if (closing.textAfter) {
|
|
71059
|
+
newNodes.push({ type: 'text', value: closing.textAfter });
|
|
71060
|
+
}
|
|
71061
|
+
return newNodes;
|
|
71062
|
+
}
|
|
71231
71063
|
/**
|
|
71232
|
-
*
|
|
71233
|
-
*
|
|
71064
|
+
* Find and transform one multi-node emphasis pair in the container.
|
|
71065
|
+
* Returns true if a pair was found and transformed, false otherwise.
|
|
71234
71066
|
*/
|
|
71235
|
-
|
|
71236
|
-
|
|
71237
|
-
|
|
71238
|
-
|
|
71239
|
-
|
|
71240
|
-
|
|
71241
|
-
|
|
71242
|
-
|
|
71243
|
-
|
|
71244
|
-
|
|
71245
|
-
const
|
|
71246
|
-
|
|
71247
|
-
|
|
71248
|
-
|
|
71249
|
-
* to avoid scanning too far and degrading performance
|
|
71250
|
-
*/
|
|
71251
|
-
const MAX_LOOKAHEAD = 30;
|
|
71252
|
-
/**
|
|
71253
|
-
* Tags that have dedicated transformers and should NOT be handled by this plugin.
|
|
71254
|
-
* These components either have special parsing requirements that the generic component
|
|
71255
|
-
* block transformer cannot handle correctly, or are inline components that we don't
|
|
71256
|
-
* want to convert to mdxJsxFlowElement which is a block level element.
|
|
71257
|
-
*/
|
|
71258
|
-
const EXCLUDED_TAGS = new Set(['HTMLBlock', 'Table', 'Glossary', ...INLINE_COMPONENT_TAGS]);
|
|
71259
|
-
const inlineMdProcessor = unified()
|
|
71260
|
-
.data('micromarkExtensions', [legacyVariable()])
|
|
71261
|
-
.data('fromMarkdownExtensions', [legacyVariableFromMarkdown(), emptyTaskListItemFromMarkdown()])
|
|
71262
|
-
.use(remarkParse)
|
|
71263
|
-
.use(remarkGfm);
|
|
71264
|
-
const isClosingTag = (value, tag) => value.trim() === `</${tag}>`;
|
|
71265
|
-
/**
|
|
71266
|
-
* Parse markdown content into mdast children nodes.
|
|
71267
|
-
*/
|
|
71268
|
-
const parseMdChildren = (value) => {
|
|
71269
|
-
const parsed = inlineMdProcessor.parse(value);
|
|
71270
|
-
return parsed.children || [];
|
|
71271
|
-
};
|
|
71272
|
-
/**
|
|
71273
|
-
* Convert raw attribute string into mdxJsxAttribute entries.
|
|
71274
|
-
* Handles both key-value attributes (theme="info") and boolean attributes (empty).
|
|
71275
|
-
*/
|
|
71276
|
-
const parseAttributes = (raw) => {
|
|
71277
|
-
const attributes = [];
|
|
71278
|
-
const attrString = raw.trim();
|
|
71279
|
-
if (!attrString)
|
|
71280
|
-
return attributes;
|
|
71281
|
-
tagAttributePattern.lastIndex = 0;
|
|
71282
|
-
let match = tagAttributePattern.exec(attrString);
|
|
71283
|
-
while (match !== null) {
|
|
71284
|
-
const [, attrName, attrValue] = match;
|
|
71285
|
-
const value = attrValue ? attrValue.replace(/^['"]|['"]$/g, '') : null;
|
|
71286
|
-
attributes.push({ type: 'mdxJsxAttribute', name: attrName, value });
|
|
71287
|
-
match = tagAttributePattern.exec(attrString);
|
|
71288
|
-
}
|
|
71289
|
-
return attributes;
|
|
71290
|
-
};
|
|
71291
|
-
/**
|
|
71292
|
-
* Parse an HTML tag string into structured data.
|
|
71293
|
-
*/
|
|
71294
|
-
const parseTag = (value) => {
|
|
71295
|
-
const match = value.match(pascalCaseTagPattern);
|
|
71296
|
-
if (!match)
|
|
71297
|
-
return null;
|
|
71298
|
-
const [, tag, attrString = '', selfClosing = '', contentAfterTag = ''] = match;
|
|
71299
|
-
return {
|
|
71300
|
-
tag,
|
|
71301
|
-
attributes: parseAttributes(attrString),
|
|
71302
|
-
selfClosing: !!selfClosing,
|
|
71303
|
-
contentAfterTag,
|
|
71304
|
-
};
|
|
71305
|
-
};
|
|
71306
|
-
/**
|
|
71307
|
-
* Parse substring content of a node and update the parent's children to include the new nodes.
|
|
71308
|
-
*/
|
|
71309
|
-
const parseSibling = (stack, parent, index, sibling) => {
|
|
71310
|
-
const siblingNodes = parseMdChildren(sibling);
|
|
71311
|
-
// The new sibling nodes might contain new components to be processed
|
|
71312
|
-
if (siblingNodes.length > 0) {
|
|
71313
|
-
parent.children.splice(index + 1, 0, ...siblingNodes);
|
|
71314
|
-
stack.push(parent);
|
|
71315
|
-
}
|
|
71316
|
-
};
|
|
71317
|
-
/**
|
|
71318
|
-
* Create an MdxJsxFlowElement node from component data.
|
|
71319
|
-
*/
|
|
71320
|
-
const createComponentNode = ({ tag, attributes, children, startPosition, endPosition }) => ({
|
|
71321
|
-
type: 'mdxJsxFlowElement',
|
|
71322
|
-
name: tag,
|
|
71323
|
-
attributes,
|
|
71324
|
-
children,
|
|
71325
|
-
position: {
|
|
71326
|
-
start: startPosition?.start,
|
|
71327
|
-
end: endPosition?.end ?? startPosition?.end,
|
|
71328
|
-
},
|
|
71329
|
-
});
|
|
71330
|
-
/**
|
|
71331
|
-
* Remove a closing tag from a paragraph's children and return the updated paragraph.
|
|
71332
|
-
*/
|
|
71333
|
-
const stripClosingTagFromParagraph = (node, tag) => {
|
|
71334
|
-
if (!Array.isArray(node.children))
|
|
71335
|
-
return { paragraph: node, found: false };
|
|
71336
|
-
const children = [...node.children];
|
|
71337
|
-
const closingIndex = children.findIndex(child => child.type === 'html' && isClosingTag(child.value || '', tag));
|
|
71338
|
-
if (closingIndex === -1)
|
|
71339
|
-
return { paragraph: node, found: false };
|
|
71340
|
-
children.splice(closingIndex, 1);
|
|
71341
|
-
return { paragraph: { ...node, children }, found: true };
|
|
71342
|
-
};
|
|
71067
|
+
function processOneEmphasisPair(container) {
|
|
71068
|
+
const openingResult = findOpeningInChildren(container.children);
|
|
71069
|
+
if (!openingResult)
|
|
71070
|
+
return false;
|
|
71071
|
+
const { idx: openingIdx, opening } = openingResult;
|
|
71072
|
+
const closingResult = findClosingInChildren(container.children, openingIdx, opening.marker);
|
|
71073
|
+
if (!closingResult)
|
|
71074
|
+
return false;
|
|
71075
|
+
const { closingIdx, closing } = closingResult;
|
|
71076
|
+
const newNodes = buildReplacementNodes(container, { opening, openingIdx, closing, closingIdx });
|
|
71077
|
+
const deleteCount = closingIdx - openingIdx + 1;
|
|
71078
|
+
container.children.splice(openingIdx, deleteCount, ...newNodes);
|
|
71079
|
+
return true;
|
|
71080
|
+
}
|
|
71343
71081
|
/**
|
|
71344
|
-
*
|
|
71345
|
-
*
|
|
71346
|
-
* - Exact match HTML siblings (e.g., `</Tag>`)
|
|
71347
|
-
* - HTML siblings with embedded closing tag (e.g., `...\n</Tag>`)
|
|
71348
|
-
* - Paragraph siblings containing the closing tag as a child
|
|
71349
|
-
*
|
|
71350
|
-
* Returns null if not found within MAX_LOOKAHEAD siblings
|
|
71082
|
+
* Handle malformed emphasis that spans multiple AST nodes.
|
|
71083
|
+
* E.g., "**bold [link](url)**" where markers are in different text nodes.
|
|
71351
71084
|
*/
|
|
71352
|
-
|
|
71353
|
-
const
|
|
71354
|
-
|
|
71355
|
-
|
|
71356
|
-
|
|
71357
|
-
|
|
71358
|
-
|
|
71359
|
-
|
|
71360
|
-
|
|
71361
|
-
|
|
71362
|
-
|
|
71363
|
-
return { closingIndex: i, extraClosingChildren: [] };
|
|
71364
|
-
}
|
|
71365
|
-
// Embedded closing tag (closing tag within HTML block content)
|
|
71366
|
-
if (siblingValue.includes(closingTagStr)) {
|
|
71367
|
-
const closeTagPos = siblingValue.indexOf(closingTagStr);
|
|
71368
|
-
const contentBeforeClose = siblingValue.substring(0, closeTagPos).trim();
|
|
71369
|
-
const contentAfterClose = siblingValue.substring(closeTagPos + closingTagStr.length).trim();
|
|
71370
|
-
const extraChildren = contentBeforeClose
|
|
71371
|
-
? parseMdChildren(contentBeforeClose)
|
|
71372
|
-
: [];
|
|
71373
|
-
return { closingIndex: i, extraClosingChildren: extraChildren, contentAfterClose: contentAfterClose || undefined };
|
|
71374
|
-
}
|
|
71375
|
-
}
|
|
71376
|
-
// Check paragraph siblings
|
|
71377
|
-
if (sibling.type === 'paragraph') {
|
|
71378
|
-
const { paragraph, found } = stripClosingTagFromParagraph(sibling, tag);
|
|
71379
|
-
if (found) {
|
|
71380
|
-
return { closingIndex: i, extraClosingChildren: [], strippedParagraph: paragraph };
|
|
71381
|
-
}
|
|
71085
|
+
function visitMultiNodeEmphasis(tree) {
|
|
71086
|
+
const containerTypes = ['paragraph', 'heading', 'tableCell', 'listItem', 'blockquote'];
|
|
71087
|
+
visit(tree, node => {
|
|
71088
|
+
if (!containerTypes.includes(node.type))
|
|
71089
|
+
return;
|
|
71090
|
+
if (!('children' in node) || !Array.isArray(node.children))
|
|
71091
|
+
return;
|
|
71092
|
+
const container = node;
|
|
71093
|
+
let foundPair = true;
|
|
71094
|
+
while (foundPair) {
|
|
71095
|
+
foundPair = processOneEmphasisPair(container);
|
|
71382
71096
|
}
|
|
71383
|
-
}
|
|
71384
|
-
|
|
71385
|
-
// eslint-disable-next-line no-console
|
|
71386
|
-
console.warn(`Closing tag </${tag}> not found within ${MAX_LOOKAHEAD} siblings, stopping scan`);
|
|
71387
|
-
}
|
|
71388
|
-
return null;
|
|
71389
|
-
};
|
|
71390
|
-
const substituteNodeWithMdxNode = (parent, index, mdxNode) => {
|
|
71391
|
-
parent.children.splice(index, 1, mdxNode);
|
|
71392
|
-
};
|
|
71097
|
+
});
|
|
71098
|
+
}
|
|
71393
71099
|
/**
|
|
71394
|
-
*
|
|
71395
|
-
*
|
|
71396
|
-
*
|
|
71397
|
-
*
|
|
71398
|
-
* This transformer identifies these patterns and converts them to proper MDX JSX elements so they
|
|
71399
|
-
* can be accurately recognized and rendered later with their component definition code.
|
|
71400
|
-
* Though for some tags, we need to handle them specially
|
|
71401
|
-
*
|
|
71402
|
-
* ## Supported HTML Structures
|
|
71403
|
-
*
|
|
71404
|
-
* ### 1. Self-closing tags
|
|
71405
|
-
* ```
|
|
71406
|
-
* <Component />
|
|
71407
|
-
* ```
|
|
71408
|
-
* Parsed as: `html: "<Component />"`
|
|
71409
|
-
*
|
|
71410
|
-
* ### 2. Self-contained blocks (entire component in single HTML node)
|
|
71411
|
-
* ```
|
|
71412
|
-
* <Button>Click me</Button>
|
|
71413
|
-
* ```
|
|
71414
|
-
* ```
|
|
71415
|
-
* <Component>
|
|
71416
|
-
* <h2>Title</h2>
|
|
71417
|
-
* <p>Content</p>
|
|
71418
|
-
* </Component>
|
|
71419
|
-
* ```
|
|
71420
|
-
* Parsed as: `html: "<Component>\n <h2>Title</h2>\n <p>Content</p>\n</Component>"`
|
|
71421
|
-
* The opening tag, content, and closing tag are all captured in one HTML node.
|
|
71422
|
-
*
|
|
71423
|
-
* ### 3. Multi-sibling components (closing tag in a following sibling)
|
|
71424
|
-
* Handles various structures where the closing tag is in a later sibling, such as:
|
|
71425
|
-
*
|
|
71426
|
-
* #### 3a. Block components (closing tag in sibling paragraph)
|
|
71427
|
-
* ```
|
|
71428
|
-
* <Callout>
|
|
71429
|
-
* Some **markdown** content
|
|
71430
|
-
* </Callout>
|
|
71431
|
-
* ```
|
|
71432
|
-
*
|
|
71433
|
-
* #### 3b. Multi-paragraph components (closing tag several siblings away)
|
|
71434
|
-
* ```
|
|
71435
|
-
* <Callout>
|
|
71436
|
-
*
|
|
71437
|
-
* First paragraph
|
|
71438
|
-
*
|
|
71439
|
-
* Second paragraph
|
|
71440
|
-
* </Callout>
|
|
71441
|
-
* ```
|
|
71100
|
+
* A remark plugin that normalizes malformed bold and italic markers in text nodes.
|
|
71101
|
+
* Detects patterns like `** bold**`, `Hello** Wrong Bold**`, `__ bold__`, `Hello__ Wrong Bold__`,
|
|
71102
|
+
* `* italic*`, `Hello* Wrong Italic*`, `_ italic_`, or `Hello_ Wrong Italic_`
|
|
71103
|
+
* and converts them to proper strong/emphasis nodes, matching the behavior of the legacy rdmd engine.
|
|
71442
71104
|
*
|
|
71443
|
-
*
|
|
71444
|
-
*
|
|
71445
|
-
* <Outer>
|
|
71446
|
-
* <Inner>content</Inner>
|
|
71105
|
+
* Supports both asterisk (`**bold**`, `*italic*`) and underscore (`__bold__`, `_italic_`) syntax.
|
|
71106
|
+
* Also supports snake_case content like `** some_snake_case**`.
|
|
71447
71107
|
*
|
|
71448
|
-
*
|
|
71449
|
-
*
|
|
71450
|
-
* ```
|
|
71108
|
+
* This runs after remark-parse, which (in v11+) is strict and doesn't parse
|
|
71109
|
+
* malformed emphasis syntax. This plugin post-processes the AST to handle these cases.
|
|
71451
71110
|
*/
|
|
71452
|
-
const
|
|
71453
|
-
|
|
71454
|
-
|
|
71455
|
-
|
|
71456
|
-
if
|
|
71457
|
-
|
|
71458
|
-
|
|
71459
|
-
stack.push(node);
|
|
71111
|
+
const normalizeEmphasisAST = () => (tree) => {
|
|
71112
|
+
visit(tree, 'text', function visitor(node, index, parent) {
|
|
71113
|
+
if (index === undefined || !parent)
|
|
71114
|
+
return undefined;
|
|
71115
|
+
// Skip if inside code blocks or inline code
|
|
71116
|
+
if (parent.type === 'inlineCode' || parent.type === 'code') {
|
|
71117
|
+
return undefined;
|
|
71460
71118
|
}
|
|
71461
|
-
|
|
71462
|
-
|
|
71463
|
-
|
|
71464
|
-
|
|
71465
|
-
|
|
71466
|
-
|
|
71467
|
-
|
|
71468
|
-
|
|
71469
|
-
|
|
71470
|
-
|
|
71471
|
-
|
|
71472
|
-
|
|
71473
|
-
|
|
71474
|
-
|
|
71475
|
-
|
|
71476
|
-
|
|
71477
|
-
|
|
71478
|
-
|
|
71479
|
-
|
|
71480
|
-
|
|
71481
|
-
|
|
71482
|
-
|
|
71483
|
-
|
|
71484
|
-
|
|
71485
|
-
|
|
71486
|
-
|
|
71119
|
+
const text = node.value;
|
|
71120
|
+
const allMatches = [];
|
|
71121
|
+
[...text.matchAll(asteriskBoldRegex)].forEach(match => {
|
|
71122
|
+
allMatches.push({ isBold: true, marker: '**', match });
|
|
71123
|
+
});
|
|
71124
|
+
[...text.matchAll(underscoreBoldRegex)].forEach(match => {
|
|
71125
|
+
allMatches.push({ isBold: true, marker: '__', match });
|
|
71126
|
+
});
|
|
71127
|
+
[...text.matchAll(asteriskItalicRegex)].forEach(match => {
|
|
71128
|
+
allMatches.push({ isBold: false, marker: '*', match });
|
|
71129
|
+
});
|
|
71130
|
+
[...text.matchAll(underscoreItalicRegex)].forEach(match => {
|
|
71131
|
+
allMatches.push({ isBold: false, marker: '_', match });
|
|
71132
|
+
});
|
|
71133
|
+
[...text.matchAll(intrawordUnderscoreItalicRegex)].forEach(match => {
|
|
71134
|
+
allMatches.push({ isBold: false, isIntraword: true, marker: '_', match });
|
|
71135
|
+
});
|
|
71136
|
+
[...text.matchAll(intrawordUnderscoreBoldRegex)].forEach(match => {
|
|
71137
|
+
allMatches.push({ isBold: true, isIntraword: true, marker: '__', match });
|
|
71138
|
+
});
|
|
71139
|
+
[...text.matchAll(intrawordAsteriskItalicRegex)].forEach(match => {
|
|
71140
|
+
allMatches.push({ isBold: false, isIntraword: true, marker: '*', match });
|
|
71141
|
+
});
|
|
71142
|
+
[...text.matchAll(intrawordAsteriskBoldRegex)].forEach(match => {
|
|
71143
|
+
allMatches.push({ isBold: true, isIntraword: true, marker: '**', match });
|
|
71144
|
+
});
|
|
71145
|
+
if (allMatches.length === 0)
|
|
71146
|
+
return undefined;
|
|
71147
|
+
allMatches.sort((a, b) => (a.match.index ?? 0) - (b.match.index ?? 0));
|
|
71148
|
+
const filteredMatches = [];
|
|
71149
|
+
let lastEnd = 0;
|
|
71150
|
+
allMatches.forEach(info => {
|
|
71151
|
+
const start = info.match.index ?? 0;
|
|
71152
|
+
const end = start + info.match[0].length;
|
|
71153
|
+
if (start >= lastEnd) {
|
|
71154
|
+
filteredMatches.push(info);
|
|
71155
|
+
lastEnd = end;
|
|
71487
71156
|
}
|
|
71488
|
-
|
|
71489
|
-
|
|
71490
|
-
|
|
71491
|
-
|
|
71492
|
-
|
|
71493
|
-
|
|
71494
|
-
const
|
|
71495
|
-
const
|
|
71496
|
-
|
|
71497
|
-
|
|
71498
|
-
|
|
71499
|
-
|
|
71500
|
-
|
|
71501
|
-
|
|
71502
|
-
|
|
71503
|
-
|
|
71504
|
-
|
|
71505
|
-
|
|
71157
|
+
});
|
|
71158
|
+
if (filteredMatches.length === 0)
|
|
71159
|
+
return undefined;
|
|
71160
|
+
const parts = [];
|
|
71161
|
+
let lastIndex = 0;
|
|
71162
|
+
filteredMatches.forEach(({ isBold, isIntraword, marker, match }) => {
|
|
71163
|
+
const matchIndex = match.index ?? 0;
|
|
71164
|
+
const fullMatch = match[0];
|
|
71165
|
+
if (isIntraword) {
|
|
71166
|
+
// handles cases like hello_world_ where we only want to italicize 'world'
|
|
71167
|
+
const charBefore = match[1] || ''; // e.g., "l" in "hello_world_"
|
|
71168
|
+
const content = match[2]; // e.g., "world"
|
|
71169
|
+
const combinedBefore = text.slice(lastIndex, matchIndex) + charBefore;
|
|
71170
|
+
if (combinedBefore) {
|
|
71171
|
+
parts.push({ type: 'text', value: combinedBefore });
|
|
71172
|
+
}
|
|
71173
|
+
if (isBold) {
|
|
71174
|
+
parts.push({
|
|
71175
|
+
type: 'strong',
|
|
71176
|
+
children: [{ type: 'text', value: content }],
|
|
71177
|
+
});
|
|
71178
|
+
}
|
|
71179
|
+
else {
|
|
71180
|
+
parts.push({
|
|
71181
|
+
type: 'emphasis',
|
|
71182
|
+
children: [{ type: 'text', value: content }],
|
|
71183
|
+
});
|
|
71184
|
+
}
|
|
71185
|
+
lastIndex = matchIndex + fullMatch.length;
|
|
71186
|
+
return;
|
|
71506
71187
|
}
|
|
71507
|
-
|
|
71508
|
-
|
|
71509
|
-
|
|
71188
|
+
if (matchIndex > lastIndex) {
|
|
71189
|
+
const beforeText = text.slice(lastIndex, matchIndex);
|
|
71190
|
+
if (beforeText) {
|
|
71191
|
+
parts.push({ type: 'text', value: beforeText });
|
|
71192
|
+
}
|
|
71510
71193
|
}
|
|
71511
|
-
|
|
71512
|
-
|
|
71513
|
-
|
|
71514
|
-
|
|
71515
|
-
|
|
71516
|
-
|
|
71517
|
-
|
|
71518
|
-
|
|
71519
|
-
|
|
71520
|
-
|
|
71521
|
-
|
|
71522
|
-
|
|
71523
|
-
|
|
71524
|
-
|
|
71525
|
-
|
|
71526
|
-
|
|
71527
|
-
|
|
71528
|
-
|
|
71529
|
-
|
|
71530
|
-
|
|
71531
|
-
|
|
71532
|
-
|
|
71194
|
+
const wordBefore = match[1]; // e.g., "Hello" in "Hello** Wrong Bold**"
|
|
71195
|
+
const contentWithSpaceAfter = match[3]; // Content when there's a space after opening markers
|
|
71196
|
+
const trailingSpace1 = match[4] || ''; // Space before closing markers (for "** text **" pattern)
|
|
71197
|
+
const contentWithSpaceBefore = match[5]; // Content when there's only a space before closing markers
|
|
71198
|
+
const trailingSpace2 = match[6] || ''; // Space before closing markers (for "**text **" pattern)
|
|
71199
|
+
const trailingSpace = trailingSpace1 || trailingSpace2; // Combined trailing space
|
|
71200
|
+
const content = (contentWithSpaceAfter || contentWithSpaceBefore || '').trim();
|
|
71201
|
+
const afterChar = match[7]; // Character after closing markers (if any)
|
|
71202
|
+
const markerPos = fullMatch.indexOf(marker);
|
|
71203
|
+
const spacesBeforeMarkers = wordBefore
|
|
71204
|
+
? fullMatch.slice(wordBefore.length, markerPos)
|
|
71205
|
+
: fullMatch.slice(0, markerPos);
|
|
71206
|
+
const shouldAddSpace = !!contentWithSpaceAfter && !!wordBefore && !spacesBeforeMarkers;
|
|
71207
|
+
if (wordBefore) {
|
|
71208
|
+
const spacing = spacesBeforeMarkers + (shouldAddSpace ? ' ' : '');
|
|
71209
|
+
parts.push({ type: 'text', value: wordBefore + spacing });
|
|
71210
|
+
}
|
|
71211
|
+
else if (spacesBeforeMarkers) {
|
|
71212
|
+
parts.push({ type: 'text', value: spacesBeforeMarkers });
|
|
71213
|
+
}
|
|
71214
|
+
if (content) {
|
|
71215
|
+
if (isBold) {
|
|
71216
|
+
parts.push({
|
|
71217
|
+
type: 'strong',
|
|
71218
|
+
children: [{ type: 'text', value: content }],
|
|
71219
|
+
});
|
|
71220
|
+
}
|
|
71221
|
+
else {
|
|
71222
|
+
parts.push({
|
|
71223
|
+
type: 'emphasis',
|
|
71224
|
+
children: [{ type: 'text', value: content }],
|
|
71225
|
+
});
|
|
71226
|
+
}
|
|
71227
|
+
}
|
|
71228
|
+
if (afterChar) {
|
|
71229
|
+
const prefix = trailingSpace ? ' ' : '';
|
|
71230
|
+
parts.push({ type: 'text', value: prefix + afterChar });
|
|
71231
|
+
}
|
|
71232
|
+
lastIndex = matchIndex + fullMatch.length;
|
|
71533
71233
|
});
|
|
71534
|
-
|
|
71535
|
-
|
|
71536
|
-
|
|
71537
|
-
|
|
71538
|
-
|
|
71539
|
-
stack.push(componentNode);
|
|
71540
|
-
}
|
|
71541
|
-
// If the closing tag sibling had content after it (e.g., another component opening tag),
|
|
71542
|
-
// re-insert it as a sibling so it can be processed in subsequent iterations
|
|
71543
|
-
if (remainingAfterClose) {
|
|
71544
|
-
parseSibling(stack, parent, index, remainingAfterClose);
|
|
71234
|
+
if (lastIndex < text.length) {
|
|
71235
|
+
const remainingText = text.slice(lastIndex);
|
|
71236
|
+
if (remainingText) {
|
|
71237
|
+
parts.push({ type: 'text', value: remainingText });
|
|
71238
|
+
}
|
|
71545
71239
|
}
|
|
71546
|
-
|
|
71547
|
-
|
|
71548
|
-
|
|
71549
|
-
const parent = stack.pop();
|
|
71550
|
-
if (parent?.children) {
|
|
71551
|
-
parent.children.forEach((_child, index) => {
|
|
71552
|
-
processChildNode(parent, index);
|
|
71553
|
-
});
|
|
71240
|
+
if (parts.length > 0) {
|
|
71241
|
+
parent.children.splice(index, 1, ...parts);
|
|
71242
|
+
return [SKIP, index + parts.length];
|
|
71554
71243
|
}
|
|
71555
|
-
|
|
71244
|
+
return undefined;
|
|
71245
|
+
});
|
|
71246
|
+
// Handle malformed emphasis spanning multiple nodes (e.g., **text [link](url) **)
|
|
71247
|
+
visitMultiNodeEmphasis(tree);
|
|
71556
71248
|
return tree;
|
|
71557
71249
|
};
|
|
71558
|
-
/* harmony default export */ const
|
|
71250
|
+
/* harmony default export */ const normalize_malformed_md_syntax = (normalizeEmphasisAST);
|
|
71559
71251
|
|
|
71560
71252
|
;// ./processor/transform/mdxish/mdxish-tables.ts
|
|
71561
71253
|
|
|
@@ -71566,14 +71258,21 @@ const mdxishComponentBlocks = () => tree => {
|
|
|
71566
71258
|
|
|
71567
71259
|
|
|
71568
71260
|
|
|
71261
|
+
|
|
71262
|
+
|
|
71263
|
+
|
|
71569
71264
|
const isTableCell = (node) => isMDXElement(node) && ['th', 'td'].includes(node.name);
|
|
71570
71265
|
const tableTypes = {
|
|
71571
71266
|
tr: 'tableRow',
|
|
71572
71267
|
th: 'tableCell',
|
|
71573
71268
|
td: 'tableCell',
|
|
71574
71269
|
};
|
|
71575
|
-
const
|
|
71576
|
-
|
|
71270
|
+
const tableNodeProcessor = unified()
|
|
71271
|
+
.use(remarkParse)
|
|
71272
|
+
.use(remarkMdx)
|
|
71273
|
+
.use(normalize_malformed_md_syntax)
|
|
71274
|
+
.use([callouts, gemoji_])
|
|
71275
|
+
.use(remarkGfm);
|
|
71577
71276
|
/**
|
|
71578
71277
|
* Check if children are only text nodes that might contain markdown
|
|
71579
71278
|
*/
|
|
@@ -71603,14 +71302,14 @@ const extractTextFromChildren = (children) => {
|
|
|
71603
71302
|
.join('');
|
|
71604
71303
|
};
|
|
71605
71304
|
/**
|
|
71606
|
-
*
|
|
71305
|
+
* Returns true if any node in the array is block-level (non-phrasing) content.
|
|
71607
71306
|
*/
|
|
71608
|
-
const
|
|
71609
|
-
|
|
71610
|
-
return (tree.children || []);
|
|
71307
|
+
const hasFlowContent = (nodes) => {
|
|
71308
|
+
return nodes.some(node => !phrasing(node) && node.type !== 'paragraph');
|
|
71611
71309
|
};
|
|
71612
71310
|
/**
|
|
71613
|
-
* Process a Table node
|
|
71311
|
+
* Process a Table node: re-parse text-only cell content, then output as
|
|
71312
|
+
* a markdown table (phrasing-only) or keep as JSX <Table> (has flow content).
|
|
71614
71313
|
*/
|
|
71615
71314
|
const processTableNode = (node, index, parent) => {
|
|
71616
71315
|
if (node.name !== 'Table')
|
|
@@ -71618,54 +71317,88 @@ const processTableNode = (node, index, parent) => {
|
|
|
71618
71317
|
const { position } = node;
|
|
71619
71318
|
const { align: alignAttr } = getAttrs(node);
|
|
71620
71319
|
const align = Array.isArray(alignAttr) ? alignAttr : null;
|
|
71621
|
-
|
|
71622
|
-
//
|
|
71623
|
-
|
|
71624
|
-
|
|
71625
|
-
|
|
71626
|
-
|
|
71627
|
-
|
|
71628
|
-
|
|
71629
|
-
|
|
71630
|
-
|
|
71631
|
-
|
|
71632
|
-
|
|
71633
|
-
|
|
71634
|
-
|
|
71635
|
-
|
|
71636
|
-
|
|
71637
|
-
|
|
71638
|
-
if (parsedNode.type === 'paragraph' && 'children' in parsedNode && parsedNode.children) {
|
|
71639
|
-
return parsedNode.children;
|
|
71640
|
-
}
|
|
71641
|
-
return [parsedNode];
|
|
71642
|
-
});
|
|
71643
|
-
}
|
|
71644
|
-
}
|
|
71645
|
-
catch {
|
|
71646
|
-
// If parsing fails, keep original children
|
|
71647
|
-
}
|
|
71320
|
+
let tableHasFlowContent = false;
|
|
71321
|
+
// Re-parse text-only cells through markdown and detect flow content
|
|
71322
|
+
visit(node, isTableCell, (cell) => {
|
|
71323
|
+
if (!isTextOnly(cell.children))
|
|
71324
|
+
return;
|
|
71325
|
+
const textContent = extractTextFromChildren(cell.children);
|
|
71326
|
+
if (!textContent.trim())
|
|
71327
|
+
return;
|
|
71328
|
+
// Since now we are using remarkMdx, which can fail and error, we need to
|
|
71329
|
+
// gate this behind a try/catch to ensure that malformed syntaxes do not
|
|
71330
|
+
// crash the page
|
|
71331
|
+
try {
|
|
71332
|
+
const parsed = tableNodeProcessor.runSync(tableNodeProcessor.parse(textContent));
|
|
71333
|
+
if (parsed.children.length > 0) {
|
|
71334
|
+
cell.children = parsed.children;
|
|
71335
|
+
if (hasFlowContent(parsed.children)) {
|
|
71336
|
+
tableHasFlowContent = true;
|
|
71648
71337
|
}
|
|
71649
71338
|
}
|
|
71650
|
-
|
|
71651
|
-
|
|
71652
|
-
|
|
71653
|
-
|
|
71654
|
-
|
|
71655
|
-
|
|
71656
|
-
|
|
71657
|
-
|
|
71658
|
-
|
|
71659
|
-
|
|
71339
|
+
}
|
|
71340
|
+
catch {
|
|
71341
|
+
// If parsing fails, keep original children
|
|
71342
|
+
}
|
|
71343
|
+
});
|
|
71344
|
+
// mdast's table node always treats the first tableRow as <thead>, so we can't
|
|
71345
|
+
// represent a header-less table in mdast without the first body row getting
|
|
71346
|
+
// promoted. Keep as JSX instead so remarkRehype renders it correctly
|
|
71347
|
+
let hasThead = false;
|
|
71348
|
+
visit(node, isMDXElement, (child) => {
|
|
71349
|
+
if (child.name === 'thead')
|
|
71350
|
+
hasThead = true;
|
|
71351
|
+
});
|
|
71352
|
+
if (tableHasFlowContent || !hasThead) {
|
|
71353
|
+
// remarkMdx wraps inline elements in paragraph nodes (e.g. <td> on the
|
|
71354
|
+
// same line as content becomes mdxJsxTextElement inside a paragraph).
|
|
71355
|
+
// Unwrap these so <td>/<th> sit directly under <tr>, and strip
|
|
71356
|
+
// whitespace-only text nodes to avoid rendering empty <p>/<br>.
|
|
71357
|
+
const cleanChildren = (children) => children
|
|
71358
|
+
.flatMap(child => {
|
|
71359
|
+
if (child.type === 'paragraph' && 'children' in child && Array.isArray(child.children)) {
|
|
71360
|
+
return child.children;
|
|
71361
|
+
}
|
|
71362
|
+
return [child];
|
|
71363
|
+
})
|
|
71364
|
+
.filter(child => !(child.type === 'text' && 'value' in child && typeof child.value === 'string' && !child.value.trim()));
|
|
71365
|
+
visit(node, isMDXElement, (el) => {
|
|
71366
|
+
if ('children' in el && Array.isArray(el.children)) {
|
|
71367
|
+
el.children = cleanChildren(el.children);
|
|
71368
|
+
}
|
|
71660
71369
|
});
|
|
71661
|
-
|
|
71662
|
-
|
|
71370
|
+
parent.children[index] = {
|
|
71371
|
+
...node,
|
|
71372
|
+
position,
|
|
71373
|
+
};
|
|
71374
|
+
return;
|
|
71375
|
+
}
|
|
71376
|
+
// All cells are phrasing-only — convert to markdown table
|
|
71377
|
+
const children = [];
|
|
71663
71378
|
visit(node, isMDXElement, (child) => {
|
|
71664
71379
|
if (child.name === 'thead' || child.name === 'tbody') {
|
|
71665
71380
|
visit(child, isMDXElement, (row) => {
|
|
71666
|
-
if (row.name
|
|
71667
|
-
|
|
71668
|
-
|
|
71381
|
+
if (row.name !== 'tr')
|
|
71382
|
+
return;
|
|
71383
|
+
const rowChildren = [];
|
|
71384
|
+
visit(row, isTableCell, ({ name, children: cellChildren, position: cellPosition }) => {
|
|
71385
|
+
const parsedChildren = cellChildren.flatMap(parsedNode => {
|
|
71386
|
+
if (parsedNode.type === 'paragraph' && 'children' in parsedNode && parsedNode.children) {
|
|
71387
|
+
return parsedNode.children;
|
|
71388
|
+
}
|
|
71389
|
+
return [parsedNode];
|
|
71390
|
+
});
|
|
71391
|
+
rowChildren.push({
|
|
71392
|
+
type: tableTypes[name],
|
|
71393
|
+
children: parsedChildren,
|
|
71394
|
+
position: cellPosition,
|
|
71395
|
+
});
|
|
71396
|
+
});
|
|
71397
|
+
children.push({
|
|
71398
|
+
type: 'tableRow',
|
|
71399
|
+
children: rowChildren,
|
|
71400
|
+
position: row.position,
|
|
71401
|
+
});
|
|
71669
71402
|
});
|
|
71670
71403
|
}
|
|
71671
71404
|
});
|
|
@@ -71685,54 +71418,35 @@ const processTableNode = (node, index, parent) => {
|
|
|
71685
71418
|
/**
|
|
71686
71419
|
* Converts JSX Table elements to markdown table nodes and re-parses markdown in cells.
|
|
71687
71420
|
*
|
|
71688
|
-
*
|
|
71689
|
-
*
|
|
71421
|
+
* The jsxTable micromark tokenizer captures `<Table>...</Table>` as a single html node,
|
|
71422
|
+
* preventing CommonMark HTML block type 6 from fragmenting it at blank lines. This
|
|
71423
|
+
* transformer then re-parses the html node with remarkMdx to produce proper JSX AST nodes
|
|
71424
|
+
* and converts them to MDAST table/tableRow/tableCell nodes.
|
|
71425
|
+
*
|
|
71426
|
+
* When cell content contains block-level nodes (callouts, code blocks, etc.), the table
|
|
71427
|
+
* is kept as a JSX <Table> element so that remarkRehype can properly handle the flow content.
|
|
71690
71428
|
*/
|
|
71691
71429
|
const mdxishTables = () => tree => {
|
|
71692
|
-
|
|
71693
|
-
|
|
71694
|
-
if (node.name === 'Table') {
|
|
71695
|
-
processTableNode(node, index, parent);
|
|
71696
|
-
return SKIP;
|
|
71697
|
-
}
|
|
71698
|
-
});
|
|
71699
|
-
// Also handle HTML and raw nodes that contain Table tags (in case mdxishComponentBlocks didn't convert them)
|
|
71700
|
-
// This happens when the entire <Table>...</Table> block is in a single HTML node, which mdxishComponentBlocks
|
|
71701
|
-
// doesn't handle (it only handles split nodes: opening tag, content paragraph, closing tag)
|
|
71702
|
-
const handleTableInNode = (node, index, parent) => {
|
|
71430
|
+
visit(tree, 'html', (_node, index, parent) => {
|
|
71431
|
+
const node = _node;
|
|
71703
71432
|
if (typeof index !== 'number' || !parent || !('children' in parent))
|
|
71704
71433
|
return;
|
|
71705
|
-
if (
|
|
71706
|
-
return;
|
|
71707
|
-
if (!node.value.includes('<Table') || !node.value.includes('</Table>'))
|
|
71434
|
+
if (!node.value.startsWith('<Table'))
|
|
71708
71435
|
return;
|
|
71709
71436
|
try {
|
|
71710
|
-
// Parse the HTML content with remarkMdx and mdxishComponentBlocks to convert it to MDX JSX elements
|
|
71711
|
-
// This creates a proper AST that we can then process
|
|
71712
71437
|
const parsed = tableNodeProcessor.runSync(tableNodeProcessor.parse(node.value));
|
|
71713
|
-
// Find the Table element in the parsed result and process it
|
|
71714
71438
|
visit(parsed, isMDXElement, (tableNode) => {
|
|
71715
71439
|
if (tableNode.name === 'Table') {
|
|
71716
|
-
// Process the table and replace the HTML node with a markdown table node
|
|
71717
71440
|
processTableNode(tableNode, index, parent);
|
|
71441
|
+
// Stop after the outermost Table so nested Tables don't overwrite parent.children[index]
|
|
71442
|
+
// we let it get handled naturally
|
|
71443
|
+
return EXIT;
|
|
71718
71444
|
}
|
|
71719
71445
|
});
|
|
71720
71446
|
}
|
|
71721
71447
|
catch {
|
|
71722
71448
|
// If parsing fails, leave the node as-is
|
|
71723
71449
|
}
|
|
71724
|
-
};
|
|
71725
|
-
// Handle HTML nodes (created by remark-parse for HTML blocks)
|
|
71726
|
-
visit(tree, 'html', (node, index, parent) => {
|
|
71727
|
-
if (typeof index === 'number' && parent && 'children' in parent) {
|
|
71728
|
-
handleTableInNode(node, index, parent);
|
|
71729
|
-
}
|
|
71730
|
-
});
|
|
71731
|
-
// Handle raw nodes (created by remark-parse for certain HTML structures)
|
|
71732
|
-
visit(tree, 'raw', (node, index, parent) => {
|
|
71733
|
-
if (typeof index === 'number' && parent && 'children' in parent) {
|
|
71734
|
-
handleTableInNode(node, index, parent);
|
|
71735
|
-
}
|
|
71736
71450
|
});
|
|
71737
71451
|
return tree;
|
|
71738
71452
|
};
|
|
@@ -92228,10 +91942,6 @@ const compile_list_item_listItem = (node, parent, state, info) => {
|
|
|
92228
91942
|
const plain_plain = (node) => node.value;
|
|
92229
91943
|
/* harmony default export */ const compile_plain = (plain_plain);
|
|
92230
91944
|
|
|
92231
|
-
;// ./processor/compile/variable.ts
|
|
92232
|
-
const variable = (node) => `{user.${node.data?.hProperties?.name || ''}}`;
|
|
92233
|
-
/* harmony default export */ const compile_variable = (variable);
|
|
92234
|
-
|
|
92235
91945
|
;// ./processor/compile/index.ts
|
|
92236
91946
|
|
|
92237
91947
|
|
|
@@ -93900,7 +93610,7 @@ function getComponentName(componentName, components) {
|
|
|
93900
93610
|
|
|
93901
93611
|
|
|
93902
93612
|
|
|
93903
|
-
const
|
|
93613
|
+
const INLINE_COMPONENT_TAGS = new Set(['anchor', 'glossary']);
|
|
93904
93614
|
function isElementContentNode(node) {
|
|
93905
93615
|
return node.type === 'element' || node.type === 'text' || node.type === 'comment';
|
|
93906
93616
|
}
|
|
@@ -93982,7 +93692,7 @@ function parseTextChildren(node, processMarkdown, components) {
|
|
|
93982
93692
|
const hast = processMarkdown(child.value.trim());
|
|
93983
93693
|
const children = (hast.children ?? []).filter(isElementContentNode);
|
|
93984
93694
|
// For inline components, preserve plain text instead of wrapping in <p>
|
|
93985
|
-
if (
|
|
93695
|
+
if (INLINE_COMPONENT_TAGS.has(node.tagName.toLowerCase()) && isSingleParagraphTextNode(children)) {
|
|
93986
93696
|
return [child];
|
|
93987
93697
|
}
|
|
93988
93698
|
return children;
|
|
@@ -94610,110 +94320,468 @@ const evaluateExpressions = ({ context = {} } = {}) => tree => {
|
|
|
94610
94320
|
};
|
|
94611
94321
|
/* harmony default export */ const evaluate_expressions = (evaluateExpressions);
|
|
94612
94322
|
|
|
94613
|
-
;// ./processor/transform/mdxish/heading-slugs.ts
|
|
94323
|
+
;// ./processor/transform/mdxish/heading-slugs.ts
|
|
94324
|
+
|
|
94325
|
+
|
|
94326
|
+
function isHeading(node) {
|
|
94327
|
+
return /^h[1-6]$/.test(node.tagName);
|
|
94328
|
+
}
|
|
94329
|
+
function textContent(node) {
|
|
94330
|
+
if (node.type === 'text')
|
|
94331
|
+
return node.value;
|
|
94332
|
+
// Process variable nodes by using their variable name for the id generation
|
|
94333
|
+
if (node.type === 'element' && node.tagName === 'variable' && node.properties?.name) {
|
|
94334
|
+
if (node.properties.isLegacy) {
|
|
94335
|
+
return node.properties.name;
|
|
94336
|
+
}
|
|
94337
|
+
return `user.${node.properties.name}`;
|
|
94338
|
+
}
|
|
94339
|
+
if ('children' in node)
|
|
94340
|
+
return node.children.map(textContent).join('');
|
|
94341
|
+
return '';
|
|
94342
|
+
}
|
|
94343
|
+
/**
|
|
94344
|
+
* Rehype plugin that constructs ids for headings
|
|
94345
|
+
* Id's are used to construct slug anchor links & Table of Contents during rendering
|
|
94346
|
+
* Use the text / nodes that make up the heading to generate the id
|
|
94347
|
+
*/
|
|
94348
|
+
const generateSlugForHeadings = () => (tree) => {
|
|
94349
|
+
const slugger = new BananaSlug();
|
|
94350
|
+
visit(tree, 'element', (node) => {
|
|
94351
|
+
if (isHeading(node) && !node.properties.id) {
|
|
94352
|
+
const text = node.children.map(textContent).join('');
|
|
94353
|
+
node.properties.id = slugger.slug(text);
|
|
94354
|
+
}
|
|
94355
|
+
});
|
|
94356
|
+
return tree;
|
|
94357
|
+
};
|
|
94358
|
+
/* harmony default export */ const heading_slugs = (generateSlugForHeadings);
|
|
94359
|
+
|
|
94360
|
+
// EXTERNAL MODULE: external "@readme/variable"
|
|
94361
|
+
var variable_ = __webpack_require__(8167);
|
|
94362
|
+
var variable_default = /*#__PURE__*/__webpack_require__.n(variable_);
|
|
94363
|
+
;// ./node_modules/rehype-parse/lib/index.js
|
|
94364
|
+
/**
|
|
94365
|
+
* @import {Root} from 'hast'
|
|
94366
|
+
* @import {Options as FromHtmlOptions} from 'hast-util-from-html'
|
|
94367
|
+
* @import {Parser, Processor} from 'unified'
|
|
94368
|
+
*/
|
|
94369
|
+
|
|
94370
|
+
/**
|
|
94371
|
+
* @typedef {Omit<FromHtmlOptions, 'onerror'> & RehypeParseFields} Options
|
|
94372
|
+
* Configuration.
|
|
94373
|
+
*
|
|
94374
|
+
* @typedef RehypeParseFields
|
|
94375
|
+
* Extra fields.
|
|
94376
|
+
* @property {boolean | null | undefined} [emitParseErrors=false]
|
|
94377
|
+
* Whether to emit parse errors while parsing (default: `false`).
|
|
94378
|
+
*
|
|
94379
|
+
* > 👉 **Note**: parse errors are currently being added to HTML.
|
|
94380
|
+
* > Not all errors emitted by parse5 (or us) are specced yet.
|
|
94381
|
+
* > Some documentation may still be missing.
|
|
94382
|
+
*/
|
|
94383
|
+
|
|
94384
|
+
|
|
94385
|
+
|
|
94386
|
+
/**
|
|
94387
|
+
* Plugin to add support for parsing from HTML.
|
|
94388
|
+
*
|
|
94389
|
+
* > 👉 **Note**: this is not an XML parser.
|
|
94390
|
+
* > It supports SVG as embedded in HTML.
|
|
94391
|
+
* > It does not support the features available in XML.
|
|
94392
|
+
* > Passing SVG files might break but fragments of modern SVG should be fine.
|
|
94393
|
+
* > Use [`xast-util-from-xml`][xast-util-from-xml] to parse XML.
|
|
94394
|
+
*
|
|
94395
|
+
* @param {Options | null | undefined} [options]
|
|
94396
|
+
* Configuration (optional).
|
|
94397
|
+
* @returns {undefined}
|
|
94398
|
+
* Nothing.
|
|
94399
|
+
*/
|
|
94400
|
+
function rehypeParse(options) {
|
|
94401
|
+
/** @type {Processor<Root>} */
|
|
94402
|
+
// @ts-expect-error: TS in JSDoc generates wrong types if `this` is typed regularly.
|
|
94403
|
+
const self = this
|
|
94404
|
+
const {emitParseErrors, ...settings} = {...self.data('settings'), ...options}
|
|
94405
|
+
|
|
94406
|
+
self.parser = parser
|
|
94407
|
+
|
|
94408
|
+
/**
|
|
94409
|
+
* @type {Parser<Root>}
|
|
94410
|
+
*/
|
|
94411
|
+
function parser(document, file) {
|
|
94412
|
+
return fromHtml(document, {
|
|
94413
|
+
...settings,
|
|
94414
|
+
onerror: emitParseErrors
|
|
94415
|
+
? function (message) {
|
|
94416
|
+
if (file.path) {
|
|
94417
|
+
message.name = file.path + ':' + message.name
|
|
94418
|
+
message.file = file.path
|
|
94419
|
+
}
|
|
94420
|
+
|
|
94421
|
+
file.messages.push(message)
|
|
94422
|
+
}
|
|
94423
|
+
: undefined
|
|
94424
|
+
})
|
|
94425
|
+
}
|
|
94426
|
+
}
|
|
94427
|
+
|
|
94428
|
+
;// ./lib/mdast-util/empty-task-list-item/index.ts
|
|
94429
|
+
/**
|
|
94430
|
+
* Normalizes list items that are written as only `[ ]` or `[x]` into GFM task
|
|
94431
|
+
* list items during parse, but only when at least one whitespace character
|
|
94432
|
+
* follows the closing bracket (`]`). This matches legacy behaviour for checkboxes
|
|
94433
|
+
*
|
|
94434
|
+
* The issue is `remark-gfm` does not actually classify these as task items when they have no content
|
|
94435
|
+
* after the checkbox, which leaves them as plain text (`"[ ]"`). So a custom extension is needed to
|
|
94436
|
+
* treat these as task items
|
|
94437
|
+
*/
|
|
94438
|
+
function exitListItemWithEmptyTaskListItem(token) {
|
|
94439
|
+
const node = this.stack[this.stack.length - 1];
|
|
94440
|
+
if (node &&
|
|
94441
|
+
node.type === 'listItem' &&
|
|
94442
|
+
typeof node.checked !== 'boolean') {
|
|
94443
|
+
const listItem = node;
|
|
94444
|
+
const head = listItem.children[0];
|
|
94445
|
+
if (head && head.type === 'paragraph' && head.children.length === 1) {
|
|
94446
|
+
const text = head.children[0];
|
|
94447
|
+
if (text.type === 'text') {
|
|
94448
|
+
const hasTrailingWhitespace = typeof head.position?.end.offset === 'number' &&
|
|
94449
|
+
typeof text.position?.end.offset === 'number' &&
|
|
94450
|
+
head.position.end.offset > text.position.end.offset;
|
|
94451
|
+
if (!hasTrailingWhitespace) {
|
|
94452
|
+
this.exit(token);
|
|
94453
|
+
return;
|
|
94454
|
+
}
|
|
94455
|
+
const value = text.value;
|
|
94456
|
+
if (value === '[ ]') {
|
|
94457
|
+
listItem.checked = false;
|
|
94458
|
+
head.children = [];
|
|
94459
|
+
}
|
|
94460
|
+
else if (value === '[x]' || value === '[X]') {
|
|
94461
|
+
listItem.checked = true;
|
|
94462
|
+
head.children = [];
|
|
94463
|
+
}
|
|
94464
|
+
}
|
|
94465
|
+
}
|
|
94466
|
+
}
|
|
94467
|
+
this.exit(token);
|
|
94468
|
+
}
|
|
94469
|
+
function emptyTaskListItemFromMarkdown() {
|
|
94470
|
+
return {
|
|
94471
|
+
exit: {
|
|
94472
|
+
listItem: exitListItemWithEmptyTaskListItem,
|
|
94473
|
+
},
|
|
94474
|
+
};
|
|
94475
|
+
}
|
|
94476
|
+
|
|
94477
|
+
;// ./lib/mdast-util/legacy-variable/index.ts
|
|
94478
|
+
|
|
94479
|
+
const contextMap = new WeakMap();
|
|
94480
|
+
function findlegacyVariableToken() {
|
|
94481
|
+
// tokenStack is micromark's current open token ancestry; find the nearest legacyVariable token.
|
|
94482
|
+
const events = this.tokenStack;
|
|
94483
|
+
for (let i = events.length - 1; i >= 0; i -= 1) {
|
|
94484
|
+
const token = events[i][0];
|
|
94485
|
+
if (token.type === 'legacyVariable')
|
|
94486
|
+
return token;
|
|
94487
|
+
}
|
|
94488
|
+
return undefined;
|
|
94489
|
+
}
|
|
94490
|
+
function enterlegacyVariable(token) {
|
|
94491
|
+
contextMap.set(token, { value: '' });
|
|
94492
|
+
}
|
|
94493
|
+
function exitlegacyVariableValue(token) {
|
|
94494
|
+
const variableToken = findlegacyVariableToken.call(this);
|
|
94495
|
+
if (!variableToken)
|
|
94496
|
+
return;
|
|
94497
|
+
const ctx = contextMap.get(variableToken);
|
|
94498
|
+
// Build up the variable characters
|
|
94499
|
+
if (ctx)
|
|
94500
|
+
ctx.value += this.sliceSerialize(token);
|
|
94501
|
+
}
|
|
94502
|
+
function exitlegacyVariable(token) {
|
|
94503
|
+
const ctx = contextMap.get(token);
|
|
94504
|
+
const serialized = this.sliceSerialize(token);
|
|
94505
|
+
const variableName = serialized.startsWith('<<') && serialized.endsWith('>>')
|
|
94506
|
+
? serialized.slice(2, -2)
|
|
94507
|
+
: ctx?.value ?? '';
|
|
94508
|
+
const nodePosition = {
|
|
94509
|
+
start: {
|
|
94510
|
+
offset: token.start.offset,
|
|
94511
|
+
line: token.start.line,
|
|
94512
|
+
column: token.start.column,
|
|
94513
|
+
},
|
|
94514
|
+
end: {
|
|
94515
|
+
offset: token.end.offset,
|
|
94516
|
+
line: token.end.line,
|
|
94517
|
+
column: token.end.column,
|
|
94518
|
+
},
|
|
94519
|
+
};
|
|
94520
|
+
if (variableName.startsWith('glossary:')) {
|
|
94521
|
+
const term = variableName.slice('glossary:'.length).trim();
|
|
94522
|
+
this.enter({
|
|
94523
|
+
type: NodeTypes.glossary,
|
|
94524
|
+
data: {
|
|
94525
|
+
hName: 'Glossary',
|
|
94526
|
+
hProperties: { term },
|
|
94527
|
+
},
|
|
94528
|
+
children: [{ type: 'text', value: term }],
|
|
94529
|
+
position: nodePosition,
|
|
94530
|
+
}, token);
|
|
94531
|
+
this.exit(token);
|
|
94532
|
+
contextMap.delete(token);
|
|
94533
|
+
return;
|
|
94534
|
+
}
|
|
94535
|
+
this.enter({
|
|
94536
|
+
type: NodeTypes.variable,
|
|
94537
|
+
data: {
|
|
94538
|
+
hName: 'Variable',
|
|
94539
|
+
hProperties: { name: variableName.trim(), isLegacy: true },
|
|
94540
|
+
},
|
|
94541
|
+
value: `<<${variableName}>>`,
|
|
94542
|
+
}, token);
|
|
94543
|
+
this.exit(token);
|
|
94544
|
+
contextMap.delete(token);
|
|
94545
|
+
}
|
|
94546
|
+
function legacyVariableFromMarkdown() {
|
|
94547
|
+
return {
|
|
94548
|
+
enter: {
|
|
94549
|
+
legacyVariable: enterlegacyVariable,
|
|
94550
|
+
},
|
|
94551
|
+
exit: {
|
|
94552
|
+
legacyVariableValue: exitlegacyVariableValue,
|
|
94553
|
+
legacyVariable: exitlegacyVariable,
|
|
94554
|
+
},
|
|
94555
|
+
};
|
|
94556
|
+
}
|
|
94557
|
+
|
|
94558
|
+
;// ./node_modules/micromark-util-symbol/lib/codes.js
|
|
94559
|
+
/**
|
|
94560
|
+
* Character codes.
|
|
94561
|
+
*
|
|
94562
|
+
* This module is compiled away!
|
|
94563
|
+
*
|
|
94564
|
+
* micromark works based on character codes.
|
|
94565
|
+
* This module contains constants for the ASCII block and the replacement
|
|
94566
|
+
* character.
|
|
94567
|
+
* A couple of them are handled in a special way, such as the line endings
|
|
94568
|
+
* (CR, LF, and CR+LF, commonly known as end-of-line: EOLs), the tab (horizontal
|
|
94569
|
+
* tab) and its expansion based on what column it’s at (virtual space),
|
|
94570
|
+
* and the end-of-file (eof) character.
|
|
94571
|
+
* As values are preprocessed before handling them, the actual characters LF,
|
|
94572
|
+
* CR, HT, and NUL (which is present as the replacement character), are
|
|
94573
|
+
* guaranteed to not exist.
|
|
94574
|
+
*
|
|
94575
|
+
* Unicode basic latin block.
|
|
94576
|
+
*/
|
|
94577
|
+
const codes = /** @type {const} */ ({
|
|
94578
|
+
carriageReturn: -5,
|
|
94579
|
+
lineFeed: -4,
|
|
94580
|
+
carriageReturnLineFeed: -3,
|
|
94581
|
+
horizontalTab: -2,
|
|
94582
|
+
virtualSpace: -1,
|
|
94583
|
+
eof: null,
|
|
94584
|
+
nul: 0,
|
|
94585
|
+
soh: 1,
|
|
94586
|
+
stx: 2,
|
|
94587
|
+
etx: 3,
|
|
94588
|
+
eot: 4,
|
|
94589
|
+
enq: 5,
|
|
94590
|
+
ack: 6,
|
|
94591
|
+
bel: 7,
|
|
94592
|
+
bs: 8,
|
|
94593
|
+
ht: 9, // `\t`
|
|
94594
|
+
lf: 10, // `\n`
|
|
94595
|
+
vt: 11, // `\v`
|
|
94596
|
+
ff: 12, // `\f`
|
|
94597
|
+
cr: 13, // `\r`
|
|
94598
|
+
so: 14,
|
|
94599
|
+
si: 15,
|
|
94600
|
+
dle: 16,
|
|
94601
|
+
dc1: 17,
|
|
94602
|
+
dc2: 18,
|
|
94603
|
+
dc3: 19,
|
|
94604
|
+
dc4: 20,
|
|
94605
|
+
nak: 21,
|
|
94606
|
+
syn: 22,
|
|
94607
|
+
etb: 23,
|
|
94608
|
+
can: 24,
|
|
94609
|
+
em: 25,
|
|
94610
|
+
sub: 26,
|
|
94611
|
+
esc: 27,
|
|
94612
|
+
fs: 28,
|
|
94613
|
+
gs: 29,
|
|
94614
|
+
rs: 30,
|
|
94615
|
+
us: 31,
|
|
94616
|
+
space: 32,
|
|
94617
|
+
exclamationMark: 33, // `!`
|
|
94618
|
+
quotationMark: 34, // `"`
|
|
94619
|
+
numberSign: 35, // `#`
|
|
94620
|
+
dollarSign: 36, // `$`
|
|
94621
|
+
percentSign: 37, // `%`
|
|
94622
|
+
ampersand: 38, // `&`
|
|
94623
|
+
apostrophe: 39, // `'`
|
|
94624
|
+
leftParenthesis: 40, // `(`
|
|
94625
|
+
rightParenthesis: 41, // `)`
|
|
94626
|
+
asterisk: 42, // `*`
|
|
94627
|
+
plusSign: 43, // `+`
|
|
94628
|
+
comma: 44, // `,`
|
|
94629
|
+
dash: 45, // `-`
|
|
94630
|
+
dot: 46, // `.`
|
|
94631
|
+
slash: 47, // `/`
|
|
94632
|
+
digit0: 48, // `0`
|
|
94633
|
+
digit1: 49, // `1`
|
|
94634
|
+
digit2: 50, // `2`
|
|
94635
|
+
digit3: 51, // `3`
|
|
94636
|
+
digit4: 52, // `4`
|
|
94637
|
+
digit5: 53, // `5`
|
|
94638
|
+
digit6: 54, // `6`
|
|
94639
|
+
digit7: 55, // `7`
|
|
94640
|
+
digit8: 56, // `8`
|
|
94641
|
+
digit9: 57, // `9`
|
|
94642
|
+
colon: 58, // `:`
|
|
94643
|
+
semicolon: 59, // `;`
|
|
94644
|
+
lessThan: 60, // `<`
|
|
94645
|
+
equalsTo: 61, // `=`
|
|
94646
|
+
greaterThan: 62, // `>`
|
|
94647
|
+
questionMark: 63, // `?`
|
|
94648
|
+
atSign: 64, // `@`
|
|
94649
|
+
uppercaseA: 65, // `A`
|
|
94650
|
+
uppercaseB: 66, // `B`
|
|
94651
|
+
uppercaseC: 67, // `C`
|
|
94652
|
+
uppercaseD: 68, // `D`
|
|
94653
|
+
uppercaseE: 69, // `E`
|
|
94654
|
+
uppercaseF: 70, // `F`
|
|
94655
|
+
uppercaseG: 71, // `G`
|
|
94656
|
+
uppercaseH: 72, // `H`
|
|
94657
|
+
uppercaseI: 73, // `I`
|
|
94658
|
+
uppercaseJ: 74, // `J`
|
|
94659
|
+
uppercaseK: 75, // `K`
|
|
94660
|
+
uppercaseL: 76, // `L`
|
|
94661
|
+
uppercaseM: 77, // `M`
|
|
94662
|
+
uppercaseN: 78, // `N`
|
|
94663
|
+
uppercaseO: 79, // `O`
|
|
94664
|
+
uppercaseP: 80, // `P`
|
|
94665
|
+
uppercaseQ: 81, // `Q`
|
|
94666
|
+
uppercaseR: 82, // `R`
|
|
94667
|
+
uppercaseS: 83, // `S`
|
|
94668
|
+
uppercaseT: 84, // `T`
|
|
94669
|
+
uppercaseU: 85, // `U`
|
|
94670
|
+
uppercaseV: 86, // `V`
|
|
94671
|
+
uppercaseW: 87, // `W`
|
|
94672
|
+
uppercaseX: 88, // `X`
|
|
94673
|
+
uppercaseY: 89, // `Y`
|
|
94674
|
+
uppercaseZ: 90, // `Z`
|
|
94675
|
+
leftSquareBracket: 91, // `[`
|
|
94676
|
+
backslash: 92, // `\`
|
|
94677
|
+
rightSquareBracket: 93, // `]`
|
|
94678
|
+
caret: 94, // `^`
|
|
94679
|
+
underscore: 95, // `_`
|
|
94680
|
+
graveAccent: 96, // `` ` ``
|
|
94681
|
+
lowercaseA: 97, // `a`
|
|
94682
|
+
lowercaseB: 98, // `b`
|
|
94683
|
+
lowercaseC: 99, // `c`
|
|
94684
|
+
lowercaseD: 100, // `d`
|
|
94685
|
+
lowercaseE: 101, // `e`
|
|
94686
|
+
lowercaseF: 102, // `f`
|
|
94687
|
+
lowercaseG: 103, // `g`
|
|
94688
|
+
lowercaseH: 104, // `h`
|
|
94689
|
+
lowercaseI: 105, // `i`
|
|
94690
|
+
lowercaseJ: 106, // `j`
|
|
94691
|
+
lowercaseK: 107, // `k`
|
|
94692
|
+
lowercaseL: 108, // `l`
|
|
94693
|
+
lowercaseM: 109, // `m`
|
|
94694
|
+
lowercaseN: 110, // `n`
|
|
94695
|
+
lowercaseO: 111, // `o`
|
|
94696
|
+
lowercaseP: 112, // `p`
|
|
94697
|
+
lowercaseQ: 113, // `q`
|
|
94698
|
+
lowercaseR: 114, // `r`
|
|
94699
|
+
lowercaseS: 115, // `s`
|
|
94700
|
+
lowercaseT: 116, // `t`
|
|
94701
|
+
lowercaseU: 117, // `u`
|
|
94702
|
+
lowercaseV: 118, // `v`
|
|
94703
|
+
lowercaseW: 119, // `w`
|
|
94704
|
+
lowercaseX: 120, // `x`
|
|
94705
|
+
lowercaseY: 121, // `y`
|
|
94706
|
+
lowercaseZ: 122, // `z`
|
|
94707
|
+
leftCurlyBrace: 123, // `{`
|
|
94708
|
+
verticalBar: 124, // `|`
|
|
94709
|
+
rightCurlyBrace: 125, // `}`
|
|
94710
|
+
tilde: 126, // `~`
|
|
94711
|
+
del: 127,
|
|
94712
|
+
// Unicode Specials block.
|
|
94713
|
+
byteOrderMarker: 65_279,
|
|
94714
|
+
// Unicode Specials block.
|
|
94715
|
+
replacementCharacter: 65_533 // `�`
|
|
94716
|
+
})
|
|
94717
|
+
|
|
94718
|
+
;// ./lib/micromark/legacy-variable/syntax.ts
|
|
94614
94719
|
|
|
94615
94720
|
|
|
94616
|
-
function
|
|
94617
|
-
return
|
|
94721
|
+
function isAllowedValueChar(code) {
|
|
94722
|
+
return (code !== null &&
|
|
94723
|
+
code !== codes.lessThan &&
|
|
94724
|
+
code !== codes.greaterThan &&
|
|
94725
|
+
!markdownLineEnding(code));
|
|
94618
94726
|
}
|
|
94619
|
-
|
|
94620
|
-
|
|
94621
|
-
|
|
94622
|
-
|
|
94623
|
-
|
|
94624
|
-
|
|
94625
|
-
|
|
94727
|
+
const legacyVariableConstruct = {
|
|
94728
|
+
name: 'legacyVariable',
|
|
94729
|
+
tokenize,
|
|
94730
|
+
};
|
|
94731
|
+
function tokenize(effects, ok, nok) {
|
|
94732
|
+
let hasValue = false;
|
|
94733
|
+
const start = (code) => {
|
|
94734
|
+
if (code !== codes.lessThan)
|
|
94735
|
+
return nok(code);
|
|
94736
|
+
effects.enter('legacyVariable');
|
|
94737
|
+
effects.enter('legacyVariableMarkerStart');
|
|
94738
|
+
effects.consume(code); // <
|
|
94739
|
+
return open2;
|
|
94740
|
+
};
|
|
94741
|
+
const open2 = (code) => {
|
|
94742
|
+
if (code !== codes.lessThan)
|
|
94743
|
+
return nok(code);
|
|
94744
|
+
effects.consume(code); // <<
|
|
94745
|
+
effects.exit('legacyVariableMarkerStart');
|
|
94746
|
+
effects.enter('legacyVariableValue');
|
|
94747
|
+
return value;
|
|
94748
|
+
};
|
|
94749
|
+
const value = (code) => {
|
|
94750
|
+
if (code === codes.greaterThan) {
|
|
94751
|
+
if (!hasValue)
|
|
94752
|
+
return nok(code);
|
|
94753
|
+
effects.exit('legacyVariableValue');
|
|
94754
|
+
effects.enter('legacyVariableMarkerEnd');
|
|
94755
|
+
effects.consume(code); // >
|
|
94756
|
+
return close2;
|
|
94626
94757
|
}
|
|
94627
|
-
|
|
94628
|
-
|
|
94629
|
-
|
|
94630
|
-
|
|
94631
|
-
|
|
94758
|
+
if (!isAllowedValueChar(code))
|
|
94759
|
+
return nok(code);
|
|
94760
|
+
hasValue = true;
|
|
94761
|
+
effects.consume(code);
|
|
94762
|
+
return value;
|
|
94763
|
+
};
|
|
94764
|
+
const close2 = (code) => {
|
|
94765
|
+
if (code !== codes.greaterThan)
|
|
94766
|
+
return nok(code);
|
|
94767
|
+
effects.consume(code); // >>
|
|
94768
|
+
effects.exit('legacyVariableMarkerEnd');
|
|
94769
|
+
effects.exit('legacyVariable');
|
|
94770
|
+
return ok;
|
|
94771
|
+
};
|
|
94772
|
+
return start;
|
|
94773
|
+
}
|
|
94774
|
+
function legacyVariable() {
|
|
94775
|
+
return {
|
|
94776
|
+
text: { [codes.lessThan]: legacyVariableConstruct },
|
|
94777
|
+
};
|
|
94632
94778
|
}
|
|
94633
|
-
/**
|
|
94634
|
-
* Rehype plugin that constructs ids for headings
|
|
94635
|
-
* Id's are used to construct slug anchor links & Table of Contents during rendering
|
|
94636
|
-
* Use the text / nodes that make up the heading to generate the id
|
|
94637
|
-
*/
|
|
94638
|
-
const generateSlugForHeadings = () => (tree) => {
|
|
94639
|
-
const slugger = new BananaSlug();
|
|
94640
|
-
visit(tree, 'element', (node) => {
|
|
94641
|
-
if (isHeading(node) && !node.properties.id) {
|
|
94642
|
-
const text = node.children.map(textContent).join('');
|
|
94643
|
-
node.properties.id = slugger.slug(text);
|
|
94644
|
-
}
|
|
94645
|
-
});
|
|
94646
|
-
return tree;
|
|
94647
|
-
};
|
|
94648
|
-
/* harmony default export */ const heading_slugs = (generateSlugForHeadings);
|
|
94649
|
-
|
|
94650
|
-
// EXTERNAL MODULE: external "@readme/variable"
|
|
94651
|
-
var variable_ = __webpack_require__(8167);
|
|
94652
|
-
var variable_default = /*#__PURE__*/__webpack_require__.n(variable_);
|
|
94653
|
-
;// ./node_modules/rehype-parse/lib/index.js
|
|
94654
|
-
/**
|
|
94655
|
-
* @import {Root} from 'hast'
|
|
94656
|
-
* @import {Options as FromHtmlOptions} from 'hast-util-from-html'
|
|
94657
|
-
* @import {Parser, Processor} from 'unified'
|
|
94658
|
-
*/
|
|
94659
|
-
|
|
94660
|
-
/**
|
|
94661
|
-
* @typedef {Omit<FromHtmlOptions, 'onerror'> & RehypeParseFields} Options
|
|
94662
|
-
* Configuration.
|
|
94663
|
-
*
|
|
94664
|
-
* @typedef RehypeParseFields
|
|
94665
|
-
* Extra fields.
|
|
94666
|
-
* @property {boolean | null | undefined} [emitParseErrors=false]
|
|
94667
|
-
* Whether to emit parse errors while parsing (default: `false`).
|
|
94668
|
-
*
|
|
94669
|
-
* > 👉 **Note**: parse errors are currently being added to HTML.
|
|
94670
|
-
* > Not all errors emitted by parse5 (or us) are specced yet.
|
|
94671
|
-
* > Some documentation may still be missing.
|
|
94672
|
-
*/
|
|
94673
|
-
|
|
94674
|
-
|
|
94675
94779
|
|
|
94780
|
+
;// ./lib/micromark/legacy-variable/index.ts
|
|
94676
94781
|
/**
|
|
94677
|
-
*
|
|
94678
|
-
*
|
|
94679
|
-
* > 👉 **Note**: this is not an XML parser.
|
|
94680
|
-
* > It supports SVG as embedded in HTML.
|
|
94681
|
-
* > It does not support the features available in XML.
|
|
94682
|
-
* > Passing SVG files might break but fragments of modern SVG should be fine.
|
|
94683
|
-
* > Use [`xast-util-from-xml`][xast-util-from-xml] to parse XML.
|
|
94684
|
-
*
|
|
94685
|
-
* @param {Options | null | undefined} [options]
|
|
94686
|
-
* Configuration (optional).
|
|
94687
|
-
* @returns {undefined}
|
|
94688
|
-
* Nothing.
|
|
94782
|
+
* Micromark extension for <<variable>> / <<glossary:term>> inline syntax.
|
|
94689
94783
|
*/
|
|
94690
|
-
function rehypeParse(options) {
|
|
94691
|
-
/** @type {Processor<Root>} */
|
|
94692
|
-
// @ts-expect-error: TS in JSDoc generates wrong types if `this` is typed regularly.
|
|
94693
|
-
const self = this
|
|
94694
|
-
const {emitParseErrors, ...settings} = {...self.data('settings'), ...options}
|
|
94695
|
-
|
|
94696
|
-
self.parser = parser
|
|
94697
|
-
|
|
94698
|
-
/**
|
|
94699
|
-
* @type {Parser<Root>}
|
|
94700
|
-
*/
|
|
94701
|
-
function parser(document, file) {
|
|
94702
|
-
return fromHtml(document, {
|
|
94703
|
-
...settings,
|
|
94704
|
-
onerror: emitParseErrors
|
|
94705
|
-
? function (message) {
|
|
94706
|
-
if (file.path) {
|
|
94707
|
-
message.name = file.path + ':' + message.name
|
|
94708
|
-
message.file = file.path
|
|
94709
|
-
}
|
|
94710
94784
|
|
|
94711
|
-
file.messages.push(message)
|
|
94712
|
-
}
|
|
94713
|
-
: undefined
|
|
94714
|
-
})
|
|
94715
|
-
}
|
|
94716
|
-
}
|
|
94717
94785
|
|
|
94718
94786
|
;// ./node_modules/entities/lib/esm/generated/encode-html.js
|
|
94719
94787
|
// Generated using scripts/write-encode-map.ts
|
|
@@ -95020,349 +95088,6 @@ function looseHtmlEntityFromMarkdown() {
|
|
|
95020
95088
|
*/
|
|
95021
95089
|
|
|
95022
95090
|
|
|
95023
|
-
;// ./processor/transform/mdxish/normalize-malformed-md-syntax.ts
|
|
95024
|
-
|
|
95025
|
-
// Marker patterns for multi-node emphasis detection
|
|
95026
|
-
const MARKER_PATTERNS = [
|
|
95027
|
-
{ isBold: true, marker: '**' },
|
|
95028
|
-
{ isBold: true, marker: '__' },
|
|
95029
|
-
{ isBold: false, marker: '*' },
|
|
95030
|
-
{ isBold: false, marker: '_' },
|
|
95031
|
-
];
|
|
95032
|
-
// Patterns to detect for bold (** and __) and italic (* and _) syntax:
|
|
95033
|
-
// Bold: ** text**, **text **, word** text**, ** text **
|
|
95034
|
-
// Italic: * text*, *text *, word* text*, * text *
|
|
95035
|
-
// Same patterns for underscore variants
|
|
95036
|
-
// We use separate patterns for each marker type to allow this flexibility.
|
|
95037
|
-
// Pattern for ** bold **
|
|
95038
|
-
// Groups: 1=wordBefore, 2=marker, 3=contentWithSpaceAfter, 4=trailingSpace1, 5=contentWithSpaceBefore, 6=trailingSpace2, 7=afterChar
|
|
95039
|
-
// trailingSpace1 is for "** text **" pattern, trailingSpace2 is for "**text **" pattern
|
|
95040
|
-
const asteriskBoldRegex = /([^*\s]+)?\s*(\*\*)(?:\s+((?:[^*\n]|\*(?!\*))+?)(\s*)\2|((?:[^*\n]|\*(?!\*))+?)(\s+)\2)(\S|$)?/g;
|
|
95041
|
-
// Pattern for __ bold __
|
|
95042
|
-
const underscoreBoldRegex = /([^_\s]+)?\s*(__)(?:\s+((?:__(?! )|_(?!_)|[^_\n])+?)(\s*)\2|((?:__(?! )|_(?!_)|[^_\n])+?)(\s+)\2)(\S|$)?/g;
|
|
95043
|
-
// Pattern for * italic *
|
|
95044
|
-
const asteriskItalicRegex = /([^*\s]+)?\s*(\*)(?!\*)(?:\s+([^*\n]+?)(\s*)\2|([^*\n]+?)(\s+)\2)(\S|$)?/g;
|
|
95045
|
-
// Pattern for _ italic _
|
|
95046
|
-
const underscoreItalicRegex = /([^_\s]+)?\s*(_)(?!_)(?:\s+((?:[^_\n]|_(?! ))+?)(\s*)\2|((?:[^_\n]|_(?! ))+?)(\s+)\2)(\S|$)?/g;
|
|
95047
|
-
// CommonMark ignores intraword underscores or asteriks, but we want to italicize/bold the inner part
|
|
95048
|
-
// Pattern for intraword _word_ in words like hello_world_
|
|
95049
|
-
const intrawordUnderscoreItalicRegex = /(\w)_(?!_)([a-zA-Z0-9]+)_(?![\w_])/g;
|
|
95050
|
-
// Pattern for intraword __word__ in words like hello__world__
|
|
95051
|
-
const intrawordUnderscoreBoldRegex = /(\w)__([a-zA-Z0-9]+)__(?![\w_])/g;
|
|
95052
|
-
// Pattern for intraword *word* in words like hello*world*
|
|
95053
|
-
const intrawordAsteriskItalicRegex = /(\w)\*(?!\*)([a-zA-Z0-9]+)\*(?![\w*])/g;
|
|
95054
|
-
// Pattern for intraword **word** in words like hello**world**
|
|
95055
|
-
const intrawordAsteriskBoldRegex = /(\w)\*\*([a-zA-Z0-9]+)\*\*(?![\w*])/g;
|
|
95056
|
-
/**
|
|
95057
|
-
* Finds opening emphasis marker in a text value.
|
|
95058
|
-
* Returns marker info if found, null otherwise.
|
|
95059
|
-
*/
|
|
95060
|
-
function findOpeningMarker(text) {
|
|
95061
|
-
const results = MARKER_PATTERNS.map(({ isBold, marker }) => {
|
|
95062
|
-
if (marker === '*' && text.startsWith('**'))
|
|
95063
|
-
return null;
|
|
95064
|
-
if (marker === '_' && text.startsWith('__'))
|
|
95065
|
-
return null;
|
|
95066
|
-
if (text.startsWith(marker) && text.length > marker.length) {
|
|
95067
|
-
return { isBold, marker, textAfter: text.slice(marker.length), textBefore: '' };
|
|
95068
|
-
}
|
|
95069
|
-
const idx = text.indexOf(marker);
|
|
95070
|
-
if (idx > 0 && !/\s/.test(text[idx - 1])) {
|
|
95071
|
-
if (marker === '*' && text.slice(idx).startsWith('**'))
|
|
95072
|
-
return null;
|
|
95073
|
-
if (marker === '_' && text.slice(idx).startsWith('__'))
|
|
95074
|
-
return null;
|
|
95075
|
-
const after = text.slice(idx + marker.length);
|
|
95076
|
-
if (after.length > 0) {
|
|
95077
|
-
return { isBold, marker, textAfter: after, textBefore: text.slice(0, idx) };
|
|
95078
|
-
}
|
|
95079
|
-
}
|
|
95080
|
-
return null;
|
|
95081
|
-
});
|
|
95082
|
-
return results.find(r => r !== null) ?? null;
|
|
95083
|
-
}
|
|
95084
|
-
/**
|
|
95085
|
-
* Finds the end/closing marker in a text node for multi-node emphasis.
|
|
95086
|
-
*/
|
|
95087
|
-
function findEndMarker(text, marker) {
|
|
95088
|
-
const spacePattern = ` ${marker}`;
|
|
95089
|
-
const spaceIdx = text.indexOf(spacePattern);
|
|
95090
|
-
if (spaceIdx >= 0) {
|
|
95091
|
-
if (marker === '*' && text.slice(spaceIdx + 1).startsWith('**'))
|
|
95092
|
-
return null;
|
|
95093
|
-
if (marker === '_' && text.slice(spaceIdx + 1).startsWith('__'))
|
|
95094
|
-
return null;
|
|
95095
|
-
return {
|
|
95096
|
-
textAfter: text.slice(spaceIdx + spacePattern.length),
|
|
95097
|
-
textBefore: text.slice(0, spaceIdx),
|
|
95098
|
-
};
|
|
95099
|
-
}
|
|
95100
|
-
if (text.startsWith(marker)) {
|
|
95101
|
-
if (marker === '*' && text.startsWith('**'))
|
|
95102
|
-
return null;
|
|
95103
|
-
if (marker === '_' && text.startsWith('__'))
|
|
95104
|
-
return null;
|
|
95105
|
-
return {
|
|
95106
|
-
textAfter: text.slice(marker.length),
|
|
95107
|
-
textBefore: '',
|
|
95108
|
-
};
|
|
95109
|
-
}
|
|
95110
|
-
return null;
|
|
95111
|
-
}
|
|
95112
|
-
/**
|
|
95113
|
-
* Scan children for an opening emphasis marker in a text node.
|
|
95114
|
-
*/
|
|
95115
|
-
function findOpeningInChildren(children) {
|
|
95116
|
-
let result = null;
|
|
95117
|
-
children.some((child, idx) => {
|
|
95118
|
-
if (child.type !== 'text')
|
|
95119
|
-
return false;
|
|
95120
|
-
const found = findOpeningMarker(child.value);
|
|
95121
|
-
if (found) {
|
|
95122
|
-
result = { idx, opening: found };
|
|
95123
|
-
return true;
|
|
95124
|
-
}
|
|
95125
|
-
return false;
|
|
95126
|
-
});
|
|
95127
|
-
return result;
|
|
95128
|
-
}
|
|
95129
|
-
/**
|
|
95130
|
-
* Scan children (after openingIdx) for a closing emphasis marker.
|
|
95131
|
-
*/
|
|
95132
|
-
function findClosingInChildren(children, openingIdx, marker) {
|
|
95133
|
-
let result = null;
|
|
95134
|
-
children.slice(openingIdx + 1).some((child, relativeIdx) => {
|
|
95135
|
-
if (child.type !== 'text')
|
|
95136
|
-
return false;
|
|
95137
|
-
const found = findEndMarker(child.value, marker);
|
|
95138
|
-
if (found) {
|
|
95139
|
-
result = { closingIdx: openingIdx + 1 + relativeIdx, closing: found };
|
|
95140
|
-
return true;
|
|
95141
|
-
}
|
|
95142
|
-
return false;
|
|
95143
|
-
});
|
|
95144
|
-
return result;
|
|
95145
|
-
}
|
|
95146
|
-
/**
|
|
95147
|
-
* Build the replacement nodes for a matched emphasis pair.
|
|
95148
|
-
*/
|
|
95149
|
-
function buildReplacementNodes(container, { opening, openingIdx, closing, closingIdx }) {
|
|
95150
|
-
const newNodes = [];
|
|
95151
|
-
if (opening.textBefore) {
|
|
95152
|
-
newNodes.push({ type: 'text', value: `${opening.textBefore} ` });
|
|
95153
|
-
}
|
|
95154
|
-
const emphasisChildren = [];
|
|
95155
|
-
const openingText = opening.textAfter.replace(/^\s+/, '');
|
|
95156
|
-
if (openingText) {
|
|
95157
|
-
emphasisChildren.push({ type: 'text', value: openingText });
|
|
95158
|
-
}
|
|
95159
|
-
container.children.slice(openingIdx + 1, closingIdx).forEach(child => {
|
|
95160
|
-
emphasisChildren.push(child);
|
|
95161
|
-
});
|
|
95162
|
-
const closingText = closing.textBefore.replace(/\s+$/, '');
|
|
95163
|
-
if (closingText) {
|
|
95164
|
-
emphasisChildren.push({ type: 'text', value: closingText });
|
|
95165
|
-
}
|
|
95166
|
-
if (emphasisChildren.length > 0) {
|
|
95167
|
-
const emphasisNode = opening.isBold
|
|
95168
|
-
? { type: 'strong', children: emphasisChildren }
|
|
95169
|
-
: { type: 'emphasis', children: emphasisChildren };
|
|
95170
|
-
newNodes.push(emphasisNode);
|
|
95171
|
-
}
|
|
95172
|
-
if (closing.textAfter) {
|
|
95173
|
-
newNodes.push({ type: 'text', value: closing.textAfter });
|
|
95174
|
-
}
|
|
95175
|
-
return newNodes;
|
|
95176
|
-
}
|
|
95177
|
-
/**
|
|
95178
|
-
* Find and transform one multi-node emphasis pair in the container.
|
|
95179
|
-
* Returns true if a pair was found and transformed, false otherwise.
|
|
95180
|
-
*/
|
|
95181
|
-
function processOneEmphasisPair(container) {
|
|
95182
|
-
const openingResult = findOpeningInChildren(container.children);
|
|
95183
|
-
if (!openingResult)
|
|
95184
|
-
return false;
|
|
95185
|
-
const { idx: openingIdx, opening } = openingResult;
|
|
95186
|
-
const closingResult = findClosingInChildren(container.children, openingIdx, opening.marker);
|
|
95187
|
-
if (!closingResult)
|
|
95188
|
-
return false;
|
|
95189
|
-
const { closingIdx, closing } = closingResult;
|
|
95190
|
-
const newNodes = buildReplacementNodes(container, { opening, openingIdx, closing, closingIdx });
|
|
95191
|
-
const deleteCount = closingIdx - openingIdx + 1;
|
|
95192
|
-
container.children.splice(openingIdx, deleteCount, ...newNodes);
|
|
95193
|
-
return true;
|
|
95194
|
-
}
|
|
95195
|
-
/**
|
|
95196
|
-
* Handle malformed emphasis that spans multiple AST nodes.
|
|
95197
|
-
* E.g., "**bold [link](url)**" where markers are in different text nodes.
|
|
95198
|
-
*/
|
|
95199
|
-
function visitMultiNodeEmphasis(tree) {
|
|
95200
|
-
const containerTypes = ['paragraph', 'heading', 'tableCell', 'listItem', 'blockquote'];
|
|
95201
|
-
visit(tree, node => {
|
|
95202
|
-
if (!containerTypes.includes(node.type))
|
|
95203
|
-
return;
|
|
95204
|
-
if (!('children' in node) || !Array.isArray(node.children))
|
|
95205
|
-
return;
|
|
95206
|
-
const container = node;
|
|
95207
|
-
let foundPair = true;
|
|
95208
|
-
while (foundPair) {
|
|
95209
|
-
foundPair = processOneEmphasisPair(container);
|
|
95210
|
-
}
|
|
95211
|
-
});
|
|
95212
|
-
}
|
|
95213
|
-
/**
|
|
95214
|
-
* A remark plugin that normalizes malformed bold and italic markers in text nodes.
|
|
95215
|
-
* Detects patterns like `** bold**`, `Hello** Wrong Bold**`, `__ bold__`, `Hello__ Wrong Bold__`,
|
|
95216
|
-
* `* italic*`, `Hello* Wrong Italic*`, `_ italic_`, or `Hello_ Wrong Italic_`
|
|
95217
|
-
* and converts them to proper strong/emphasis nodes, matching the behavior of the legacy rdmd engine.
|
|
95218
|
-
*
|
|
95219
|
-
* Supports both asterisk (`**bold**`, `*italic*`) and underscore (`__bold__`, `_italic_`) syntax.
|
|
95220
|
-
* Also supports snake_case content like `** some_snake_case**`.
|
|
95221
|
-
*
|
|
95222
|
-
* This runs after remark-parse, which (in v11+) is strict and doesn't parse
|
|
95223
|
-
* malformed emphasis syntax. This plugin post-processes the AST to handle these cases.
|
|
95224
|
-
*/
|
|
95225
|
-
const normalizeEmphasisAST = () => (tree) => {
|
|
95226
|
-
visit(tree, 'text', function visitor(node, index, parent) {
|
|
95227
|
-
if (index === undefined || !parent)
|
|
95228
|
-
return undefined;
|
|
95229
|
-
// Skip if inside code blocks or inline code
|
|
95230
|
-
if (parent.type === 'inlineCode' || parent.type === 'code') {
|
|
95231
|
-
return undefined;
|
|
95232
|
-
}
|
|
95233
|
-
const text = node.value;
|
|
95234
|
-
const allMatches = [];
|
|
95235
|
-
[...text.matchAll(asteriskBoldRegex)].forEach(match => {
|
|
95236
|
-
allMatches.push({ isBold: true, marker: '**', match });
|
|
95237
|
-
});
|
|
95238
|
-
[...text.matchAll(underscoreBoldRegex)].forEach(match => {
|
|
95239
|
-
allMatches.push({ isBold: true, marker: '__', match });
|
|
95240
|
-
});
|
|
95241
|
-
[...text.matchAll(asteriskItalicRegex)].forEach(match => {
|
|
95242
|
-
allMatches.push({ isBold: false, marker: '*', match });
|
|
95243
|
-
});
|
|
95244
|
-
[...text.matchAll(underscoreItalicRegex)].forEach(match => {
|
|
95245
|
-
allMatches.push({ isBold: false, marker: '_', match });
|
|
95246
|
-
});
|
|
95247
|
-
[...text.matchAll(intrawordUnderscoreItalicRegex)].forEach(match => {
|
|
95248
|
-
allMatches.push({ isBold: false, isIntraword: true, marker: '_', match });
|
|
95249
|
-
});
|
|
95250
|
-
[...text.matchAll(intrawordUnderscoreBoldRegex)].forEach(match => {
|
|
95251
|
-
allMatches.push({ isBold: true, isIntraword: true, marker: '__', match });
|
|
95252
|
-
});
|
|
95253
|
-
[...text.matchAll(intrawordAsteriskItalicRegex)].forEach(match => {
|
|
95254
|
-
allMatches.push({ isBold: false, isIntraword: true, marker: '*', match });
|
|
95255
|
-
});
|
|
95256
|
-
[...text.matchAll(intrawordAsteriskBoldRegex)].forEach(match => {
|
|
95257
|
-
allMatches.push({ isBold: true, isIntraword: true, marker: '**', match });
|
|
95258
|
-
});
|
|
95259
|
-
if (allMatches.length === 0)
|
|
95260
|
-
return undefined;
|
|
95261
|
-
allMatches.sort((a, b) => (a.match.index ?? 0) - (b.match.index ?? 0));
|
|
95262
|
-
const filteredMatches = [];
|
|
95263
|
-
let lastEnd = 0;
|
|
95264
|
-
allMatches.forEach(info => {
|
|
95265
|
-
const start = info.match.index ?? 0;
|
|
95266
|
-
const end = start + info.match[0].length;
|
|
95267
|
-
if (start >= lastEnd) {
|
|
95268
|
-
filteredMatches.push(info);
|
|
95269
|
-
lastEnd = end;
|
|
95270
|
-
}
|
|
95271
|
-
});
|
|
95272
|
-
if (filteredMatches.length === 0)
|
|
95273
|
-
return undefined;
|
|
95274
|
-
const parts = [];
|
|
95275
|
-
let lastIndex = 0;
|
|
95276
|
-
filteredMatches.forEach(({ isBold, isIntraword, marker, match }) => {
|
|
95277
|
-
const matchIndex = match.index ?? 0;
|
|
95278
|
-
const fullMatch = match[0];
|
|
95279
|
-
if (isIntraword) {
|
|
95280
|
-
// handles cases like hello_world_ where we only want to italicize 'world'
|
|
95281
|
-
const charBefore = match[1] || ''; // e.g., "l" in "hello_world_"
|
|
95282
|
-
const content = match[2]; // e.g., "world"
|
|
95283
|
-
const combinedBefore = text.slice(lastIndex, matchIndex) + charBefore;
|
|
95284
|
-
if (combinedBefore) {
|
|
95285
|
-
parts.push({ type: 'text', value: combinedBefore });
|
|
95286
|
-
}
|
|
95287
|
-
if (isBold) {
|
|
95288
|
-
parts.push({
|
|
95289
|
-
type: 'strong',
|
|
95290
|
-
children: [{ type: 'text', value: content }],
|
|
95291
|
-
});
|
|
95292
|
-
}
|
|
95293
|
-
else {
|
|
95294
|
-
parts.push({
|
|
95295
|
-
type: 'emphasis',
|
|
95296
|
-
children: [{ type: 'text', value: content }],
|
|
95297
|
-
});
|
|
95298
|
-
}
|
|
95299
|
-
lastIndex = matchIndex + fullMatch.length;
|
|
95300
|
-
return;
|
|
95301
|
-
}
|
|
95302
|
-
if (matchIndex > lastIndex) {
|
|
95303
|
-
const beforeText = text.slice(lastIndex, matchIndex);
|
|
95304
|
-
if (beforeText) {
|
|
95305
|
-
parts.push({ type: 'text', value: beforeText });
|
|
95306
|
-
}
|
|
95307
|
-
}
|
|
95308
|
-
const wordBefore = match[1]; // e.g., "Hello" in "Hello** Wrong Bold**"
|
|
95309
|
-
const contentWithSpaceAfter = match[3]; // Content when there's a space after opening markers
|
|
95310
|
-
const trailingSpace1 = match[4] || ''; // Space before closing markers (for "** text **" pattern)
|
|
95311
|
-
const contentWithSpaceBefore = match[5]; // Content when there's only a space before closing markers
|
|
95312
|
-
const trailingSpace2 = match[6] || ''; // Space before closing markers (for "**text **" pattern)
|
|
95313
|
-
const trailingSpace = trailingSpace1 || trailingSpace2; // Combined trailing space
|
|
95314
|
-
const content = (contentWithSpaceAfter || contentWithSpaceBefore || '').trim();
|
|
95315
|
-
const afterChar = match[7]; // Character after closing markers (if any)
|
|
95316
|
-
const markerPos = fullMatch.indexOf(marker);
|
|
95317
|
-
const spacesBeforeMarkers = wordBefore
|
|
95318
|
-
? fullMatch.slice(wordBefore.length, markerPos)
|
|
95319
|
-
: fullMatch.slice(0, markerPos);
|
|
95320
|
-
const shouldAddSpace = !!contentWithSpaceAfter && !!wordBefore && !spacesBeforeMarkers;
|
|
95321
|
-
if (wordBefore) {
|
|
95322
|
-
const spacing = spacesBeforeMarkers + (shouldAddSpace ? ' ' : '');
|
|
95323
|
-
parts.push({ type: 'text', value: wordBefore + spacing });
|
|
95324
|
-
}
|
|
95325
|
-
else if (spacesBeforeMarkers) {
|
|
95326
|
-
parts.push({ type: 'text', value: spacesBeforeMarkers });
|
|
95327
|
-
}
|
|
95328
|
-
if (content) {
|
|
95329
|
-
if (isBold) {
|
|
95330
|
-
parts.push({
|
|
95331
|
-
type: 'strong',
|
|
95332
|
-
children: [{ type: 'text', value: content }],
|
|
95333
|
-
});
|
|
95334
|
-
}
|
|
95335
|
-
else {
|
|
95336
|
-
parts.push({
|
|
95337
|
-
type: 'emphasis',
|
|
95338
|
-
children: [{ type: 'text', value: content }],
|
|
95339
|
-
});
|
|
95340
|
-
}
|
|
95341
|
-
}
|
|
95342
|
-
if (afterChar) {
|
|
95343
|
-
const prefix = trailingSpace ? ' ' : '';
|
|
95344
|
-
parts.push({ type: 'text', value: prefix + afterChar });
|
|
95345
|
-
}
|
|
95346
|
-
lastIndex = matchIndex + fullMatch.length;
|
|
95347
|
-
});
|
|
95348
|
-
if (lastIndex < text.length) {
|
|
95349
|
-
const remainingText = text.slice(lastIndex);
|
|
95350
|
-
if (remainingText) {
|
|
95351
|
-
parts.push({ type: 'text', value: remainingText });
|
|
95352
|
-
}
|
|
95353
|
-
}
|
|
95354
|
-
if (parts.length > 0) {
|
|
95355
|
-
parent.children.splice(index, 1, ...parts);
|
|
95356
|
-
return [SKIP, index + parts.length];
|
|
95357
|
-
}
|
|
95358
|
-
return undefined;
|
|
95359
|
-
});
|
|
95360
|
-
// Handle malformed emphasis spanning multiple nodes (e.g., **text [link](url) **)
|
|
95361
|
-
visitMultiNodeEmphasis(tree);
|
|
95362
|
-
return tree;
|
|
95363
|
-
};
|
|
95364
|
-
/* harmony default export */ const normalize_malformed_md_syntax = (normalizeEmphasisAST);
|
|
95365
|
-
|
|
95366
95091
|
;// ./processor/transform/mdxish/magic-blocks/patterns.ts
|
|
95367
95092
|
/** Matches HTML tags (open, close, self-closing) with optional attributes. */
|
|
95368
95093
|
const HTML_TAG_RE = /<\/?([a-zA-Z][a-zA-Z0-9-]*)((?:[^>"']*(?:"[^"]*"|'[^']*'))*[^>"']*)>/g;
|
|
@@ -95980,6 +95705,336 @@ const magicBlockTransformer = (options = {}) => tree => {
|
|
|
95980
95705
|
};
|
|
95981
95706
|
/* harmony default export */ const magic_block_transformer = (magicBlockTransformer);
|
|
95982
95707
|
|
|
95708
|
+
;// ./processor/transform/mdxish/constants.ts
|
|
95709
|
+
/**
|
|
95710
|
+
* Inline component tags handled by mdxish-inline-components.ts.
|
|
95711
|
+
* Also excluded from block-level handling in mdxish-component-blocks.ts.
|
|
95712
|
+
*/
|
|
95713
|
+
const constants_INLINE_COMPONENT_TAGS = new Set(['Anchor']);
|
|
95714
|
+
|
|
95715
|
+
;// ./processor/transform/mdxish/mdxish-component-blocks.ts
|
|
95716
|
+
|
|
95717
|
+
|
|
95718
|
+
|
|
95719
|
+
|
|
95720
|
+
|
|
95721
|
+
|
|
95722
|
+
|
|
95723
|
+
const pascalCaseTagPattern = /^<([A-Z][A-Za-z0-9_]*)([^>]*?)(\/?)>([\s\S]*)?$/;
|
|
95724
|
+
const tagAttributePattern = /([a-zA-Z_:][-a-zA-Z0-9_:.]*)(?:\s*=\s*("[^"]*"|'[^']*'|[^\s"'>]+))?/g;
|
|
95725
|
+
/**
|
|
95726
|
+
* Maximum number of siblings to scan forward when looking for a closing tag
|
|
95727
|
+
* to avoid scanning too far and degrading performance
|
|
95728
|
+
*/
|
|
95729
|
+
const MAX_LOOKAHEAD = 30;
|
|
95730
|
+
/**
|
|
95731
|
+
* Tags that have dedicated transformers and should NOT be handled by this plugin.
|
|
95732
|
+
* These components either have special parsing requirements that the generic component
|
|
95733
|
+
* block transformer cannot handle correctly, or are inline components that we don't
|
|
95734
|
+
* want to convert to mdxJsxFlowElement which is a block level element.
|
|
95735
|
+
*/
|
|
95736
|
+
const EXCLUDED_TAGS = new Set(['HTMLBlock', 'Table', 'Glossary', ...constants_INLINE_COMPONENT_TAGS]);
|
|
95737
|
+
const inlineMdProcessor = unified()
|
|
95738
|
+
.data('micromarkExtensions', [legacyVariable()])
|
|
95739
|
+
.data('fromMarkdownExtensions', [legacyVariableFromMarkdown(), emptyTaskListItemFromMarkdown()])
|
|
95740
|
+
.use(remarkParse)
|
|
95741
|
+
.use(remarkGfm);
|
|
95742
|
+
const isClosingTag = (value, tag) => value.trim() === `</${tag}>`;
|
|
95743
|
+
/**
|
|
95744
|
+
* Parse markdown content into mdast children nodes.
|
|
95745
|
+
*/
|
|
95746
|
+
const parseMdChildren = (value) => {
|
|
95747
|
+
const parsed = inlineMdProcessor.parse(value);
|
|
95748
|
+
return parsed.children || [];
|
|
95749
|
+
};
|
|
95750
|
+
/**
|
|
95751
|
+
* Convert raw attribute string into mdxJsxAttribute entries.
|
|
95752
|
+
* Handles both key-value attributes (theme="info") and boolean attributes (empty).
|
|
95753
|
+
*/
|
|
95754
|
+
const parseAttributes = (raw) => {
|
|
95755
|
+
const attributes = [];
|
|
95756
|
+
const attrString = raw.trim();
|
|
95757
|
+
if (!attrString)
|
|
95758
|
+
return attributes;
|
|
95759
|
+
tagAttributePattern.lastIndex = 0;
|
|
95760
|
+
let match = tagAttributePattern.exec(attrString);
|
|
95761
|
+
while (match !== null) {
|
|
95762
|
+
const [, attrName, attrValue] = match;
|
|
95763
|
+
const value = attrValue ? attrValue.replace(/^['"]|['"]$/g, '') : null;
|
|
95764
|
+
attributes.push({ type: 'mdxJsxAttribute', name: attrName, value });
|
|
95765
|
+
match = tagAttributePattern.exec(attrString);
|
|
95766
|
+
}
|
|
95767
|
+
return attributes;
|
|
95768
|
+
};
|
|
95769
|
+
/**
|
|
95770
|
+
* Parse an HTML tag string into structured data.
|
|
95771
|
+
*/
|
|
95772
|
+
const parseTag = (value) => {
|
|
95773
|
+
const match = value.match(pascalCaseTagPattern);
|
|
95774
|
+
if (!match)
|
|
95775
|
+
return null;
|
|
95776
|
+
const [, tag, attrString = '', selfClosing = '', contentAfterTag = ''] = match;
|
|
95777
|
+
return {
|
|
95778
|
+
tag,
|
|
95779
|
+
attributes: parseAttributes(attrString),
|
|
95780
|
+
selfClosing: !!selfClosing,
|
|
95781
|
+
contentAfterTag,
|
|
95782
|
+
};
|
|
95783
|
+
};
|
|
95784
|
+
/**
|
|
95785
|
+
* Parse substring content of a node and update the parent's children to include the new nodes.
|
|
95786
|
+
*/
|
|
95787
|
+
const parseSibling = (stack, parent, index, sibling) => {
|
|
95788
|
+
const siblingNodes = parseMdChildren(sibling);
|
|
95789
|
+
// The new sibling nodes might contain new components to be processed
|
|
95790
|
+
if (siblingNodes.length > 0) {
|
|
95791
|
+
parent.children.splice(index + 1, 0, ...siblingNodes);
|
|
95792
|
+
stack.push(parent);
|
|
95793
|
+
}
|
|
95794
|
+
};
|
|
95795
|
+
/**
|
|
95796
|
+
* Create an MdxJsxFlowElement node from component data.
|
|
95797
|
+
*/
|
|
95798
|
+
const createComponentNode = ({ tag, attributes, children, startPosition, endPosition }) => ({
|
|
95799
|
+
type: 'mdxJsxFlowElement',
|
|
95800
|
+
name: tag,
|
|
95801
|
+
attributes,
|
|
95802
|
+
children,
|
|
95803
|
+
position: {
|
|
95804
|
+
start: startPosition?.start,
|
|
95805
|
+
end: endPosition?.end ?? startPosition?.end,
|
|
95806
|
+
},
|
|
95807
|
+
});
|
|
95808
|
+
/**
|
|
95809
|
+
* Remove a closing tag from a paragraph's children and return the updated paragraph.
|
|
95810
|
+
*/
|
|
95811
|
+
const stripClosingTagFromParagraph = (node, tag) => {
|
|
95812
|
+
if (!Array.isArray(node.children))
|
|
95813
|
+
return { paragraph: node, found: false };
|
|
95814
|
+
const children = [...node.children];
|
|
95815
|
+
const closingIndex = children.findIndex(child => child.type === 'html' && isClosingTag(child.value || '', tag));
|
|
95816
|
+
if (closingIndex === -1)
|
|
95817
|
+
return { paragraph: node, found: false };
|
|
95818
|
+
children.splice(closingIndex, 1);
|
|
95819
|
+
return { paragraph: { ...node, children }, found: true };
|
|
95820
|
+
};
|
|
95821
|
+
/**
|
|
95822
|
+
* Scan forward through siblings to find a closing tag.
|
|
95823
|
+
* Handles:
|
|
95824
|
+
* - Exact match HTML siblings (e.g., `</Tag>`)
|
|
95825
|
+
* - HTML siblings with embedded closing tag (e.g., `...\n</Tag>`)
|
|
95826
|
+
* - Paragraph siblings containing the closing tag as a child
|
|
95827
|
+
*
|
|
95828
|
+
* Returns null if not found within MAX_LOOKAHEAD siblings
|
|
95829
|
+
*/
|
|
95830
|
+
const scanForClosingTag = (parent, startIndex, tag) => {
|
|
95831
|
+
const closingTagStr = `</${tag}>`;
|
|
95832
|
+
const maxIndex = Math.min(startIndex + MAX_LOOKAHEAD, parent.children.length);
|
|
95833
|
+
let i = startIndex + 1;
|
|
95834
|
+
for (; i < maxIndex; i += 1) {
|
|
95835
|
+
const sibling = parent.children[i];
|
|
95836
|
+
// Check HTML siblings
|
|
95837
|
+
if (sibling.type === 'html') {
|
|
95838
|
+
const siblingValue = sibling.value || '';
|
|
95839
|
+
// Exact match (standalone closing tag)
|
|
95840
|
+
if (isClosingTag(siblingValue, tag)) {
|
|
95841
|
+
return { closingIndex: i, extraClosingChildren: [] };
|
|
95842
|
+
}
|
|
95843
|
+
// Embedded closing tag (closing tag within HTML block content)
|
|
95844
|
+
if (siblingValue.includes(closingTagStr)) {
|
|
95845
|
+
const closeTagPos = siblingValue.indexOf(closingTagStr);
|
|
95846
|
+
const contentBeforeClose = siblingValue.substring(0, closeTagPos).trim();
|
|
95847
|
+
const contentAfterClose = siblingValue.substring(closeTagPos + closingTagStr.length).trim();
|
|
95848
|
+
const extraChildren = contentBeforeClose
|
|
95849
|
+
? parseMdChildren(contentBeforeClose)
|
|
95850
|
+
: [];
|
|
95851
|
+
return { closingIndex: i, extraClosingChildren: extraChildren, contentAfterClose: contentAfterClose || undefined };
|
|
95852
|
+
}
|
|
95853
|
+
}
|
|
95854
|
+
// Check paragraph siblings
|
|
95855
|
+
if (sibling.type === 'paragraph') {
|
|
95856
|
+
const { paragraph, found } = stripClosingTagFromParagraph(sibling, tag);
|
|
95857
|
+
if (found) {
|
|
95858
|
+
return { closingIndex: i, extraClosingChildren: [], strippedParagraph: paragraph };
|
|
95859
|
+
}
|
|
95860
|
+
}
|
|
95861
|
+
}
|
|
95862
|
+
if (i < parent.children.length) {
|
|
95863
|
+
// eslint-disable-next-line no-console
|
|
95864
|
+
console.warn(`Closing tag </${tag}> not found within ${MAX_LOOKAHEAD} siblings, stopping scan`);
|
|
95865
|
+
}
|
|
95866
|
+
return null;
|
|
95867
|
+
};
|
|
95868
|
+
const substituteNodeWithMdxNode = (parent, index, mdxNode) => {
|
|
95869
|
+
parent.children.splice(index, 1, mdxNode);
|
|
95870
|
+
};
|
|
95871
|
+
/**
|
|
95872
|
+
* Transform PascalCase HTML nodes into mdxJsxFlowElement nodes.
|
|
95873
|
+
*
|
|
95874
|
+
* Remark parses unknown/custom component tags as raw HTML nodes.
|
|
95875
|
+
* These are the custom readme MDX syntax for components.
|
|
95876
|
+
* This transformer identifies these patterns and converts them to proper MDX JSX elements so they
|
|
95877
|
+
* can be accurately recognized and rendered later with their component definition code.
|
|
95878
|
+
* Though for some tags, we need to handle them specially
|
|
95879
|
+
*
|
|
95880
|
+
* ## Supported HTML Structures
|
|
95881
|
+
*
|
|
95882
|
+
* ### 1. Self-closing tags
|
|
95883
|
+
* ```
|
|
95884
|
+
* <Component />
|
|
95885
|
+
* ```
|
|
95886
|
+
* Parsed as: `html: "<Component />"`
|
|
95887
|
+
*
|
|
95888
|
+
* ### 2. Self-contained blocks (entire component in single HTML node)
|
|
95889
|
+
* ```
|
|
95890
|
+
* <Button>Click me</Button>
|
|
95891
|
+
* ```
|
|
95892
|
+
* ```
|
|
95893
|
+
* <Component>
|
|
95894
|
+
* <h2>Title</h2>
|
|
95895
|
+
* <p>Content</p>
|
|
95896
|
+
* </Component>
|
|
95897
|
+
* ```
|
|
95898
|
+
* Parsed as: `html: "<Component>\n <h2>Title</h2>\n <p>Content</p>\n</Component>"`
|
|
95899
|
+
* The opening tag, content, and closing tag are all captured in one HTML node.
|
|
95900
|
+
*
|
|
95901
|
+
* ### 3. Multi-sibling components (closing tag in a following sibling)
|
|
95902
|
+
* Handles various structures where the closing tag is in a later sibling, such as:
|
|
95903
|
+
*
|
|
95904
|
+
* #### 3a. Block components (closing tag in sibling paragraph)
|
|
95905
|
+
* ```
|
|
95906
|
+
* <Callout>
|
|
95907
|
+
* Some **markdown** content
|
|
95908
|
+
* </Callout>
|
|
95909
|
+
* ```
|
|
95910
|
+
*
|
|
95911
|
+
* #### 3b. Multi-paragraph components (closing tag several siblings away)
|
|
95912
|
+
* ```
|
|
95913
|
+
* <Callout>
|
|
95914
|
+
*
|
|
95915
|
+
* First paragraph
|
|
95916
|
+
*
|
|
95917
|
+
* Second paragraph
|
|
95918
|
+
* </Callout>
|
|
95919
|
+
* ```
|
|
95920
|
+
*
|
|
95921
|
+
* #### 3c. Nested components split by blank lines (closing tag embedded in HTML sibling)
|
|
95922
|
+
* ```
|
|
95923
|
+
* <Outer>
|
|
95924
|
+
* <Inner>content</Inner>
|
|
95925
|
+
*
|
|
95926
|
+
* <Inner>content</Inner>
|
|
95927
|
+
* </Outer>
|
|
95928
|
+
* ```
|
|
95929
|
+
*/
|
|
95930
|
+
const mdxishComponentBlocks = () => tree => {
|
|
95931
|
+
const stack = [tree];
|
|
95932
|
+
const processChildNode = (parent, index) => {
|
|
95933
|
+
const node = parent.children[index];
|
|
95934
|
+
if (!node)
|
|
95935
|
+
return;
|
|
95936
|
+
if ('children' in node && Array.isArray(node.children)) {
|
|
95937
|
+
stack.push(node);
|
|
95938
|
+
}
|
|
95939
|
+
// Only visit HTML nodes with an actual html tag,
|
|
95940
|
+
// which means a potential unparsed MDX component
|
|
95941
|
+
const value = node.value;
|
|
95942
|
+
if (node.type !== 'html' || typeof value !== 'string')
|
|
95943
|
+
return;
|
|
95944
|
+
const parsed = parseTag(value.trim());
|
|
95945
|
+
if (!parsed)
|
|
95946
|
+
return;
|
|
95947
|
+
const { tag, attributes, selfClosing, contentAfterTag = '' } = parsed;
|
|
95948
|
+
// Skip tags that have dedicated transformers
|
|
95949
|
+
if (EXCLUDED_TAGS.has(tag))
|
|
95950
|
+
return;
|
|
95951
|
+
const closingTagStr = `</${tag}>`;
|
|
95952
|
+
// Case 1: Self-closing tag
|
|
95953
|
+
if (selfClosing) {
|
|
95954
|
+
const componentNode = createComponentNode({
|
|
95955
|
+
tag,
|
|
95956
|
+
attributes,
|
|
95957
|
+
children: [],
|
|
95958
|
+
startPosition: node.position,
|
|
95959
|
+
});
|
|
95960
|
+
substituteNodeWithMdxNode(parent, index, componentNode);
|
|
95961
|
+
// Check and parse if there's relevant content after the current closing tag
|
|
95962
|
+
const remainingContent = contentAfterTag.trim();
|
|
95963
|
+
if (remainingContent) {
|
|
95964
|
+
parseSibling(stack, parent, index, remainingContent);
|
|
95965
|
+
}
|
|
95966
|
+
return;
|
|
95967
|
+
}
|
|
95968
|
+
// Case 2: Self-contained block (closing tag in content)
|
|
95969
|
+
if (contentAfterTag.includes(closingTagStr)) {
|
|
95970
|
+
// Find the first closing tag
|
|
95971
|
+
const closingTagIndex = contentAfterTag.indexOf(closingTagStr);
|
|
95972
|
+
const componentInnerContent = contentAfterTag.substring(0, closingTagIndex).trim();
|
|
95973
|
+
const contentAfterClose = contentAfterTag.substring(closingTagIndex + closingTagStr.length).trim();
|
|
95974
|
+
const componentNode = createComponentNode({
|
|
95975
|
+
tag,
|
|
95976
|
+
attributes,
|
|
95977
|
+
children: componentInnerContent ? parseMdChildren(componentInnerContent) : [],
|
|
95978
|
+
startPosition: node.position,
|
|
95979
|
+
});
|
|
95980
|
+
substituteNodeWithMdxNode(parent, index, componentNode);
|
|
95981
|
+
// After the closing tag, there might be more content to be processed
|
|
95982
|
+
if (contentAfterClose) {
|
|
95983
|
+
parseSibling(stack, parent, index, contentAfterClose);
|
|
95984
|
+
}
|
|
95985
|
+
else if (componentNode.children.length > 0) {
|
|
95986
|
+
// The content inside the component block might contain new components to be processed
|
|
95987
|
+
stack.push(componentNode);
|
|
95988
|
+
}
|
|
95989
|
+
return;
|
|
95990
|
+
}
|
|
95991
|
+
// Case 3: Multi-sibling component (closing tag in a following sibling)
|
|
95992
|
+
// Scans forward through siblings to find closing tag in HTML or paragraph nodes
|
|
95993
|
+
const scanResult = scanForClosingTag(parent, index, tag);
|
|
95994
|
+
if (!scanResult)
|
|
95995
|
+
return;
|
|
95996
|
+
const { closingIndex, extraClosingChildren, strippedParagraph, contentAfterClose: remainingAfterClose } = scanResult;
|
|
95997
|
+
const extraChildren = contentAfterTag ? parseMdChildren(contentAfterTag.trimStart()) : [];
|
|
95998
|
+
// Collect all intermediate siblings between opening tag and closing tag
|
|
95999
|
+
const intermediateChildren = parent.children.slice(index + 1, closingIndex);
|
|
96000
|
+
// For paragraph siblings, include the full paragraph (with closing tag stripped)
|
|
96001
|
+
// For HTML siblings, include any content parsed from before the closing tag
|
|
96002
|
+
const closingChildren = strippedParagraph
|
|
96003
|
+
? (strippedParagraph.children.length > 0 ? [strippedParagraph] : [])
|
|
96004
|
+
: extraClosingChildren;
|
|
96005
|
+
const componentNode = createComponentNode({
|
|
96006
|
+
tag,
|
|
96007
|
+
attributes,
|
|
96008
|
+
children: [...extraChildren, ...intermediateChildren, ...closingChildren],
|
|
96009
|
+
startPosition: node.position,
|
|
96010
|
+
endPosition: parent.children[closingIndex]?.position,
|
|
96011
|
+
});
|
|
96012
|
+
// Remove all nodes from opening tag to closing tag (inclusive) and replace with component node
|
|
96013
|
+
parent.children.splice(index, closingIndex - index + 1, componentNode);
|
|
96014
|
+
// Since we might be merging sibling nodes together and combining content,
|
|
96015
|
+
// there might be new components to process
|
|
96016
|
+
if (componentNode.children.length > 0) {
|
|
96017
|
+
stack.push(componentNode);
|
|
96018
|
+
}
|
|
96019
|
+
// If the closing tag sibling had content after it (e.g., another component opening tag),
|
|
96020
|
+
// re-insert it as a sibling so it can be processed in subsequent iterations
|
|
96021
|
+
if (remainingAfterClose) {
|
|
96022
|
+
parseSibling(stack, parent, index, remainingAfterClose);
|
|
96023
|
+
}
|
|
96024
|
+
};
|
|
96025
|
+
// Process the nodes with the components depth-first to maintain the correct order of the nodes
|
|
96026
|
+
while (stack.length) {
|
|
96027
|
+
const parent = stack.pop();
|
|
96028
|
+
if (parent?.children) {
|
|
96029
|
+
parent.children.forEach((_child, index) => {
|
|
96030
|
+
processChildNode(parent, index);
|
|
96031
|
+
});
|
|
96032
|
+
}
|
|
96033
|
+
}
|
|
96034
|
+
return tree;
|
|
96035
|
+
};
|
|
96036
|
+
/* harmony default export */ const mdxish_component_blocks = (mdxishComponentBlocks);
|
|
96037
|
+
|
|
95983
96038
|
;// ./processor/transform/mdxish/mdxish-html-blocks.ts
|
|
95984
96039
|
|
|
95985
96040
|
|
|
@@ -96345,7 +96400,7 @@ const mdxishInlineComponents = () => tree => {
|
|
|
96345
96400
|
if (!match)
|
|
96346
96401
|
return;
|
|
96347
96402
|
const [, name, attrStr] = match;
|
|
96348
|
-
if (!
|
|
96403
|
+
if (!constants_INLINE_COMPONENT_TAGS.has(name))
|
|
96349
96404
|
return;
|
|
96350
96405
|
// Parse attributes directly - preserves all attribute types (strings, booleans, objects, arrays)
|
|
96351
96406
|
const attributes = parseAttributes(attrStr ?? '');
|
|
@@ -96646,12 +96701,6 @@ const mdxishMermaidTransformer = () => (tree) => {
|
|
|
96646
96701
|
};
|
|
96647
96702
|
/* harmony default export */ const mdxish_mermaid = (mdxishMermaidTransformer);
|
|
96648
96703
|
|
|
96649
|
-
;// ./lib/constants.ts
|
|
96650
|
-
/**
|
|
96651
|
-
* Pattern to match component tags (PascalCase or snake_case)
|
|
96652
|
-
*/
|
|
96653
|
-
const componentTagPattern = /<(\/?[A-Z][A-Za-z0-9_]*)([^>]*?)(\/?)>/g;
|
|
96654
|
-
|
|
96655
96704
|
;// ./processor/transform/mdxish/mdxish-snake-case-components.ts
|
|
96656
96705
|
|
|
96657
96706
|
|
|
@@ -97087,6 +97136,49 @@ const variablesTextTransformer = () => tree => {
|
|
|
97087
97136
|
};
|
|
97088
97137
|
/* harmony default export */ const variables_text = (variablesTextTransformer);
|
|
97089
97138
|
|
|
97139
|
+
;// ./lib/mdast-util/jsx-table/index.ts
|
|
97140
|
+
const jsx_table_contextMap = new WeakMap();
|
|
97141
|
+
function findJsxTableToken() {
|
|
97142
|
+
const events = this.tokenStack;
|
|
97143
|
+
for (let i = events.length - 1; i >= 0; i -= 1) {
|
|
97144
|
+
if (events[i][0].type === 'jsxTable')
|
|
97145
|
+
return events[i][0];
|
|
97146
|
+
}
|
|
97147
|
+
return undefined;
|
|
97148
|
+
}
|
|
97149
|
+
function enterJsxTable(token) {
|
|
97150
|
+
jsx_table_contextMap.set(token, { chunks: [] });
|
|
97151
|
+
this.enter({ type: 'html', value: '' }, token);
|
|
97152
|
+
}
|
|
97153
|
+
function exitJsxTableData(token) {
|
|
97154
|
+
const tableToken = findJsxTableToken.call(this);
|
|
97155
|
+
if (!tableToken)
|
|
97156
|
+
return;
|
|
97157
|
+
const ctx = jsx_table_contextMap.get(tableToken);
|
|
97158
|
+
if (ctx)
|
|
97159
|
+
ctx.chunks.push(this.sliceSerialize(token));
|
|
97160
|
+
}
|
|
97161
|
+
function exitJsxTable(token) {
|
|
97162
|
+
const ctx = jsx_table_contextMap.get(token);
|
|
97163
|
+
const node = this.stack[this.stack.length - 1];
|
|
97164
|
+
if (ctx) {
|
|
97165
|
+
node.value = ctx.chunks.join('\n');
|
|
97166
|
+
jsx_table_contextMap.delete(token);
|
|
97167
|
+
}
|
|
97168
|
+
this.exit(token);
|
|
97169
|
+
}
|
|
97170
|
+
function jsxTableFromMarkdown() {
|
|
97171
|
+
return {
|
|
97172
|
+
enter: {
|
|
97173
|
+
jsxTable: enterJsxTable,
|
|
97174
|
+
},
|
|
97175
|
+
exit: {
|
|
97176
|
+
jsxTableData: exitJsxTableData,
|
|
97177
|
+
jsxTable: exitJsxTable,
|
|
97178
|
+
},
|
|
97179
|
+
};
|
|
97180
|
+
}
|
|
97181
|
+
|
|
97090
97182
|
;// ./lib/mdast-util/magic-block/index.ts
|
|
97091
97183
|
const magic_block_contextMap = new WeakMap();
|
|
97092
97184
|
/**
|
|
@@ -97243,6 +97335,685 @@ function magicBlockToMarkdown() {
|
|
|
97243
97335
|
};
|
|
97244
97336
|
}
|
|
97245
97337
|
|
|
97338
|
+
;// ./node_modules/micromark-util-symbol/lib/types.js
|
|
97339
|
+
/**
|
|
97340
|
+
* This module is compiled away!
|
|
97341
|
+
*
|
|
97342
|
+
* Here is the list of all types of tokens exposed by micromark, with a short
|
|
97343
|
+
* explanation of what they include and where they are found.
|
|
97344
|
+
* In picking names, generally, the rule is to be as explicit as possible
|
|
97345
|
+
* instead of reusing names.
|
|
97346
|
+
* For example, there is a `definitionDestination` and a `resourceDestination`,
|
|
97347
|
+
* instead of one shared name.
|
|
97348
|
+
*/
|
|
97349
|
+
|
|
97350
|
+
// Note: when changing the next record, you must also change `TokenTypeMap`
|
|
97351
|
+
// in `micromark-util-types/index.d.ts`.
|
|
97352
|
+
const types_types = /** @type {const} */ ({
|
|
97353
|
+
// Generic type for data, such as in a title, a destination, etc.
|
|
97354
|
+
data: 'data',
|
|
97355
|
+
|
|
97356
|
+
// Generic type for syntactic whitespace (tabs, virtual spaces, spaces).
|
|
97357
|
+
// Such as, between a fenced code fence and an info string.
|
|
97358
|
+
whitespace: 'whitespace',
|
|
97359
|
+
|
|
97360
|
+
// Generic type for line endings (line feed, carriage return, carriage return +
|
|
97361
|
+
// line feed).
|
|
97362
|
+
lineEnding: 'lineEnding',
|
|
97363
|
+
|
|
97364
|
+
// A line ending, but ending a blank line.
|
|
97365
|
+
lineEndingBlank: 'lineEndingBlank',
|
|
97366
|
+
|
|
97367
|
+
// Generic type for whitespace (tabs, virtual spaces, spaces) at the start of a
|
|
97368
|
+
// line.
|
|
97369
|
+
linePrefix: 'linePrefix',
|
|
97370
|
+
|
|
97371
|
+
// Generic type for whitespace (tabs, virtual spaces, spaces) at the end of a
|
|
97372
|
+
// line.
|
|
97373
|
+
lineSuffix: 'lineSuffix',
|
|
97374
|
+
|
|
97375
|
+
// Whole ATX heading:
|
|
97376
|
+
//
|
|
97377
|
+
// ```markdown
|
|
97378
|
+
// #
|
|
97379
|
+
// ## Alpha
|
|
97380
|
+
// ### Bravo ###
|
|
97381
|
+
// ```
|
|
97382
|
+
//
|
|
97383
|
+
// Includes `atxHeadingSequence`, `whitespace`, `atxHeadingText`.
|
|
97384
|
+
atxHeading: 'atxHeading',
|
|
97385
|
+
|
|
97386
|
+
// Sequence of number signs in an ATX heading (`###`).
|
|
97387
|
+
atxHeadingSequence: 'atxHeadingSequence',
|
|
97388
|
+
|
|
97389
|
+
// Content in an ATX heading (`alpha`).
|
|
97390
|
+
// Includes text.
|
|
97391
|
+
atxHeadingText: 'atxHeadingText',
|
|
97392
|
+
|
|
97393
|
+
// Whole autolink (`<https://example.com>` or `<admin@example.com>`)
|
|
97394
|
+
// Includes `autolinkMarker` and `autolinkProtocol` or `autolinkEmail`.
|
|
97395
|
+
autolink: 'autolink',
|
|
97396
|
+
|
|
97397
|
+
// Email autolink w/o markers (`admin@example.com`)
|
|
97398
|
+
autolinkEmail: 'autolinkEmail',
|
|
97399
|
+
|
|
97400
|
+
// Marker around an `autolinkProtocol` or `autolinkEmail` (`<` or `>`).
|
|
97401
|
+
autolinkMarker: 'autolinkMarker',
|
|
97402
|
+
|
|
97403
|
+
// Protocol autolink w/o markers (`https://example.com`)
|
|
97404
|
+
autolinkProtocol: 'autolinkProtocol',
|
|
97405
|
+
|
|
97406
|
+
// A whole character escape (`\-`).
|
|
97407
|
+
// Includes `escapeMarker` and `characterEscapeValue`.
|
|
97408
|
+
characterEscape: 'characterEscape',
|
|
97409
|
+
|
|
97410
|
+
// The escaped character (`-`).
|
|
97411
|
+
characterEscapeValue: 'characterEscapeValue',
|
|
97412
|
+
|
|
97413
|
+
// A whole character reference (`&`, `≠`, or `𝌆`).
|
|
97414
|
+
// Includes `characterReferenceMarker`, an optional
|
|
97415
|
+
// `characterReferenceMarkerNumeric`, in which case an optional
|
|
97416
|
+
// `characterReferenceMarkerHexadecimal`, and a `characterReferenceValue`.
|
|
97417
|
+
characterReference: 'characterReference',
|
|
97418
|
+
|
|
97419
|
+
// The start or end marker (`&` or `;`).
|
|
97420
|
+
characterReferenceMarker: 'characterReferenceMarker',
|
|
97421
|
+
|
|
97422
|
+
// Mark reference as numeric (`#`).
|
|
97423
|
+
characterReferenceMarkerNumeric: 'characterReferenceMarkerNumeric',
|
|
97424
|
+
|
|
97425
|
+
// Mark reference as numeric (`x` or `X`).
|
|
97426
|
+
characterReferenceMarkerHexadecimal: 'characterReferenceMarkerHexadecimal',
|
|
97427
|
+
|
|
97428
|
+
// Value of character reference w/o markers (`amp`, `8800`, or `1D306`).
|
|
97429
|
+
characterReferenceValue: 'characterReferenceValue',
|
|
97430
|
+
|
|
97431
|
+
// Whole fenced code:
|
|
97432
|
+
//
|
|
97433
|
+
// ````markdown
|
|
97434
|
+
// ```js
|
|
97435
|
+
// alert(1)
|
|
97436
|
+
// ```
|
|
97437
|
+
// ````
|
|
97438
|
+
codeFenced: 'codeFenced',
|
|
97439
|
+
|
|
97440
|
+
// A fenced code fence, including whitespace, sequence, info, and meta
|
|
97441
|
+
// (` ```js `).
|
|
97442
|
+
codeFencedFence: 'codeFencedFence',
|
|
97443
|
+
|
|
97444
|
+
// Sequence of grave accent or tilde characters (` ``` `) in a fence.
|
|
97445
|
+
codeFencedFenceSequence: 'codeFencedFenceSequence',
|
|
97446
|
+
|
|
97447
|
+
// Info word (`js`) in a fence.
|
|
97448
|
+
// Includes string.
|
|
97449
|
+
codeFencedFenceInfo: 'codeFencedFenceInfo',
|
|
97450
|
+
|
|
97451
|
+
// Meta words (`highlight="1"`) in a fence.
|
|
97452
|
+
// Includes string.
|
|
97453
|
+
codeFencedFenceMeta: 'codeFencedFenceMeta',
|
|
97454
|
+
|
|
97455
|
+
// A line of code.
|
|
97456
|
+
codeFlowValue: 'codeFlowValue',
|
|
97457
|
+
|
|
97458
|
+
// Whole indented code:
|
|
97459
|
+
//
|
|
97460
|
+
// ```markdown
|
|
97461
|
+
// alert(1)
|
|
97462
|
+
// ```
|
|
97463
|
+
//
|
|
97464
|
+
// Includes `lineEnding`, `linePrefix`, and `codeFlowValue`.
|
|
97465
|
+
codeIndented: 'codeIndented',
|
|
97466
|
+
|
|
97467
|
+
// A text code (``` `alpha` ```).
|
|
97468
|
+
// Includes `codeTextSequence`, `codeTextData`, `lineEnding`, and can include
|
|
97469
|
+
// `codeTextPadding`.
|
|
97470
|
+
codeText: 'codeText',
|
|
97471
|
+
|
|
97472
|
+
codeTextData: 'codeTextData',
|
|
97473
|
+
|
|
97474
|
+
// A space or line ending right after or before a tick.
|
|
97475
|
+
codeTextPadding: 'codeTextPadding',
|
|
97476
|
+
|
|
97477
|
+
// A text code fence (` `` `).
|
|
97478
|
+
codeTextSequence: 'codeTextSequence',
|
|
97479
|
+
|
|
97480
|
+
// Whole content:
|
|
97481
|
+
//
|
|
97482
|
+
// ```markdown
|
|
97483
|
+
// [a]: b
|
|
97484
|
+
// c
|
|
97485
|
+
// =
|
|
97486
|
+
// d
|
|
97487
|
+
// ```
|
|
97488
|
+
//
|
|
97489
|
+
// Includes `paragraph` and `definition`.
|
|
97490
|
+
content: 'content',
|
|
97491
|
+
// Whole definition:
|
|
97492
|
+
//
|
|
97493
|
+
// ```markdown
|
|
97494
|
+
// [micromark]: https://github.com/micromark/micromark
|
|
97495
|
+
// ```
|
|
97496
|
+
//
|
|
97497
|
+
// Includes `definitionLabel`, `definitionMarker`, `whitespace`,
|
|
97498
|
+
// `definitionDestination`, and optionally `lineEnding` and `definitionTitle`.
|
|
97499
|
+
definition: 'definition',
|
|
97500
|
+
|
|
97501
|
+
// Destination of a definition (`https://github.com/micromark/micromark` or
|
|
97502
|
+
// `<https://github.com/micromark/micromark>`).
|
|
97503
|
+
// Includes `definitionDestinationLiteral` or `definitionDestinationRaw`.
|
|
97504
|
+
definitionDestination: 'definitionDestination',
|
|
97505
|
+
|
|
97506
|
+
// Enclosed destination of a definition
|
|
97507
|
+
// (`<https://github.com/micromark/micromark>`).
|
|
97508
|
+
// Includes `definitionDestinationLiteralMarker` and optionally
|
|
97509
|
+
// `definitionDestinationString`.
|
|
97510
|
+
definitionDestinationLiteral: 'definitionDestinationLiteral',
|
|
97511
|
+
|
|
97512
|
+
// Markers of an enclosed definition destination (`<` or `>`).
|
|
97513
|
+
definitionDestinationLiteralMarker: 'definitionDestinationLiteralMarker',
|
|
97514
|
+
|
|
97515
|
+
// Unenclosed destination of a definition
|
|
97516
|
+
// (`https://github.com/micromark/micromark`).
|
|
97517
|
+
// Includes `definitionDestinationString`.
|
|
97518
|
+
definitionDestinationRaw: 'definitionDestinationRaw',
|
|
97519
|
+
|
|
97520
|
+
// Text in an destination (`https://github.com/micromark/micromark`).
|
|
97521
|
+
// Includes string.
|
|
97522
|
+
definitionDestinationString: 'definitionDestinationString',
|
|
97523
|
+
|
|
97524
|
+
// Label of a definition (`[micromark]`).
|
|
97525
|
+
// Includes `definitionLabelMarker` and `definitionLabelString`.
|
|
97526
|
+
definitionLabel: 'definitionLabel',
|
|
97527
|
+
|
|
97528
|
+
// Markers of a definition label (`[` or `]`).
|
|
97529
|
+
definitionLabelMarker: 'definitionLabelMarker',
|
|
97530
|
+
|
|
97531
|
+
// Value of a definition label (`micromark`).
|
|
97532
|
+
// Includes string.
|
|
97533
|
+
definitionLabelString: 'definitionLabelString',
|
|
97534
|
+
|
|
97535
|
+
// Marker between a label and a destination (`:`).
|
|
97536
|
+
definitionMarker: 'definitionMarker',
|
|
97537
|
+
|
|
97538
|
+
// Title of a definition (`"x"`, `'y'`, or `(z)`).
|
|
97539
|
+
// Includes `definitionTitleMarker` and optionally `definitionTitleString`.
|
|
97540
|
+
definitionTitle: 'definitionTitle',
|
|
97541
|
+
|
|
97542
|
+
// Marker around a title of a definition (`"`, `'`, `(`, or `)`).
|
|
97543
|
+
definitionTitleMarker: 'definitionTitleMarker',
|
|
97544
|
+
|
|
97545
|
+
// Data without markers in a title (`z`).
|
|
97546
|
+
// Includes string.
|
|
97547
|
+
definitionTitleString: 'definitionTitleString',
|
|
97548
|
+
|
|
97549
|
+
// Emphasis (`*alpha*`).
|
|
97550
|
+
// Includes `emphasisSequence` and `emphasisText`.
|
|
97551
|
+
emphasis: 'emphasis',
|
|
97552
|
+
|
|
97553
|
+
// Sequence of emphasis markers (`*` or `_`).
|
|
97554
|
+
emphasisSequence: 'emphasisSequence',
|
|
97555
|
+
|
|
97556
|
+
// Emphasis text (`alpha`).
|
|
97557
|
+
// Includes text.
|
|
97558
|
+
emphasisText: 'emphasisText',
|
|
97559
|
+
|
|
97560
|
+
// The character escape marker (`\`).
|
|
97561
|
+
escapeMarker: 'escapeMarker',
|
|
97562
|
+
|
|
97563
|
+
// A hard break created with a backslash (`\\n`).
|
|
97564
|
+
// Note: does not include the line ending.
|
|
97565
|
+
hardBreakEscape: 'hardBreakEscape',
|
|
97566
|
+
|
|
97567
|
+
// A hard break created with trailing spaces (` \n`).
|
|
97568
|
+
// Does not include the line ending.
|
|
97569
|
+
hardBreakTrailing: 'hardBreakTrailing',
|
|
97570
|
+
|
|
97571
|
+
// Flow HTML:
|
|
97572
|
+
//
|
|
97573
|
+
// ```markdown
|
|
97574
|
+
// <div
|
|
97575
|
+
// ```
|
|
97576
|
+
//
|
|
97577
|
+
// Inlcudes `lineEnding`, `htmlFlowData`.
|
|
97578
|
+
htmlFlow: 'htmlFlow',
|
|
97579
|
+
|
|
97580
|
+
htmlFlowData: 'htmlFlowData',
|
|
97581
|
+
|
|
97582
|
+
// HTML in text (the tag in `a <i> b`).
|
|
97583
|
+
// Includes `lineEnding`, `htmlTextData`.
|
|
97584
|
+
htmlText: 'htmlText',
|
|
97585
|
+
|
|
97586
|
+
htmlTextData: 'htmlTextData',
|
|
97587
|
+
|
|
97588
|
+
// Whole image (``, `![alpha][bravo]`, `![alpha][]`, or
|
|
97589
|
+
// `![alpha]`).
|
|
97590
|
+
// Includes `label` and an optional `resource` or `reference`.
|
|
97591
|
+
image: 'image',
|
|
97592
|
+
|
|
97593
|
+
// Whole link label (`[*alpha*]`).
|
|
97594
|
+
// Includes `labelLink` or `labelImage`, `labelText`, and `labelEnd`.
|
|
97595
|
+
label: 'label',
|
|
97596
|
+
|
|
97597
|
+
// Text in an label (`*alpha*`).
|
|
97598
|
+
// Includes text.
|
|
97599
|
+
labelText: 'labelText',
|
|
97600
|
+
|
|
97601
|
+
// Start a link label (`[`).
|
|
97602
|
+
// Includes a `labelMarker`.
|
|
97603
|
+
labelLink: 'labelLink',
|
|
97604
|
+
|
|
97605
|
+
// Start an image label (`![`).
|
|
97606
|
+
// Includes `labelImageMarker` and `labelMarker`.
|
|
97607
|
+
labelImage: 'labelImage',
|
|
97608
|
+
|
|
97609
|
+
// Marker of a label (`[` or `]`).
|
|
97610
|
+
labelMarker: 'labelMarker',
|
|
97611
|
+
|
|
97612
|
+
// Marker to start an image (`!`).
|
|
97613
|
+
labelImageMarker: 'labelImageMarker',
|
|
97614
|
+
|
|
97615
|
+
// End a label (`]`).
|
|
97616
|
+
// Includes `labelMarker`.
|
|
97617
|
+
labelEnd: 'labelEnd',
|
|
97618
|
+
|
|
97619
|
+
// Whole link (`[alpha](bravo)`, `[alpha][bravo]`, `[alpha][]`, or `[alpha]`).
|
|
97620
|
+
// Includes `label` and an optional `resource` or `reference`.
|
|
97621
|
+
link: 'link',
|
|
97622
|
+
|
|
97623
|
+
// Whole paragraph:
|
|
97624
|
+
//
|
|
97625
|
+
// ```markdown
|
|
97626
|
+
// alpha
|
|
97627
|
+
// bravo.
|
|
97628
|
+
// ```
|
|
97629
|
+
//
|
|
97630
|
+
// Includes text.
|
|
97631
|
+
paragraph: 'paragraph',
|
|
97632
|
+
|
|
97633
|
+
// A reference (`[alpha]` or `[]`).
|
|
97634
|
+
// Includes `referenceMarker` and an optional `referenceString`.
|
|
97635
|
+
reference: 'reference',
|
|
97636
|
+
|
|
97637
|
+
// A reference marker (`[` or `]`).
|
|
97638
|
+
referenceMarker: 'referenceMarker',
|
|
97639
|
+
|
|
97640
|
+
// Reference text (`alpha`).
|
|
97641
|
+
// Includes string.
|
|
97642
|
+
referenceString: 'referenceString',
|
|
97643
|
+
|
|
97644
|
+
// A resource (`(https://example.com "alpha")`).
|
|
97645
|
+
// Includes `resourceMarker`, an optional `resourceDestination` with an optional
|
|
97646
|
+
// `whitespace` and `resourceTitle`.
|
|
97647
|
+
resource: 'resource',
|
|
97648
|
+
|
|
97649
|
+
// A resource destination (`https://example.com`).
|
|
97650
|
+
// Includes `resourceDestinationLiteral` or `resourceDestinationRaw`.
|
|
97651
|
+
resourceDestination: 'resourceDestination',
|
|
97652
|
+
|
|
97653
|
+
// A literal resource destination (`<https://example.com>`).
|
|
97654
|
+
// Includes `resourceDestinationLiteralMarker` and optionally
|
|
97655
|
+
// `resourceDestinationString`.
|
|
97656
|
+
resourceDestinationLiteral: 'resourceDestinationLiteral',
|
|
97657
|
+
|
|
97658
|
+
// A resource destination marker (`<` or `>`).
|
|
97659
|
+
resourceDestinationLiteralMarker: 'resourceDestinationLiteralMarker',
|
|
97660
|
+
|
|
97661
|
+
// A raw resource destination (`https://example.com`).
|
|
97662
|
+
// Includes `resourceDestinationString`.
|
|
97663
|
+
resourceDestinationRaw: 'resourceDestinationRaw',
|
|
97664
|
+
|
|
97665
|
+
// Resource destination text (`https://example.com`).
|
|
97666
|
+
// Includes string.
|
|
97667
|
+
resourceDestinationString: 'resourceDestinationString',
|
|
97668
|
+
|
|
97669
|
+
// A resource marker (`(` or `)`).
|
|
97670
|
+
resourceMarker: 'resourceMarker',
|
|
97671
|
+
|
|
97672
|
+
// A resource title (`"alpha"`, `'alpha'`, or `(alpha)`).
|
|
97673
|
+
// Includes `resourceTitleMarker` and optionally `resourceTitleString`.
|
|
97674
|
+
resourceTitle: 'resourceTitle',
|
|
97675
|
+
|
|
97676
|
+
// A resource title marker (`"`, `'`, `(`, or `)`).
|
|
97677
|
+
resourceTitleMarker: 'resourceTitleMarker',
|
|
97678
|
+
|
|
97679
|
+
// Resource destination title (`alpha`).
|
|
97680
|
+
// Includes string.
|
|
97681
|
+
resourceTitleString: 'resourceTitleString',
|
|
97682
|
+
|
|
97683
|
+
// Whole setext heading:
|
|
97684
|
+
//
|
|
97685
|
+
// ```markdown
|
|
97686
|
+
// alpha
|
|
97687
|
+
// bravo
|
|
97688
|
+
// =====
|
|
97689
|
+
// ```
|
|
97690
|
+
//
|
|
97691
|
+
// Includes `setextHeadingText`, `lineEnding`, `linePrefix`, and
|
|
97692
|
+
// `setextHeadingLine`.
|
|
97693
|
+
setextHeading: 'setextHeading',
|
|
97694
|
+
|
|
97695
|
+
// Content in a setext heading (`alpha\nbravo`).
|
|
97696
|
+
// Includes text.
|
|
97697
|
+
setextHeadingText: 'setextHeadingText',
|
|
97698
|
+
|
|
97699
|
+
// Underline in a setext heading, including whitespace suffix (`==`).
|
|
97700
|
+
// Includes `setextHeadingLineSequence`.
|
|
97701
|
+
setextHeadingLine: 'setextHeadingLine',
|
|
97702
|
+
|
|
97703
|
+
// Sequence of equals or dash characters in underline in a setext heading (`-`).
|
|
97704
|
+
setextHeadingLineSequence: 'setextHeadingLineSequence',
|
|
97705
|
+
|
|
97706
|
+
// Strong (`**alpha**`).
|
|
97707
|
+
// Includes `strongSequence` and `strongText`.
|
|
97708
|
+
strong: 'strong',
|
|
97709
|
+
|
|
97710
|
+
// Sequence of strong markers (`**` or `__`).
|
|
97711
|
+
strongSequence: 'strongSequence',
|
|
97712
|
+
|
|
97713
|
+
// Strong text (`alpha`).
|
|
97714
|
+
// Includes text.
|
|
97715
|
+
strongText: 'strongText',
|
|
97716
|
+
|
|
97717
|
+
// Whole thematic break:
|
|
97718
|
+
//
|
|
97719
|
+
// ```markdown
|
|
97720
|
+
// * * *
|
|
97721
|
+
// ```
|
|
97722
|
+
//
|
|
97723
|
+
// Includes `thematicBreakSequence` and `whitespace`.
|
|
97724
|
+
thematicBreak: 'thematicBreak',
|
|
97725
|
+
|
|
97726
|
+
// A sequence of one or more thematic break markers (`***`).
|
|
97727
|
+
thematicBreakSequence: 'thematicBreakSequence',
|
|
97728
|
+
|
|
97729
|
+
// Whole block quote:
|
|
97730
|
+
//
|
|
97731
|
+
// ```markdown
|
|
97732
|
+
// > a
|
|
97733
|
+
// >
|
|
97734
|
+
// > b
|
|
97735
|
+
// ```
|
|
97736
|
+
//
|
|
97737
|
+
// Includes `blockQuotePrefix` and flow.
|
|
97738
|
+
blockQuote: 'blockQuote',
|
|
97739
|
+
// The `>` or `> ` of a block quote.
|
|
97740
|
+
blockQuotePrefix: 'blockQuotePrefix',
|
|
97741
|
+
// The `>` of a block quote prefix.
|
|
97742
|
+
blockQuoteMarker: 'blockQuoteMarker',
|
|
97743
|
+
// The optional ` ` of a block quote prefix.
|
|
97744
|
+
blockQuotePrefixWhitespace: 'blockQuotePrefixWhitespace',
|
|
97745
|
+
|
|
97746
|
+
// Whole ordered list:
|
|
97747
|
+
//
|
|
97748
|
+
// ```markdown
|
|
97749
|
+
// 1. a
|
|
97750
|
+
// b
|
|
97751
|
+
// ```
|
|
97752
|
+
//
|
|
97753
|
+
// Includes `listItemPrefix`, flow, and optionally `listItemIndent` on further
|
|
97754
|
+
// lines.
|
|
97755
|
+
listOrdered: 'listOrdered',
|
|
97756
|
+
|
|
97757
|
+
// Whole unordered list:
|
|
97758
|
+
//
|
|
97759
|
+
// ```markdown
|
|
97760
|
+
// - a
|
|
97761
|
+
// b
|
|
97762
|
+
// ```
|
|
97763
|
+
//
|
|
97764
|
+
// Includes `listItemPrefix`, flow, and optionally `listItemIndent` on further
|
|
97765
|
+
// lines.
|
|
97766
|
+
listUnordered: 'listUnordered',
|
|
97767
|
+
|
|
97768
|
+
// The indent of further list item lines.
|
|
97769
|
+
listItemIndent: 'listItemIndent',
|
|
97770
|
+
|
|
97771
|
+
// A marker, as in, `*`, `+`, `-`, `.`, or `)`.
|
|
97772
|
+
listItemMarker: 'listItemMarker',
|
|
97773
|
+
|
|
97774
|
+
// The thing that starts a list item, such as `1. `.
|
|
97775
|
+
// Includes `listItemValue` if ordered, `listItemMarker`, and
|
|
97776
|
+
// `listItemPrefixWhitespace` (unless followed by a line ending).
|
|
97777
|
+
listItemPrefix: 'listItemPrefix',
|
|
97778
|
+
|
|
97779
|
+
// The whitespace after a marker.
|
|
97780
|
+
listItemPrefixWhitespace: 'listItemPrefixWhitespace',
|
|
97781
|
+
|
|
97782
|
+
// The numerical value of an ordered item.
|
|
97783
|
+
listItemValue: 'listItemValue',
|
|
97784
|
+
|
|
97785
|
+
// Internal types used for subtokenizers, compiled away
|
|
97786
|
+
chunkDocument: 'chunkDocument',
|
|
97787
|
+
chunkContent: 'chunkContent',
|
|
97788
|
+
chunkFlow: 'chunkFlow',
|
|
97789
|
+
chunkText: 'chunkText',
|
|
97790
|
+
chunkString: 'chunkString'
|
|
97791
|
+
})
|
|
97792
|
+
|
|
97793
|
+
;// ./lib/micromark/jsx-table/syntax.ts
|
|
97794
|
+
|
|
97795
|
+
|
|
97796
|
+
const syntax_nonLazyContinuationStart = {
|
|
97797
|
+
tokenize: syntax_tokenizeNonLazyContinuationStart,
|
|
97798
|
+
partial: true,
|
|
97799
|
+
};
|
|
97800
|
+
function resolveToJsxTable(events) {
|
|
97801
|
+
let index = events.length;
|
|
97802
|
+
while (index > 0) {
|
|
97803
|
+
index -= 1;
|
|
97804
|
+
if (events[index][0] === 'enter' && events[index][1].type === 'jsxTable') {
|
|
97805
|
+
break;
|
|
97806
|
+
}
|
|
97807
|
+
}
|
|
97808
|
+
if (index > 1 && events[index - 2][1].type === types_types.linePrefix) {
|
|
97809
|
+
events[index][1].start = events[index - 2][1].start;
|
|
97810
|
+
events[index + 1][1].start = events[index - 2][1].start;
|
|
97811
|
+
events.splice(index - 2, 2);
|
|
97812
|
+
}
|
|
97813
|
+
return events;
|
|
97814
|
+
}
|
|
97815
|
+
const jsxTableConstruct = {
|
|
97816
|
+
name: 'jsxTable',
|
|
97817
|
+
tokenize: tokenizeJsxTable,
|
|
97818
|
+
resolveTo: resolveToJsxTable,
|
|
97819
|
+
concrete: true,
|
|
97820
|
+
};
|
|
97821
|
+
function tokenizeJsxTable(effects, ok, nok) {
|
|
97822
|
+
let codeSpanOpenSize = 0;
|
|
97823
|
+
let codeSpanCloseSize = 0;
|
|
97824
|
+
let depth = 1;
|
|
97825
|
+
const TABLE_NAME = [codes.uppercaseT, codes.lowercaseA, codes.lowercaseB, codes.lowercaseL, codes.lowercaseE];
|
|
97826
|
+
const ABLE_SUFFIX = TABLE_NAME.slice(1);
|
|
97827
|
+
/** Build a state chain that matches a sequence of character codes. */
|
|
97828
|
+
function matchChars(chars, onMatch, onFail) {
|
|
97829
|
+
if (chars.length === 0)
|
|
97830
|
+
return onMatch;
|
|
97831
|
+
return ((code) => {
|
|
97832
|
+
if (code === chars[0]) {
|
|
97833
|
+
effects.consume(code);
|
|
97834
|
+
return matchChars(chars.slice(1), onMatch, onFail);
|
|
97835
|
+
}
|
|
97836
|
+
return onFail(code);
|
|
97837
|
+
});
|
|
97838
|
+
}
|
|
97839
|
+
return start;
|
|
97840
|
+
function start(code) {
|
|
97841
|
+
if (code !== codes.lessThan)
|
|
97842
|
+
return nok(code);
|
|
97843
|
+
effects.enter('jsxTable');
|
|
97844
|
+
effects.enter('jsxTableData');
|
|
97845
|
+
effects.consume(code);
|
|
97846
|
+
return matchChars(TABLE_NAME, afterTagName, nok);
|
|
97847
|
+
}
|
|
97848
|
+
function afterTagName(code) {
|
|
97849
|
+
if (code === codes.greaterThan || code === codes.slash || code === codes.space || code === codes.horizontalTab) {
|
|
97850
|
+
effects.consume(code);
|
|
97851
|
+
return body;
|
|
97852
|
+
}
|
|
97853
|
+
return nok(code);
|
|
97854
|
+
}
|
|
97855
|
+
function body(code) {
|
|
97856
|
+
// Reject unclosed <Table> so it falls back to normal HTML block parsing
|
|
97857
|
+
// instead of swallowing all subsequent content to EOF
|
|
97858
|
+
if (code === null) {
|
|
97859
|
+
return nok(code);
|
|
97860
|
+
}
|
|
97861
|
+
if (markdownLineEnding(code)) {
|
|
97862
|
+
effects.exit('jsxTableData');
|
|
97863
|
+
return continuationStart(code);
|
|
97864
|
+
}
|
|
97865
|
+
if (code === codes.backslash) {
|
|
97866
|
+
effects.consume(code);
|
|
97867
|
+
return escapedChar;
|
|
97868
|
+
}
|
|
97869
|
+
if (code === codes.lessThan) {
|
|
97870
|
+
effects.consume(code);
|
|
97871
|
+
return closeSlash;
|
|
97872
|
+
}
|
|
97873
|
+
// Skip over backtick code spans so `</Table>` in inline code isn't
|
|
97874
|
+
// treated as the closing tag
|
|
97875
|
+
if (code === codes.graveAccent) {
|
|
97876
|
+
codeSpanOpenSize = 0;
|
|
97877
|
+
return countOpenTicks(code);
|
|
97878
|
+
}
|
|
97879
|
+
effects.consume(code);
|
|
97880
|
+
return body;
|
|
97881
|
+
}
|
|
97882
|
+
function countOpenTicks(code) {
|
|
97883
|
+
if (code === codes.graveAccent) {
|
|
97884
|
+
codeSpanOpenSize += 1;
|
|
97885
|
+
effects.consume(code);
|
|
97886
|
+
return countOpenTicks;
|
|
97887
|
+
}
|
|
97888
|
+
return inCodeSpan(code);
|
|
97889
|
+
}
|
|
97890
|
+
function inCodeSpan(code) {
|
|
97891
|
+
if (code === null || markdownLineEnding(code))
|
|
97892
|
+
return body(code);
|
|
97893
|
+
if (code === codes.graveAccent) {
|
|
97894
|
+
codeSpanCloseSize = 0;
|
|
97895
|
+
return countCloseTicks(code);
|
|
97896
|
+
}
|
|
97897
|
+
effects.consume(code);
|
|
97898
|
+
return inCodeSpan;
|
|
97899
|
+
}
|
|
97900
|
+
function countCloseTicks(code) {
|
|
97901
|
+
if (code === codes.graveAccent) {
|
|
97902
|
+
codeSpanCloseSize += 1;
|
|
97903
|
+
effects.consume(code);
|
|
97904
|
+
return countCloseTicks;
|
|
97905
|
+
}
|
|
97906
|
+
return codeSpanCloseSize === codeSpanOpenSize ? body(code) : inCodeSpan(code);
|
|
97907
|
+
}
|
|
97908
|
+
function escapedChar(code) {
|
|
97909
|
+
if (code === null || markdownLineEnding(code)) {
|
|
97910
|
+
return body(code);
|
|
97911
|
+
}
|
|
97912
|
+
effects.consume(code);
|
|
97913
|
+
return body;
|
|
97914
|
+
}
|
|
97915
|
+
function closeSlash(code) {
|
|
97916
|
+
if (code === codes.slash) {
|
|
97917
|
+
effects.consume(code);
|
|
97918
|
+
return matchChars(TABLE_NAME, closeGt, body);
|
|
97919
|
+
}
|
|
97920
|
+
if (code === codes.uppercaseT) {
|
|
97921
|
+
effects.consume(code);
|
|
97922
|
+
return matchChars(ABLE_SUFFIX, openAfterTagName, body);
|
|
97923
|
+
}
|
|
97924
|
+
return body(code);
|
|
97925
|
+
}
|
|
97926
|
+
function openAfterTagName(code) {
|
|
97927
|
+
if (code === codes.greaterThan || code === codes.slash || code === codes.space || code === codes.horizontalTab) {
|
|
97928
|
+
depth += 1;
|
|
97929
|
+
effects.consume(code);
|
|
97930
|
+
return body;
|
|
97931
|
+
}
|
|
97932
|
+
return body(code);
|
|
97933
|
+
}
|
|
97934
|
+
function closeGt(code) {
|
|
97935
|
+
if (code === codes.greaterThan) {
|
|
97936
|
+
depth -= 1;
|
|
97937
|
+
effects.consume(code);
|
|
97938
|
+
if (depth === 0) {
|
|
97939
|
+
return afterClose;
|
|
97940
|
+
}
|
|
97941
|
+
return body;
|
|
97942
|
+
}
|
|
97943
|
+
return body(code);
|
|
97944
|
+
}
|
|
97945
|
+
function afterClose(code) {
|
|
97946
|
+
if (code === null || markdownLineEnding(code)) {
|
|
97947
|
+
effects.exit('jsxTableData');
|
|
97948
|
+
effects.exit('jsxTable');
|
|
97949
|
+
return ok(code);
|
|
97950
|
+
}
|
|
97951
|
+
effects.consume(code);
|
|
97952
|
+
return afterClose;
|
|
97953
|
+
}
|
|
97954
|
+
// Line ending handling — follows the htmlFlow pattern
|
|
97955
|
+
function continuationStart(code) {
|
|
97956
|
+
return effects.check(syntax_nonLazyContinuationStart, continuationStartNonLazy, continuationAfter)(code);
|
|
97957
|
+
}
|
|
97958
|
+
function continuationStartNonLazy(code) {
|
|
97959
|
+
effects.enter(types_types.lineEnding);
|
|
97960
|
+
effects.consume(code);
|
|
97961
|
+
effects.exit(types_types.lineEnding);
|
|
97962
|
+
return continuationBefore;
|
|
97963
|
+
}
|
|
97964
|
+
function continuationBefore(code) {
|
|
97965
|
+
if (code === null || markdownLineEnding(code)) {
|
|
97966
|
+
return continuationStart(code);
|
|
97967
|
+
}
|
|
97968
|
+
effects.enter('jsxTableData');
|
|
97969
|
+
return body(code);
|
|
97970
|
+
}
|
|
97971
|
+
function continuationAfter(code) {
|
|
97972
|
+
// At EOF without </Table>, reject so content isn't swallowed
|
|
97973
|
+
if (code === null) {
|
|
97974
|
+
return nok(code);
|
|
97975
|
+
}
|
|
97976
|
+
effects.exit('jsxTable');
|
|
97977
|
+
return ok(code);
|
|
97978
|
+
}
|
|
97979
|
+
}
|
|
97980
|
+
function syntax_tokenizeNonLazyContinuationStart(effects, ok, nok) {
|
|
97981
|
+
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
97982
|
+
const self = this;
|
|
97983
|
+
return start;
|
|
97984
|
+
function start(code) {
|
|
97985
|
+
if (markdownLineEnding(code)) {
|
|
97986
|
+
effects.enter(types_types.lineEnding);
|
|
97987
|
+
effects.consume(code);
|
|
97988
|
+
effects.exit(types_types.lineEnding);
|
|
97989
|
+
return after;
|
|
97990
|
+
}
|
|
97991
|
+
return nok(code);
|
|
97992
|
+
}
|
|
97993
|
+
function after(code) {
|
|
97994
|
+
if (self.parser.lazy[self.now().line]) {
|
|
97995
|
+
return nok(code);
|
|
97996
|
+
}
|
|
97997
|
+
return ok(code);
|
|
97998
|
+
}
|
|
97999
|
+
}
|
|
98000
|
+
/**
|
|
98001
|
+
* Micromark extension that tokenizes `<Table>...</Table>` as a single flow block.
|
|
98002
|
+
*
|
|
98003
|
+
* Prevents CommonMark HTML block type 6 from matching `<Table>` (case-insensitive
|
|
98004
|
+
* match against `table`) and fragmenting it at blank lines.
|
|
98005
|
+
*/
|
|
98006
|
+
function jsxTable() {
|
|
98007
|
+
return {
|
|
98008
|
+
flow: {
|
|
98009
|
+
[codes.lessThan]: [jsxTableConstruct],
|
|
98010
|
+
},
|
|
98011
|
+
};
|
|
98012
|
+
}
|
|
98013
|
+
|
|
98014
|
+
;// ./lib/micromark/jsx-table/index.ts
|
|
98015
|
+
|
|
98016
|
+
|
|
97246
98017
|
;// ./lib/micromark/magic-block/syntax.ts
|
|
97247
98018
|
|
|
97248
98019
|
|
|
@@ -98171,6 +98942,8 @@ function loadComponents() {
|
|
|
98171
98942
|
|
|
98172
98943
|
|
|
98173
98944
|
|
|
98945
|
+
|
|
98946
|
+
|
|
98174
98947
|
|
|
98175
98948
|
|
|
98176
98949
|
|
|
@@ -98218,11 +98991,11 @@ function mdxishAstProcessor(mdContent, opts = {}) {
|
|
|
98218
98991
|
};
|
|
98219
98992
|
const processor = unified()
|
|
98220
98993
|
.data('micromarkExtensions', safeMode
|
|
98221
|
-
? [magicBlock(), legacyVariable(), looseHtmlEntity()]
|
|
98222
|
-
: [magicBlock(), mdxExprTextOnly, legacyVariable(), looseHtmlEntity()])
|
|
98994
|
+
? [jsxTable(), magicBlock(), legacyVariable(), looseHtmlEntity()]
|
|
98995
|
+
: [jsxTable(), magicBlock(), mdxExprTextOnly, legacyVariable(), looseHtmlEntity()])
|
|
98223
98996
|
.data('fromMarkdownExtensions', safeMode
|
|
98224
|
-
? [magicBlockFromMarkdown(), legacyVariableFromMarkdown(), emptyTaskListItemFromMarkdown(), looseHtmlEntityFromMarkdown()]
|
|
98225
|
-
: [magicBlockFromMarkdown(), mdxExpressionFromMarkdown(), legacyVariableFromMarkdown(), emptyTaskListItemFromMarkdown(), looseHtmlEntityFromMarkdown()])
|
|
98997
|
+
? [jsxTableFromMarkdown(), magicBlockFromMarkdown(), legacyVariableFromMarkdown(), emptyTaskListItemFromMarkdown(), looseHtmlEntityFromMarkdown()]
|
|
98998
|
+
: [jsxTableFromMarkdown(), magicBlockFromMarkdown(), mdxExpressionFromMarkdown(), legacyVariableFromMarkdown(), emptyTaskListItemFromMarkdown(), looseHtmlEntityFromMarkdown()])
|
|
98226
98999
|
.use(remarkParse)
|
|
98227
99000
|
.use(remarkFrontmatter)
|
|
98228
99001
|
.use(normalize_malformed_md_syntax)
|
|
@@ -98842,6 +99615,8 @@ function restoreMagicBlocks(replaced, blocks) {
|
|
|
98842
99615
|
|
|
98843
99616
|
|
|
98844
99617
|
|
|
99618
|
+
|
|
99619
|
+
|
|
98845
99620
|
/**
|
|
98846
99621
|
* Removes Markdown and MDX comments.
|
|
98847
99622
|
*/
|
|
@@ -98853,8 +99628,8 @@ async function stripComments(doc, { mdx, mdxish } = {}) {
|
|
|
98853
99628
|
// 2. we need to parse JSX comments into mdxTextExpression nodes so that the transformers can pick them up
|
|
98854
99629
|
if (mdxish) {
|
|
98855
99630
|
processor
|
|
98856
|
-
.data('micromarkExtensions', [mdxExpression({ allowEmpty: true })])
|
|
98857
|
-
.data('fromMarkdownExtensions', [mdxExpressionFromMarkdown()])
|
|
99631
|
+
.data('micromarkExtensions', [jsxTable(), mdxExpression({ allowEmpty: true })])
|
|
99632
|
+
.data('fromMarkdownExtensions', [jsxTableFromMarkdown(), mdxExpressionFromMarkdown()])
|
|
98858
99633
|
.data('toMarkdownExtensions', [mdxExpressionToMarkdown()]);
|
|
98859
99634
|
}
|
|
98860
99635
|
processor
|