@readme/markdown 7.12.1 → 7.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +1 -1
- package/dist/main.js +59 -58
- package/dist/main.node.js +59 -58
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -5,5 +5,5 @@ declare const utils: {
|
|
|
5
5
|
getHref: any;
|
|
6
6
|
calloutIcons: {};
|
|
7
7
|
};
|
|
8
|
-
export { compile, hast, run, mdast, mdastV6, mdx, migrate, plain, remarkPlugins, tags } from './lib';
|
|
8
|
+
export { compile, exports, hast, run, mdast, mdastV6, mdx, migrate, plain, remarkPlugins, tags } from './lib';
|
|
9
9
|
export { Components, utils };
|
package/dist/main.js
CHANGED
|
@@ -13318,6 +13318,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
13318
13318
|
__webpack_require__.d(__webpack_exports__, {
|
|
13319
13319
|
Components: () => (/* reexport */ components_namespaceObject),
|
|
13320
13320
|
compile: () => (/* reexport */ lib_compile),
|
|
13321
|
+
exports: () => (/* reexport */ lib_exports),
|
|
13321
13322
|
hast: () => (/* reexport */ lib_hast),
|
|
13322
13323
|
mdast: () => (/* reexport */ lib_mdast),
|
|
13323
13324
|
mdastV6: () => (/* reexport */ lib_mdastV6),
|
|
@@ -26117,7 +26118,7 @@ function toResult(value) {
|
|
|
26117
26118
|
* @template {Test} Check
|
|
26118
26119
|
* `unist-util-is`-compatible test.
|
|
26119
26120
|
*/
|
|
26120
|
-
function
|
|
26121
|
+
function visit(tree, testOrVisitor, visitorOrReverse, maybeReverse) {
|
|
26121
26122
|
/** @type {boolean | null | undefined} */
|
|
26122
26123
|
let reverse
|
|
26123
26124
|
/** @type {Test} */
|
|
@@ -26172,7 +26173,7 @@ function formatHeadingAsSetext(node, state) {
|
|
|
26172
26173
|
|
|
26173
26174
|
// Look for literals with a line break.
|
|
26174
26175
|
// Note that this also
|
|
26175
|
-
|
|
26176
|
+
visit(node, function (node) {
|
|
26176
26177
|
if (
|
|
26177
26178
|
('value' in node && /\r?\n|\r/.test(node.value)) ||
|
|
26178
26179
|
node.type === 'break'
|
|
@@ -39512,7 +39513,7 @@ const lib_SKIP = Symbol('skip')
|
|
|
39512
39513
|
* @returns {undefined}
|
|
39513
39514
|
* Nothing.
|
|
39514
39515
|
*/
|
|
39515
|
-
function
|
|
39516
|
+
function lib_visit(tree, visitor) {
|
|
39516
39517
|
/** @type {Visitor | undefined} */
|
|
39517
39518
|
let enter
|
|
39518
39519
|
/** @type {Visitor | undefined} */
|
|
@@ -39815,7 +39816,7 @@ function eventsToAcorn(events, options) {
|
|
|
39815
39816
|
estree.comments = comments;
|
|
39816
39817
|
|
|
39817
39818
|
// @ts-expect-error: acorn looks enough like estree.
|
|
39818
|
-
|
|
39819
|
+
lib_visit(estree, function (esnode, field, index, parents) {
|
|
39819
39820
|
let context = /** @type {AcornNode | Array<AcornNode>} */
|
|
39820
39821
|
parents[parents.length - 1];
|
|
39821
39822
|
/** @type {number | string | undefined} */
|
|
@@ -47941,7 +47942,7 @@ var NodeTypes;
|
|
|
47941
47942
|
const regex = `^(${emoji_regex().source}|⚠)(\\s+|$)`;
|
|
47942
47943
|
const calloutTransformer = () => {
|
|
47943
47944
|
return (tree) => {
|
|
47944
|
-
|
|
47945
|
+
visit(tree, 'blockquote', (node) => {
|
|
47945
47946
|
if (!(node.children[0].type === 'paragraph' && node.children[0].children[0].type === 'text'))
|
|
47946
47947
|
return;
|
|
47947
47948
|
const startText = node.children[0].children[0].value;
|
|
@@ -47971,13 +47972,13 @@ const calloutTransformer = () => {
|
|
|
47971
47972
|
|
|
47972
47973
|
const isCode = (node) => (node === null || node === void 0 ? void 0 : node.type) === 'code';
|
|
47973
47974
|
const codeTabsTransformer = ({ copyButtons } = {}) => (tree) => {
|
|
47974
|
-
|
|
47975
|
+
visit(tree, 'code', (node) => {
|
|
47975
47976
|
const { lang, meta, value } = node;
|
|
47976
47977
|
node.data = {
|
|
47977
47978
|
hProperties: { lang, meta, value, copyButtons },
|
|
47978
47979
|
};
|
|
47979
47980
|
});
|
|
47980
|
-
|
|
47981
|
+
visit(tree, 'code', (node, index, parent) => {
|
|
47981
47982
|
if (parent.type === 'code-tabs' || !('children' in parent))
|
|
47982
47983
|
return;
|
|
47983
47984
|
const length = parent.children.length;
|
|
@@ -48020,7 +48021,7 @@ const codeTabsTransformer = ({ copyButtons } = {}) => (tree) => {
|
|
|
48020
48021
|
|
|
48021
48022
|
const embedTransformer = () => {
|
|
48022
48023
|
return (tree) => {
|
|
48023
|
-
|
|
48024
|
+
visit(tree, 'paragraph', (node, i, parent) => {
|
|
48024
48025
|
var _a, _b, _c;
|
|
48025
48026
|
const [{ url, title, children = [] }] = node.children;
|
|
48026
48027
|
if (title !== '@embed')
|
|
@@ -48047,12 +48048,12 @@ const embedTransformer = () => {
|
|
|
48047
48048
|
|
|
48048
48049
|
;// ./lib/mdast.ts
|
|
48049
48050
|
|
|
48050
|
-
const
|
|
48051
|
+
const mdast = (text, opts = {}) => {
|
|
48051
48052
|
const processor = ast_processor(opts);
|
|
48052
48053
|
const tree = processor.parse(text);
|
|
48053
48054
|
return processor.runSync(tree);
|
|
48054
48055
|
};
|
|
48055
|
-
/* harmony default export */ const lib_mdast = (
|
|
48056
|
+
/* harmony default export */ const lib_mdast = (mdast);
|
|
48056
48057
|
|
|
48057
48058
|
;// ./processor/utils.ts
|
|
48058
48059
|
|
|
@@ -48155,7 +48156,7 @@ const isMDXElement = (node) => {
|
|
|
48155
48156
|
* @param {Node} node
|
|
48156
48157
|
* @returns {boolean}
|
|
48157
48158
|
*/
|
|
48158
|
-
const
|
|
48159
|
+
const isMDXEsm = (node) => {
|
|
48159
48160
|
return node.type === 'mdxjsEsm';
|
|
48160
48161
|
};
|
|
48161
48162
|
/**
|
|
@@ -48244,7 +48245,7 @@ const toAttributes = (object, keys = []) => {
|
|
|
48244
48245
|
|
|
48245
48246
|
|
|
48246
48247
|
const imageTransformer = () => (tree) => {
|
|
48247
|
-
|
|
48248
|
+
visit(tree, 'paragraph', (node, i, parent) => {
|
|
48248
48249
|
var _a;
|
|
48249
48250
|
// check if inline
|
|
48250
48251
|
if (parent.type !== 'root' || ((_a = node.children) === null || _a === void 0 ? void 0 : _a.length) > 1 || node.children[0].type !== 'image')
|
|
@@ -48268,7 +48269,7 @@ const imageTransformer = () => (tree) => {
|
|
|
48268
48269
|
parent.children.splice(i, 1, newNode);
|
|
48269
48270
|
});
|
|
48270
48271
|
const isImage = (node) => node.name === 'Image';
|
|
48271
|
-
|
|
48272
|
+
visit(tree, isImage, (node) => {
|
|
48272
48273
|
const attrs = getAttrs(node);
|
|
48273
48274
|
if (attrs.caption) {
|
|
48274
48275
|
node.children = lib_mdast(attrs.caption).children;
|
|
@@ -65268,17 +65269,17 @@ const gemojiTransformer = () => (tree) => {
|
|
|
65268
65269
|
const strongTest = (node) => ['emphasis', 'strong'].includes(node.type);
|
|
65269
65270
|
const compatibilityTransfomer = () => tree => {
|
|
65270
65271
|
const trimEmphasis = (node) => {
|
|
65271
|
-
|
|
65272
|
+
visit(node, 'text', child => {
|
|
65272
65273
|
child.value = child.value.trim();
|
|
65273
65274
|
return EXIT;
|
|
65274
65275
|
});
|
|
65275
65276
|
return node;
|
|
65276
65277
|
};
|
|
65277
|
-
|
|
65278
|
+
visit(tree, strongTest, node => {
|
|
65278
65279
|
trimEmphasis(node);
|
|
65279
65280
|
return SKIP;
|
|
65280
65281
|
});
|
|
65281
|
-
|
|
65282
|
+
visit(tree, 'image', (node, index, parent) => {
|
|
65282
65283
|
if (phrasing(parent) || !parent.children.every(child => child.type === 'image' || !phrasing(child)))
|
|
65283
65284
|
return;
|
|
65284
65285
|
parent.children.splice(index, 1, { type: 'paragraph', children: [node] });
|
|
@@ -65302,7 +65303,7 @@ var div_rest = (undefined && undefined.__rest) || function (s, e) {
|
|
|
65302
65303
|
|
|
65303
65304
|
|
|
65304
65305
|
const divTransformer = () => tree => {
|
|
65305
|
-
|
|
65306
|
+
visit(tree, 'div', (node, index, parent) => {
|
|
65306
65307
|
var _a;
|
|
65307
65308
|
const type = (_a = node.data) === null || _a === void 0 ? void 0 : _a.hName;
|
|
65308
65309
|
switch (type) {
|
|
@@ -65330,7 +65331,7 @@ const inject = ({ components } = {}) => (node, index, parent) => {
|
|
|
65330
65331
|
parent.children.splice(index, children.length, ...children);
|
|
65331
65332
|
};
|
|
65332
65333
|
const injectComponents = (opts) => () => tree => {
|
|
65333
|
-
|
|
65334
|
+
visit(tree, isMDXElement, inject(opts));
|
|
65334
65335
|
return tree;
|
|
65335
65336
|
};
|
|
65336
65337
|
/* harmony default export */ const inject_components = (injectComponents);
|
|
@@ -65350,7 +65351,7 @@ const setData = (node, index, parent) => {
|
|
|
65350
65351
|
} });
|
|
65351
65352
|
};
|
|
65352
65353
|
const mdxToHast = () => tree => {
|
|
65353
|
-
|
|
65354
|
+
visit(tree, isMDXElement, setData);
|
|
65354
65355
|
return tree;
|
|
65355
65356
|
};
|
|
65356
65357
|
/* harmony default export */ const mdx_to_hast = (mdxToHast);
|
|
@@ -65358,7 +65359,7 @@ const mdxToHast = () => tree => {
|
|
|
65358
65359
|
;// ./processor/transform/mermaid.ts
|
|
65359
65360
|
|
|
65360
65361
|
const mermaidTransformer = () => (tree) => {
|
|
65361
|
-
|
|
65362
|
+
visit(tree, 'element', (node) => {
|
|
65362
65363
|
if (node.tagName !== 'pre' || node.children.length !== 1)
|
|
65363
65364
|
return;
|
|
65364
65365
|
const [child] = node.children;
|
|
@@ -65447,9 +65448,9 @@ const coerceJsxToMd = ({ components = {}, html = false } = {}) => (node, index,
|
|
|
65447
65448
|
const { position } = node;
|
|
65448
65449
|
const { align = [...new Array(node.children.length)].map(() => null) } = getAttrs(node);
|
|
65449
65450
|
let children = [];
|
|
65450
|
-
|
|
65451
|
+
visit(node, { name: 'tr' }, row => {
|
|
65451
65452
|
let rowChildren = [];
|
|
65452
|
-
|
|
65453
|
+
visit(row, isTableCell, ({ name, children, position }) => {
|
|
65453
65454
|
rowChildren.push({
|
|
65454
65455
|
type: tableTypes[name],
|
|
65455
65456
|
children,
|
|
@@ -65468,7 +65469,7 @@ const coerceJsxToMd = ({ components = {}, html = false } = {}) => (node, index,
|
|
|
65468
65469
|
position,
|
|
65469
65470
|
children,
|
|
65470
65471
|
};
|
|
65471
|
-
|
|
65472
|
+
visit(mdNode, isMDXElement, coerceJsxToMd({ components, html }));
|
|
65472
65473
|
parent.children[index] = mdNode;
|
|
65473
65474
|
return SKIP;
|
|
65474
65475
|
}
|
|
@@ -65511,8 +65512,8 @@ const coerceJsxToMd = ({ components = {}, html = false } = {}) => (node, index,
|
|
|
65511
65512
|
}
|
|
65512
65513
|
};
|
|
65513
65514
|
const readmeComponents = (opts) => () => tree => {
|
|
65514
|
-
|
|
65515
|
-
|
|
65515
|
+
visit(tree, isMDXElement, coerceJsxToMd(opts));
|
|
65516
|
+
visit(tree, 'paragraph', (node, index, parent) => {
|
|
65516
65517
|
// @ts-ignore
|
|
65517
65518
|
if (parent.type !== 'tableRow')
|
|
65518
65519
|
return;
|
|
@@ -65530,11 +65531,11 @@ const readmeComponents = (opts) => () => tree => {
|
|
|
65530
65531
|
const imageAttrs = ['align', 'alt', 'caption', 'border', 'height', 'src', 'title', 'width', 'lazy', 'className'];
|
|
65531
65532
|
const readmeToMdx = () => tree => {
|
|
65532
65533
|
// Unwrap pinned nodes, replace rdme-pin with its child node
|
|
65533
|
-
|
|
65534
|
+
visit(tree, 'rdme-pin', (node, i, parent) => {
|
|
65534
65535
|
const newNode = node.children[0];
|
|
65535
65536
|
parent.children.splice(i, 1, newNode);
|
|
65536
65537
|
});
|
|
65537
|
-
|
|
65538
|
+
visit(tree, NodeTypes.tutorialTile, (tile, index, parent) => {
|
|
65538
65539
|
parent.children.splice(index, 1, {
|
|
65539
65540
|
type: 'mdxJsxFlowElement',
|
|
65540
65541
|
name: 'TutorialTile',
|
|
@@ -65542,7 +65543,7 @@ const readmeToMdx = () => tree => {
|
|
|
65542
65543
|
children: [],
|
|
65543
65544
|
});
|
|
65544
65545
|
});
|
|
65545
|
-
|
|
65546
|
+
visit(tree, 'figure', (figure, index, parent) => {
|
|
65546
65547
|
const [image, caption] = figure.children;
|
|
65547
65548
|
const { align, width } = image.data.hProperties;
|
|
65548
65549
|
const border = image.data.hProperties.className === 'border';
|
|
@@ -65554,7 +65555,7 @@ const readmeToMdx = () => tree => {
|
|
|
65554
65555
|
});
|
|
65555
65556
|
});
|
|
65556
65557
|
const hasExtra = (attributes) => !!attributes.find(attr => !['alt', 'src', 'title'].includes(attr.name));
|
|
65557
|
-
|
|
65558
|
+
visit(tree, 'image', (image, index, parent) => {
|
|
65558
65559
|
if (!('data' in image))
|
|
65559
65560
|
return;
|
|
65560
65561
|
if ('url' in image)
|
|
@@ -65576,7 +65577,7 @@ const readmeToMdx = () => tree => {
|
|
|
65576
65577
|
});
|
|
65577
65578
|
}
|
|
65578
65579
|
});
|
|
65579
|
-
|
|
65580
|
+
visit(tree, NodeTypes.imageBlock, (image, index, parent) => {
|
|
65580
65581
|
const attributes = toAttributes(image.data.hProperties, imageAttrs);
|
|
65581
65582
|
if (hasExtra(attributes)) {
|
|
65582
65583
|
parent.children.splice(index, 1, {
|
|
@@ -65590,7 +65591,7 @@ const readmeToMdx = () => tree => {
|
|
|
65590
65591
|
parent.children.splice(index, 1, Object.assign(Object.assign(Object.assign({ type: 'image', children: [] }, (image.src && { url: image.src })), (image.title && { title: image.title })), (image.alt && { alt: image.alt })));
|
|
65591
65592
|
}
|
|
65592
65593
|
});
|
|
65593
|
-
|
|
65594
|
+
visit(tree, 'html', (node, index, parent) => {
|
|
65594
65595
|
const html = node.value;
|
|
65595
65596
|
const isScriptOrStyleTag = [!!html.match(/^<(?:style|script)/i), !!html.match(/<\/(?:style|script)>$/i)];
|
|
65596
65597
|
if (!isScriptOrStyleTag.includes(true))
|
|
@@ -65633,21 +65634,21 @@ const visitor = (table, index, parent) => {
|
|
|
65633
65634
|
: cell.children[0];
|
|
65634
65635
|
// @note: Compatibility with RDMD. Ideally, I'd put this in a separate
|
|
65635
65636
|
// transformer, but then there'd be some duplication.
|
|
65636
|
-
|
|
65637
|
+
visit(cell, 'break', (_, index, parent) => {
|
|
65637
65638
|
parent.children.splice(index, 1, { type: 'text', value: '\n' });
|
|
65638
65639
|
});
|
|
65639
65640
|
if (!phrasing(content) && content.type !== 'escape') {
|
|
65640
65641
|
hasFlowContent = true;
|
|
65641
65642
|
return EXIT;
|
|
65642
65643
|
}
|
|
65643
|
-
|
|
65644
|
+
visit(cell, isLiteral, (node) => {
|
|
65644
65645
|
if (node.value.match(/\n/)) {
|
|
65645
65646
|
hasFlowContent = true;
|
|
65646
65647
|
return EXIT;
|
|
65647
65648
|
}
|
|
65648
65649
|
});
|
|
65649
65650
|
};
|
|
65650
|
-
|
|
65651
|
+
visit(table, tables_to_jsx_isTableCell, tableCellVisitor);
|
|
65651
65652
|
if (!hasFlowContent) {
|
|
65652
65653
|
table.type = 'table';
|
|
65653
65654
|
return;
|
|
@@ -65695,7 +65696,7 @@ const visitor = (table, index, parent) => {
|
|
|
65695
65696
|
};
|
|
65696
65697
|
const isTable = (node) => ['table', 'tableau'].includes(node.type);
|
|
65697
65698
|
const tablesToJsx = () => tree => {
|
|
65698
|
-
|
|
65699
|
+
visit(tree, isTable, visitor);
|
|
65699
65700
|
return tree;
|
|
65700
65701
|
};
|
|
65701
65702
|
/* harmony default export */ const tables_to_jsx = (tablesToJsx);
|
|
@@ -65704,7 +65705,7 @@ const tablesToJsx = () => tree => {
|
|
|
65704
65705
|
|
|
65705
65706
|
|
|
65706
65707
|
const variables = ({ asMdx } = { asMdx: true }) => tree => {
|
|
65707
|
-
|
|
65708
|
+
visit(tree, (node, index, parent) => {
|
|
65708
65709
|
var _a, _b;
|
|
65709
65710
|
if (!['mdxFlowExpression', 'mdxTextExpression'].includes(node.type) || !('value' in node))
|
|
65710
65711
|
return;
|
|
@@ -65984,7 +65985,7 @@ function rehypeSlug(options) {
|
|
|
65984
65985
|
return function (tree) {
|
|
65985
65986
|
slugs.reset()
|
|
65986
65987
|
|
|
65987
|
-
|
|
65988
|
+
visit(tree, 'element', function (node) {
|
|
65988
65989
|
if (headingRank(node) && !node.properties.id) {
|
|
65989
65990
|
node.properties.id = prefix + slugs.slug(hast_util_to_string_lib_toString(node))
|
|
65990
65991
|
}
|
|
@@ -74107,7 +74108,7 @@ function state_createState(tree, options) {
|
|
|
74107
74108
|
wrap: state_wrap
|
|
74108
74109
|
}
|
|
74109
74110
|
|
|
74110
|
-
|
|
74111
|
+
visit(tree, function (node) {
|
|
74111
74112
|
if (node.type === 'definition' || node.type === 'footnoteDefinition') {
|
|
74112
74113
|
const map = node.type === 'definition' ? definitionById : footnoteById
|
|
74113
74114
|
const id = String(node.identifier).toUpperCase()
|
|
@@ -76768,7 +76769,7 @@ function rehypeRemoveRaw() {
|
|
|
76768
76769
|
* Nothing.
|
|
76769
76770
|
*/
|
|
76770
76771
|
return function (tree) {
|
|
76771
|
-
|
|
76772
|
+
visit(tree, 'raw', function (_, index, parent) {
|
|
76772
76773
|
if (parent && typeof index === 'number') {
|
|
76773
76774
|
parent.children.splice(index, 1)
|
|
76774
76775
|
return index
|
|
@@ -76892,7 +76893,7 @@ function remarkMarkAndUnravel() {
|
|
|
76892
76893
|
* Nothing.
|
|
76893
76894
|
*/
|
|
76894
76895
|
return function (tree) {
|
|
76895
|
-
|
|
76896
|
+
visit(tree, function (node, index, parent) {
|
|
76896
76897
|
let offset = -1
|
|
76897
76898
|
let all = true
|
|
76898
76899
|
let oneOrMore = false
|
|
@@ -78511,7 +78512,7 @@ const tocToHast = (headings = []) => {
|
|
|
78511
78512
|
};
|
|
78512
78513
|
const tocToMdx = (toc, components) => {
|
|
78513
78514
|
const tree = { type: 'root', children: toc };
|
|
78514
|
-
|
|
78515
|
+
visit(tree, 'mdxJsxFlowElement', (node, index, parent) => {
|
|
78515
78516
|
const toc = components[node.name].toc || [];
|
|
78516
78517
|
parent.children.splice(index, 1, ...toc);
|
|
78517
78518
|
});
|
|
@@ -78585,7 +78586,7 @@ const compile_compile = (text, _a = {}) => {
|
|
|
78585
78586
|
const EXPORT_NAME_REGEX = /export\s+(?:const|let|var|function)\s+(\w+)/;
|
|
78586
78587
|
const exports_exports = (doc) => {
|
|
78587
78588
|
const set = new Set();
|
|
78588
|
-
visit(
|
|
78589
|
+
visit(lib_mdast(doc), isMDXEsm, (node) => {
|
|
78589
78590
|
var _a;
|
|
78590
78591
|
if ((_a = node.value) === null || _a === void 0 ? void 0 : _a.match(EXPORT_NAME_REGEX)) {
|
|
78591
78592
|
const [, name] = node.value.match(EXPORT_NAME_REGEX);
|
|
@@ -78594,7 +78595,7 @@ const exports_exports = (doc) => {
|
|
|
78594
78595
|
});
|
|
78595
78596
|
return Array.from(set);
|
|
78596
78597
|
};
|
|
78597
|
-
/* harmony default export */ const lib_exports = (
|
|
78598
|
+
/* harmony default export */ const lib_exports = (exports_exports);
|
|
78598
78599
|
|
|
78599
78600
|
;// ./lib/hast.ts
|
|
78600
78601
|
|
|
@@ -78637,7 +78638,7 @@ const addSpaceAfter = (index, parent) => {
|
|
|
78637
78638
|
};
|
|
78638
78639
|
const trimEmphasis = (node, index, parent) => {
|
|
78639
78640
|
let trimmed = false;
|
|
78640
|
-
|
|
78641
|
+
visit(node, 'text', (child) => {
|
|
78641
78642
|
const newValue = child.value.trimStart();
|
|
78642
78643
|
if (newValue !== child.value) {
|
|
78643
78644
|
trimmed = true;
|
|
@@ -78645,7 +78646,7 @@ const trimEmphasis = (node, index, parent) => {
|
|
|
78645
78646
|
}
|
|
78646
78647
|
return EXIT;
|
|
78647
78648
|
});
|
|
78648
|
-
|
|
78649
|
+
visit(node, 'text', (child) => {
|
|
78649
78650
|
const newValue = child.value.trimEnd();
|
|
78650
78651
|
if (newValue !== child.value) {
|
|
78651
78652
|
trimmed = true;
|
|
@@ -78659,7 +78660,7 @@ const trimEmphasis = (node, index, parent) => {
|
|
|
78659
78660
|
}
|
|
78660
78661
|
};
|
|
78661
78662
|
const emphasisTransfomer = () => (tree) => {
|
|
78662
|
-
|
|
78663
|
+
visit(tree, emphasis_strongTest, trimEmphasis);
|
|
78663
78664
|
return tree;
|
|
78664
78665
|
};
|
|
78665
78666
|
/* harmony default export */ const migration_emphasis = (emphasisTransfomer);
|
|
@@ -78667,7 +78668,7 @@ const emphasisTransfomer = () => (tree) => {
|
|
|
78667
78668
|
;// ./processor/migration/images.ts
|
|
78668
78669
|
|
|
78669
78670
|
const images_imageTransformer = () => tree => {
|
|
78670
|
-
|
|
78671
|
+
visit(tree, 'image', (image) => {
|
|
78671
78672
|
var _a, _b;
|
|
78672
78673
|
if (((_b = (_a = image.data) === null || _a === void 0 ? void 0 : _a.hProperties) === null || _b === void 0 ? void 0 : _b.className) === 'border') {
|
|
78673
78674
|
image.data.hProperties.border = true;
|
|
@@ -78679,9 +78680,9 @@ const images_imageTransformer = () => tree => {
|
|
|
78679
78680
|
;// ./processor/migration/linkReference.ts
|
|
78680
78681
|
|
|
78681
78682
|
const linkReferenceTransformer = () => (tree) => {
|
|
78682
|
-
|
|
78683
|
+
visit(tree, 'linkReference', (node, index, parent) => {
|
|
78683
78684
|
const definitions = {};
|
|
78684
|
-
|
|
78685
|
+
visit(tree, 'definition', (def) => {
|
|
78685
78686
|
definitions[def.identifier] = def;
|
|
78686
78687
|
});
|
|
78687
78688
|
if (node.label === node.identifier && parent) {
|
|
@@ -78744,8 +78745,8 @@ const migrateTableCells = (vfile, rdmd) => (table) => {
|
|
|
78744
78745
|
*/
|
|
78745
78746
|
// console.error(err);
|
|
78746
78747
|
}
|
|
78747
|
-
|
|
78748
|
-
|
|
78748
|
+
visit(table, 'tableRow', (row, i) => {
|
|
78749
|
+
visit(row, 'tableCell', (cell, j) => {
|
|
78749
78750
|
let children = cell.children;
|
|
78750
78751
|
if (json && json.data[magicIndex(i, j)]) {
|
|
78751
78752
|
const string = json.data[magicIndex(i, j)].replace(psuedoListRegex, '$<ws>- $<item>');
|
|
@@ -78759,7 +78760,7 @@ const migrateTableCells = (vfile, rdmd) => (table) => {
|
|
|
78759
78760
|
});
|
|
78760
78761
|
return SKIP;
|
|
78761
78762
|
});
|
|
78762
|
-
|
|
78763
|
+
visit(table, 'inlineCode', (code) => {
|
|
78763
78764
|
if (code.value.includes('\n')) {
|
|
78764
78765
|
// eslint-disable-next-line no-param-reassign
|
|
78765
78766
|
code.type = 'code';
|
|
@@ -78769,7 +78770,7 @@ const migrateTableCells = (vfile, rdmd) => (table) => {
|
|
|
78769
78770
|
function tableCellTransformer() {
|
|
78770
78771
|
const rdmd = this.data('rdmd');
|
|
78771
78772
|
return (tree, vfile) => {
|
|
78772
|
-
|
|
78773
|
+
visit(tree, 'table', migrateTableCells(vfile, rdmd));
|
|
78773
78774
|
return tree;
|
|
78774
78775
|
};
|
|
78775
78776
|
}
|
|
@@ -81864,7 +81865,7 @@ function media(state, node) {
|
|
|
81864
81865
|
/** @type {Root} */
|
|
81865
81866
|
const fragment = {type: 'root', children: nodes}
|
|
81866
81867
|
|
|
81867
|
-
|
|
81868
|
+
visit(fragment, function (node) {
|
|
81868
81869
|
if (node.type === 'link') {
|
|
81869
81870
|
linkInFallbackContent = true
|
|
81870
81871
|
return EXIT
|
|
@@ -82335,7 +82336,7 @@ function inspect(node) {
|
|
|
82335
82336
|
let rowIndex = 0
|
|
82336
82337
|
let cellIndex = 0
|
|
82337
82338
|
|
|
82338
|
-
|
|
82339
|
+
visit(node, function (child) {
|
|
82339
82340
|
if (child.type === 'element') {
|
|
82340
82341
|
// Don’t enter nested tables.
|
|
82341
82342
|
if (child.tagName === 'table' && node !== child) {
|
|
@@ -83157,7 +83158,7 @@ function toMdast(tree, options) {
|
|
|
83157
83158
|
// @ts-expect-error: fine to pass an arbitrary node.
|
|
83158
83159
|
transformWhitespace(cleanTree)
|
|
83159
83160
|
|
|
83160
|
-
|
|
83161
|
+
visit(cleanTree, function (node) {
|
|
83161
83162
|
if (node && node.type === 'element' && node.properties) {
|
|
83162
83163
|
const id = String(node.properties.id || '') || undefined
|
|
83163
83164
|
|
|
@@ -83185,7 +83186,7 @@ function toMdast(tree, options) {
|
|
|
83185
83186
|
// we’re generating some whitespace too, and some nodes are in the end
|
|
83186
83187
|
// ignored.
|
|
83187
83188
|
// So clean up.
|
|
83188
|
-
|
|
83189
|
+
visit(mdast, function (node, index, parent) {
|
|
83189
83190
|
if (node.type === 'text' && index !== undefined && parent) {
|
|
83190
83191
|
const previous = parent.children[index - 1]
|
|
83191
83192
|
|
|
@@ -83744,7 +83745,7 @@ const run_run = async (string, _opts = {}) => {
|
|
|
83744
83745
|
|
|
83745
83746
|
const tags = (doc) => {
|
|
83746
83747
|
const set = new Set();
|
|
83747
|
-
|
|
83748
|
+
visit(lib_mdast(doc), isMDXElement, (node) => {
|
|
83748
83749
|
var _a;
|
|
83749
83750
|
if ((_a = node.name) === null || _a === void 0 ? void 0 : _a.match(/^[A-Z]/)) {
|
|
83750
83751
|
set.add(node.name);
|
package/dist/main.node.js
CHANGED
|
@@ -7957,6 +7957,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
7957
7957
|
__webpack_require__.d(__webpack_exports__, {
|
|
7958
7958
|
Components: () => (/* reexport */ components_namespaceObject),
|
|
7959
7959
|
compile: () => (/* reexport */ lib_compile),
|
|
7960
|
+
exports: () => (/* reexport */ lib_exports),
|
|
7960
7961
|
hast: () => (/* reexport */ lib_hast),
|
|
7961
7962
|
mdast: () => (/* reexport */ lib_mdast),
|
|
7962
7963
|
mdastV6: () => (/* reexport */ lib_mdastV6),
|
|
@@ -27700,7 +27701,7 @@ function toResult(value) {
|
|
|
27700
27701
|
* @template {Test} Check
|
|
27701
27702
|
* `unist-util-is`-compatible test.
|
|
27702
27703
|
*/
|
|
27703
|
-
function
|
|
27704
|
+
function visit(tree, testOrVisitor, visitorOrReverse, maybeReverse) {
|
|
27704
27705
|
/** @type {boolean | null | undefined} */
|
|
27705
27706
|
let reverse
|
|
27706
27707
|
/** @type {Test} */
|
|
@@ -27755,7 +27756,7 @@ function formatHeadingAsSetext(node, state) {
|
|
|
27755
27756
|
|
|
27756
27757
|
// Look for literals with a line break.
|
|
27757
27758
|
// Note that this also
|
|
27758
|
-
|
|
27759
|
+
visit(node, function (node) {
|
|
27759
27760
|
if (
|
|
27760
27761
|
('value' in node && /\r?\n|\r/.test(node.value)) ||
|
|
27761
27762
|
node.type === 'break'
|
|
@@ -40591,7 +40592,7 @@ const lib_SKIP = Symbol('skip')
|
|
|
40591
40592
|
* @returns {undefined}
|
|
40592
40593
|
* Nothing.
|
|
40593
40594
|
*/
|
|
40594
|
-
function
|
|
40595
|
+
function lib_visit(tree, visitor) {
|
|
40595
40596
|
/** @type {Visitor | undefined} */
|
|
40596
40597
|
let enter
|
|
40597
40598
|
/** @type {Visitor | undefined} */
|
|
@@ -40894,7 +40895,7 @@ function eventsToAcorn(events, options) {
|
|
|
40894
40895
|
estree.comments = comments;
|
|
40895
40896
|
|
|
40896
40897
|
// @ts-expect-error: acorn looks enough like estree.
|
|
40897
|
-
|
|
40898
|
+
lib_visit(estree, function (esnode, field, index, parents) {
|
|
40898
40899
|
let context = /** @type {AcornNode | Array<AcornNode>} */
|
|
40899
40900
|
parents[parents.length - 1];
|
|
40900
40901
|
/** @type {number | string | undefined} */
|
|
@@ -49020,7 +49021,7 @@ var NodeTypes;
|
|
|
49020
49021
|
const regex = `^(${emoji_regex().source}|⚠)(\\s+|$)`;
|
|
49021
49022
|
const calloutTransformer = () => {
|
|
49022
49023
|
return (tree) => {
|
|
49023
|
-
|
|
49024
|
+
visit(tree, 'blockquote', (node) => {
|
|
49024
49025
|
if (!(node.children[0].type === 'paragraph' && node.children[0].children[0].type === 'text'))
|
|
49025
49026
|
return;
|
|
49026
49027
|
const startText = node.children[0].children[0].value;
|
|
@@ -49050,13 +49051,13 @@ const calloutTransformer = () => {
|
|
|
49050
49051
|
|
|
49051
49052
|
const isCode = (node) => (node === null || node === void 0 ? void 0 : node.type) === 'code';
|
|
49052
49053
|
const codeTabsTransformer = ({ copyButtons } = {}) => (tree) => {
|
|
49053
|
-
|
|
49054
|
+
visit(tree, 'code', (node) => {
|
|
49054
49055
|
const { lang, meta, value } = node;
|
|
49055
49056
|
node.data = {
|
|
49056
49057
|
hProperties: { lang, meta, value, copyButtons },
|
|
49057
49058
|
};
|
|
49058
49059
|
});
|
|
49059
|
-
|
|
49060
|
+
visit(tree, 'code', (node, index, parent) => {
|
|
49060
49061
|
if (parent.type === 'code-tabs' || !('children' in parent))
|
|
49061
49062
|
return;
|
|
49062
49063
|
const length = parent.children.length;
|
|
@@ -49099,7 +49100,7 @@ const codeTabsTransformer = ({ copyButtons } = {}) => (tree) => {
|
|
|
49099
49100
|
|
|
49100
49101
|
const embedTransformer = () => {
|
|
49101
49102
|
return (tree) => {
|
|
49102
|
-
|
|
49103
|
+
visit(tree, 'paragraph', (node, i, parent) => {
|
|
49103
49104
|
var _a, _b, _c;
|
|
49104
49105
|
const [{ url, title, children = [] }] = node.children;
|
|
49105
49106
|
if (title !== '@embed')
|
|
@@ -49126,12 +49127,12 @@ const embedTransformer = () => {
|
|
|
49126
49127
|
|
|
49127
49128
|
;// ./lib/mdast.ts
|
|
49128
49129
|
|
|
49129
|
-
const
|
|
49130
|
+
const mdast = (text, opts = {}) => {
|
|
49130
49131
|
const processor = ast_processor(opts);
|
|
49131
49132
|
const tree = processor.parse(text);
|
|
49132
49133
|
return processor.runSync(tree);
|
|
49133
49134
|
};
|
|
49134
|
-
/* harmony default export */ const lib_mdast = (
|
|
49135
|
+
/* harmony default export */ const lib_mdast = (mdast);
|
|
49135
49136
|
|
|
49136
49137
|
;// ./processor/utils.ts
|
|
49137
49138
|
|
|
@@ -49234,7 +49235,7 @@ const isMDXElement = (node) => {
|
|
|
49234
49235
|
* @param {Node} node
|
|
49235
49236
|
* @returns {boolean}
|
|
49236
49237
|
*/
|
|
49237
|
-
const
|
|
49238
|
+
const isMDXEsm = (node) => {
|
|
49238
49239
|
return node.type === 'mdxjsEsm';
|
|
49239
49240
|
};
|
|
49240
49241
|
/**
|
|
@@ -49323,7 +49324,7 @@ const toAttributes = (object, keys = []) => {
|
|
|
49323
49324
|
|
|
49324
49325
|
|
|
49325
49326
|
const imageTransformer = () => (tree) => {
|
|
49326
|
-
|
|
49327
|
+
visit(tree, 'paragraph', (node, i, parent) => {
|
|
49327
49328
|
var _a;
|
|
49328
49329
|
// check if inline
|
|
49329
49330
|
if (parent.type !== 'root' || ((_a = node.children) === null || _a === void 0 ? void 0 : _a.length) > 1 || node.children[0].type !== 'image')
|
|
@@ -49347,7 +49348,7 @@ const imageTransformer = () => (tree) => {
|
|
|
49347
49348
|
parent.children.splice(i, 1, newNode);
|
|
49348
49349
|
});
|
|
49349
49350
|
const isImage = (node) => node.name === 'Image';
|
|
49350
|
-
|
|
49351
|
+
visit(tree, isImage, (node) => {
|
|
49351
49352
|
const attrs = getAttrs(node);
|
|
49352
49353
|
if (attrs.caption) {
|
|
49353
49354
|
node.children = lib_mdast(attrs.caption).children;
|
|
@@ -66347,17 +66348,17 @@ const gemojiTransformer = () => (tree) => {
|
|
|
66347
66348
|
const strongTest = (node) => ['emphasis', 'strong'].includes(node.type);
|
|
66348
66349
|
const compatibilityTransfomer = () => tree => {
|
|
66349
66350
|
const trimEmphasis = (node) => {
|
|
66350
|
-
|
|
66351
|
+
visit(node, 'text', child => {
|
|
66351
66352
|
child.value = child.value.trim();
|
|
66352
66353
|
return EXIT;
|
|
66353
66354
|
});
|
|
66354
66355
|
return node;
|
|
66355
66356
|
};
|
|
66356
|
-
|
|
66357
|
+
visit(tree, strongTest, node => {
|
|
66357
66358
|
trimEmphasis(node);
|
|
66358
66359
|
return SKIP;
|
|
66359
66360
|
});
|
|
66360
|
-
|
|
66361
|
+
visit(tree, 'image', (node, index, parent) => {
|
|
66361
66362
|
if (phrasing(parent) || !parent.children.every(child => child.type === 'image' || !phrasing(child)))
|
|
66362
66363
|
return;
|
|
66363
66364
|
parent.children.splice(index, 1, { type: 'paragraph', children: [node] });
|
|
@@ -66381,7 +66382,7 @@ var div_rest = (undefined && undefined.__rest) || function (s, e) {
|
|
|
66381
66382
|
|
|
66382
66383
|
|
|
66383
66384
|
const divTransformer = () => tree => {
|
|
66384
|
-
|
|
66385
|
+
visit(tree, 'div', (node, index, parent) => {
|
|
66385
66386
|
var _a;
|
|
66386
66387
|
const type = (_a = node.data) === null || _a === void 0 ? void 0 : _a.hName;
|
|
66387
66388
|
switch (type) {
|
|
@@ -66409,7 +66410,7 @@ const inject = ({ components } = {}) => (node, index, parent) => {
|
|
|
66409
66410
|
parent.children.splice(index, children.length, ...children);
|
|
66410
66411
|
};
|
|
66411
66412
|
const injectComponents = (opts) => () => tree => {
|
|
66412
|
-
|
|
66413
|
+
visit(tree, isMDXElement, inject(opts));
|
|
66413
66414
|
return tree;
|
|
66414
66415
|
};
|
|
66415
66416
|
/* harmony default export */ const inject_components = (injectComponents);
|
|
@@ -66429,7 +66430,7 @@ const setData = (node, index, parent) => {
|
|
|
66429
66430
|
} });
|
|
66430
66431
|
};
|
|
66431
66432
|
const mdxToHast = () => tree => {
|
|
66432
|
-
|
|
66433
|
+
visit(tree, isMDXElement, setData);
|
|
66433
66434
|
return tree;
|
|
66434
66435
|
};
|
|
66435
66436
|
/* harmony default export */ const mdx_to_hast = (mdxToHast);
|
|
@@ -66437,7 +66438,7 @@ const mdxToHast = () => tree => {
|
|
|
66437
66438
|
;// ./processor/transform/mermaid.ts
|
|
66438
66439
|
|
|
66439
66440
|
const mermaidTransformer = () => (tree) => {
|
|
66440
|
-
|
|
66441
|
+
visit(tree, 'element', (node) => {
|
|
66441
66442
|
if (node.tagName !== 'pre' || node.children.length !== 1)
|
|
66442
66443
|
return;
|
|
66443
66444
|
const [child] = node.children;
|
|
@@ -66526,9 +66527,9 @@ const coerceJsxToMd = ({ components = {}, html = false } = {}) => (node, index,
|
|
|
66526
66527
|
const { position } = node;
|
|
66527
66528
|
const { align = [...new Array(node.children.length)].map(() => null) } = getAttrs(node);
|
|
66528
66529
|
let children = [];
|
|
66529
|
-
|
|
66530
|
+
visit(node, { name: 'tr' }, row => {
|
|
66530
66531
|
let rowChildren = [];
|
|
66531
|
-
|
|
66532
|
+
visit(row, isTableCell, ({ name, children, position }) => {
|
|
66532
66533
|
rowChildren.push({
|
|
66533
66534
|
type: tableTypes[name],
|
|
66534
66535
|
children,
|
|
@@ -66547,7 +66548,7 @@ const coerceJsxToMd = ({ components = {}, html = false } = {}) => (node, index,
|
|
|
66547
66548
|
position,
|
|
66548
66549
|
children,
|
|
66549
66550
|
};
|
|
66550
|
-
|
|
66551
|
+
visit(mdNode, isMDXElement, coerceJsxToMd({ components, html }));
|
|
66551
66552
|
parent.children[index] = mdNode;
|
|
66552
66553
|
return SKIP;
|
|
66553
66554
|
}
|
|
@@ -66590,8 +66591,8 @@ const coerceJsxToMd = ({ components = {}, html = false } = {}) => (node, index,
|
|
|
66590
66591
|
}
|
|
66591
66592
|
};
|
|
66592
66593
|
const readmeComponents = (opts) => () => tree => {
|
|
66593
|
-
|
|
66594
|
-
|
|
66594
|
+
visit(tree, isMDXElement, coerceJsxToMd(opts));
|
|
66595
|
+
visit(tree, 'paragraph', (node, index, parent) => {
|
|
66595
66596
|
// @ts-ignore
|
|
66596
66597
|
if (parent.type !== 'tableRow')
|
|
66597
66598
|
return;
|
|
@@ -66609,11 +66610,11 @@ const readmeComponents = (opts) => () => tree => {
|
|
|
66609
66610
|
const imageAttrs = ['align', 'alt', 'caption', 'border', 'height', 'src', 'title', 'width', 'lazy', 'className'];
|
|
66610
66611
|
const readmeToMdx = () => tree => {
|
|
66611
66612
|
// Unwrap pinned nodes, replace rdme-pin with its child node
|
|
66612
|
-
|
|
66613
|
+
visit(tree, 'rdme-pin', (node, i, parent) => {
|
|
66613
66614
|
const newNode = node.children[0];
|
|
66614
66615
|
parent.children.splice(i, 1, newNode);
|
|
66615
66616
|
});
|
|
66616
|
-
|
|
66617
|
+
visit(tree, NodeTypes.tutorialTile, (tile, index, parent) => {
|
|
66617
66618
|
parent.children.splice(index, 1, {
|
|
66618
66619
|
type: 'mdxJsxFlowElement',
|
|
66619
66620
|
name: 'TutorialTile',
|
|
@@ -66621,7 +66622,7 @@ const readmeToMdx = () => tree => {
|
|
|
66621
66622
|
children: [],
|
|
66622
66623
|
});
|
|
66623
66624
|
});
|
|
66624
|
-
|
|
66625
|
+
visit(tree, 'figure', (figure, index, parent) => {
|
|
66625
66626
|
const [image, caption] = figure.children;
|
|
66626
66627
|
const { align, width } = image.data.hProperties;
|
|
66627
66628
|
const border = image.data.hProperties.className === 'border';
|
|
@@ -66633,7 +66634,7 @@ const readmeToMdx = () => tree => {
|
|
|
66633
66634
|
});
|
|
66634
66635
|
});
|
|
66635
66636
|
const hasExtra = (attributes) => !!attributes.find(attr => !['alt', 'src', 'title'].includes(attr.name));
|
|
66636
|
-
|
|
66637
|
+
visit(tree, 'image', (image, index, parent) => {
|
|
66637
66638
|
if (!('data' in image))
|
|
66638
66639
|
return;
|
|
66639
66640
|
if ('url' in image)
|
|
@@ -66655,7 +66656,7 @@ const readmeToMdx = () => tree => {
|
|
|
66655
66656
|
});
|
|
66656
66657
|
}
|
|
66657
66658
|
});
|
|
66658
|
-
|
|
66659
|
+
visit(tree, NodeTypes.imageBlock, (image, index, parent) => {
|
|
66659
66660
|
const attributes = toAttributes(image.data.hProperties, imageAttrs);
|
|
66660
66661
|
if (hasExtra(attributes)) {
|
|
66661
66662
|
parent.children.splice(index, 1, {
|
|
@@ -66669,7 +66670,7 @@ const readmeToMdx = () => tree => {
|
|
|
66669
66670
|
parent.children.splice(index, 1, Object.assign(Object.assign(Object.assign({ type: 'image', children: [] }, (image.src && { url: image.src })), (image.title && { title: image.title })), (image.alt && { alt: image.alt })));
|
|
66670
66671
|
}
|
|
66671
66672
|
});
|
|
66672
|
-
|
|
66673
|
+
visit(tree, 'html', (node, index, parent) => {
|
|
66673
66674
|
const html = node.value;
|
|
66674
66675
|
const isScriptOrStyleTag = [!!html.match(/^<(?:style|script)/i), !!html.match(/<\/(?:style|script)>$/i)];
|
|
66675
66676
|
if (!isScriptOrStyleTag.includes(true))
|
|
@@ -66712,21 +66713,21 @@ const visitor = (table, index, parent) => {
|
|
|
66712
66713
|
: cell.children[0];
|
|
66713
66714
|
// @note: Compatibility with RDMD. Ideally, I'd put this in a separate
|
|
66714
66715
|
// transformer, but then there'd be some duplication.
|
|
66715
|
-
|
|
66716
|
+
visit(cell, 'break', (_, index, parent) => {
|
|
66716
66717
|
parent.children.splice(index, 1, { type: 'text', value: '\n' });
|
|
66717
66718
|
});
|
|
66718
66719
|
if (!phrasing(content) && content.type !== 'escape') {
|
|
66719
66720
|
hasFlowContent = true;
|
|
66720
66721
|
return EXIT;
|
|
66721
66722
|
}
|
|
66722
|
-
|
|
66723
|
+
visit(cell, isLiteral, (node) => {
|
|
66723
66724
|
if (node.value.match(/\n/)) {
|
|
66724
66725
|
hasFlowContent = true;
|
|
66725
66726
|
return EXIT;
|
|
66726
66727
|
}
|
|
66727
66728
|
});
|
|
66728
66729
|
};
|
|
66729
|
-
|
|
66730
|
+
visit(table, tables_to_jsx_isTableCell, tableCellVisitor);
|
|
66730
66731
|
if (!hasFlowContent) {
|
|
66731
66732
|
table.type = 'table';
|
|
66732
66733
|
return;
|
|
@@ -66774,7 +66775,7 @@ const visitor = (table, index, parent) => {
|
|
|
66774
66775
|
};
|
|
66775
66776
|
const isTable = (node) => ['table', 'tableau'].includes(node.type);
|
|
66776
66777
|
const tablesToJsx = () => tree => {
|
|
66777
|
-
|
|
66778
|
+
visit(tree, isTable, visitor);
|
|
66778
66779
|
return tree;
|
|
66779
66780
|
};
|
|
66780
66781
|
/* harmony default export */ const tables_to_jsx = (tablesToJsx);
|
|
@@ -66783,7 +66784,7 @@ const tablesToJsx = () => tree => {
|
|
|
66783
66784
|
|
|
66784
66785
|
|
|
66785
66786
|
const variables = ({ asMdx } = { asMdx: true }) => tree => {
|
|
66786
|
-
|
|
66787
|
+
visit(tree, (node, index, parent) => {
|
|
66787
66788
|
var _a, _b;
|
|
66788
66789
|
if (!['mdxFlowExpression', 'mdxTextExpression'].includes(node.type) || !('value' in node))
|
|
66789
66790
|
return;
|
|
@@ -67063,7 +67064,7 @@ function rehypeSlug(options) {
|
|
|
67063
67064
|
return function (tree) {
|
|
67064
67065
|
slugs.reset()
|
|
67065
67066
|
|
|
67066
|
-
|
|
67067
|
+
visit(tree, 'element', function (node) {
|
|
67067
67068
|
if (headingRank(node) && !node.properties.id) {
|
|
67068
67069
|
node.properties.id = prefix + slugs.slug(hast_util_to_string_lib_toString(node))
|
|
67069
67070
|
}
|
|
@@ -75186,7 +75187,7 @@ function state_createState(tree, options) {
|
|
|
75186
75187
|
wrap: state_wrap
|
|
75187
75188
|
}
|
|
75188
75189
|
|
|
75189
|
-
|
|
75190
|
+
visit(tree, function (node) {
|
|
75190
75191
|
if (node.type === 'definition' || node.type === 'footnoteDefinition') {
|
|
75191
75192
|
const map = node.type === 'definition' ? definitionById : footnoteById
|
|
75192
75193
|
const id = String(node.identifier).toUpperCase()
|
|
@@ -77847,7 +77848,7 @@ function rehypeRemoveRaw() {
|
|
|
77847
77848
|
* Nothing.
|
|
77848
77849
|
*/
|
|
77849
77850
|
return function (tree) {
|
|
77850
|
-
|
|
77851
|
+
visit(tree, 'raw', function (_, index, parent) {
|
|
77851
77852
|
if (parent && typeof index === 'number') {
|
|
77852
77853
|
parent.children.splice(index, 1)
|
|
77853
77854
|
return index
|
|
@@ -77971,7 +77972,7 @@ function remarkMarkAndUnravel() {
|
|
|
77971
77972
|
* Nothing.
|
|
77972
77973
|
*/
|
|
77973
77974
|
return function (tree) {
|
|
77974
|
-
|
|
77975
|
+
visit(tree, function (node, index, parent) {
|
|
77975
77976
|
let offset = -1
|
|
77976
77977
|
let all = true
|
|
77977
77978
|
let oneOrMore = false
|
|
@@ -79590,7 +79591,7 @@ const tocToHast = (headings = []) => {
|
|
|
79590
79591
|
};
|
|
79591
79592
|
const tocToMdx = (toc, components) => {
|
|
79592
79593
|
const tree = { type: 'root', children: toc };
|
|
79593
|
-
|
|
79594
|
+
visit(tree, 'mdxJsxFlowElement', (node, index, parent) => {
|
|
79594
79595
|
const toc = components[node.name].toc || [];
|
|
79595
79596
|
parent.children.splice(index, 1, ...toc);
|
|
79596
79597
|
});
|
|
@@ -79664,7 +79665,7 @@ const compile_compile = (text, _a = {}) => {
|
|
|
79664
79665
|
const EXPORT_NAME_REGEX = /export\s+(?:const|let|var|function)\s+(\w+)/;
|
|
79665
79666
|
const exports_exports = (doc) => {
|
|
79666
79667
|
const set = new Set();
|
|
79667
|
-
visit(
|
|
79668
|
+
visit(lib_mdast(doc), isMDXEsm, (node) => {
|
|
79668
79669
|
var _a;
|
|
79669
79670
|
if ((_a = node.value) === null || _a === void 0 ? void 0 : _a.match(EXPORT_NAME_REGEX)) {
|
|
79670
79671
|
const [, name] = node.value.match(EXPORT_NAME_REGEX);
|
|
@@ -79673,7 +79674,7 @@ const exports_exports = (doc) => {
|
|
|
79673
79674
|
});
|
|
79674
79675
|
return Array.from(set);
|
|
79675
79676
|
};
|
|
79676
|
-
/* harmony default export */ const lib_exports = (
|
|
79677
|
+
/* harmony default export */ const lib_exports = (exports_exports);
|
|
79677
79678
|
|
|
79678
79679
|
;// ./lib/hast.ts
|
|
79679
79680
|
|
|
@@ -79716,7 +79717,7 @@ const addSpaceAfter = (index, parent) => {
|
|
|
79716
79717
|
};
|
|
79717
79718
|
const trimEmphasis = (node, index, parent) => {
|
|
79718
79719
|
let trimmed = false;
|
|
79719
|
-
|
|
79720
|
+
visit(node, 'text', (child) => {
|
|
79720
79721
|
const newValue = child.value.trimStart();
|
|
79721
79722
|
if (newValue !== child.value) {
|
|
79722
79723
|
trimmed = true;
|
|
@@ -79724,7 +79725,7 @@ const trimEmphasis = (node, index, parent) => {
|
|
|
79724
79725
|
}
|
|
79725
79726
|
return EXIT;
|
|
79726
79727
|
});
|
|
79727
|
-
|
|
79728
|
+
visit(node, 'text', (child) => {
|
|
79728
79729
|
const newValue = child.value.trimEnd();
|
|
79729
79730
|
if (newValue !== child.value) {
|
|
79730
79731
|
trimmed = true;
|
|
@@ -79738,7 +79739,7 @@ const trimEmphasis = (node, index, parent) => {
|
|
|
79738
79739
|
}
|
|
79739
79740
|
};
|
|
79740
79741
|
const emphasisTransfomer = () => (tree) => {
|
|
79741
|
-
|
|
79742
|
+
visit(tree, emphasis_strongTest, trimEmphasis);
|
|
79742
79743
|
return tree;
|
|
79743
79744
|
};
|
|
79744
79745
|
/* harmony default export */ const migration_emphasis = (emphasisTransfomer);
|
|
@@ -79746,7 +79747,7 @@ const emphasisTransfomer = () => (tree) => {
|
|
|
79746
79747
|
;// ./processor/migration/images.ts
|
|
79747
79748
|
|
|
79748
79749
|
const images_imageTransformer = () => tree => {
|
|
79749
|
-
|
|
79750
|
+
visit(tree, 'image', (image) => {
|
|
79750
79751
|
var _a, _b;
|
|
79751
79752
|
if (((_b = (_a = image.data) === null || _a === void 0 ? void 0 : _a.hProperties) === null || _b === void 0 ? void 0 : _b.className) === 'border') {
|
|
79752
79753
|
image.data.hProperties.border = true;
|
|
@@ -79758,9 +79759,9 @@ const images_imageTransformer = () => tree => {
|
|
|
79758
79759
|
;// ./processor/migration/linkReference.ts
|
|
79759
79760
|
|
|
79760
79761
|
const linkReferenceTransformer = () => (tree) => {
|
|
79761
|
-
|
|
79762
|
+
visit(tree, 'linkReference', (node, index, parent) => {
|
|
79762
79763
|
const definitions = {};
|
|
79763
|
-
|
|
79764
|
+
visit(tree, 'definition', (def) => {
|
|
79764
79765
|
definitions[def.identifier] = def;
|
|
79765
79766
|
});
|
|
79766
79767
|
if (node.label === node.identifier && parent) {
|
|
@@ -79823,8 +79824,8 @@ const migrateTableCells = (vfile, rdmd) => (table) => {
|
|
|
79823
79824
|
*/
|
|
79824
79825
|
// console.error(err);
|
|
79825
79826
|
}
|
|
79826
|
-
|
|
79827
|
-
|
|
79827
|
+
visit(table, 'tableRow', (row, i) => {
|
|
79828
|
+
visit(row, 'tableCell', (cell, j) => {
|
|
79828
79829
|
let children = cell.children;
|
|
79829
79830
|
if (json && json.data[magicIndex(i, j)]) {
|
|
79830
79831
|
const string = json.data[magicIndex(i, j)].replace(psuedoListRegex, '$<ws>- $<item>');
|
|
@@ -79838,7 +79839,7 @@ const migrateTableCells = (vfile, rdmd) => (table) => {
|
|
|
79838
79839
|
});
|
|
79839
79840
|
return SKIP;
|
|
79840
79841
|
});
|
|
79841
|
-
|
|
79842
|
+
visit(table, 'inlineCode', (code) => {
|
|
79842
79843
|
if (code.value.includes('\n')) {
|
|
79843
79844
|
// eslint-disable-next-line no-param-reassign
|
|
79844
79845
|
code.type = 'code';
|
|
@@ -79848,7 +79849,7 @@ const migrateTableCells = (vfile, rdmd) => (table) => {
|
|
|
79848
79849
|
function tableCellTransformer() {
|
|
79849
79850
|
const rdmd = this.data('rdmd');
|
|
79850
79851
|
return (tree, vfile) => {
|
|
79851
|
-
|
|
79852
|
+
visit(tree, 'table', migrateTableCells(vfile, rdmd));
|
|
79852
79853
|
return tree;
|
|
79853
79854
|
};
|
|
79854
79855
|
}
|
|
@@ -82943,7 +82944,7 @@ function media(state, node) {
|
|
|
82943
82944
|
/** @type {Root} */
|
|
82944
82945
|
const fragment = {type: 'root', children: nodes}
|
|
82945
82946
|
|
|
82946
|
-
|
|
82947
|
+
visit(fragment, function (node) {
|
|
82947
82948
|
if (node.type === 'link') {
|
|
82948
82949
|
linkInFallbackContent = true
|
|
82949
82950
|
return EXIT
|
|
@@ -83414,7 +83415,7 @@ function inspect(node) {
|
|
|
83414
83415
|
let rowIndex = 0
|
|
83415
83416
|
let cellIndex = 0
|
|
83416
83417
|
|
|
83417
|
-
|
|
83418
|
+
visit(node, function (child) {
|
|
83418
83419
|
if (child.type === 'element') {
|
|
83419
83420
|
// Don’t enter nested tables.
|
|
83420
83421
|
if (child.tagName === 'table' && node !== child) {
|
|
@@ -84236,7 +84237,7 @@ function toMdast(tree, options) {
|
|
|
84236
84237
|
// @ts-expect-error: fine to pass an arbitrary node.
|
|
84237
84238
|
transformWhitespace(cleanTree)
|
|
84238
84239
|
|
|
84239
|
-
|
|
84240
|
+
visit(cleanTree, function (node) {
|
|
84240
84241
|
if (node && node.type === 'element' && node.properties) {
|
|
84241
84242
|
const id = String(node.properties.id || '') || undefined
|
|
84242
84243
|
|
|
@@ -84264,7 +84265,7 @@ function toMdast(tree, options) {
|
|
|
84264
84265
|
// we’re generating some whitespace too, and some nodes are in the end
|
|
84265
84266
|
// ignored.
|
|
84266
84267
|
// So clean up.
|
|
84267
|
-
|
|
84268
|
+
visit(mdast, function (node, index, parent) {
|
|
84268
84269
|
if (node.type === 'text' && index !== undefined && parent) {
|
|
84269
84270
|
const previous = parent.children[index - 1]
|
|
84270
84271
|
|
|
@@ -84823,7 +84824,7 @@ const run_run = async (string, _opts = {}) => {
|
|
|
84823
84824
|
|
|
84824
84825
|
const tags = (doc) => {
|
|
84825
84826
|
const set = new Set();
|
|
84826
|
-
|
|
84827
|
+
visit(lib_mdast(doc), isMDXElement, (node) => {
|
|
84827
84828
|
var _a;
|
|
84828
84829
|
if ((_a = node.name) === null || _a === void 0 ? void 0 : _a.match(/^[A-Z]/)) {
|
|
84829
84830
|
set.add(node.name);
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@readme/markdown",
|
|
3
3
|
"description": "ReadMe's React-based Markdown parser",
|
|
4
4
|
"author": "Rafe Goldberg <rafe@readme.io>",
|
|
5
|
-
"version": "7.
|
|
5
|
+
"version": "7.13.0",
|
|
6
6
|
"main": "dist/main.node.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
8
8
|
"browser": "dist/main.js",
|