@readme/markdown 6.75.0-beta.67 → 6.75.0-beta.69
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/main.js +5 -3
- package/dist/main.node.js +5 -3
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -78509,7 +78509,7 @@ const rehypeToc = ({ components = {} }) => {
|
|
|
78509
78509
|
};
|
|
78510
78510
|
};
|
|
78511
78511
|
const MAX_DEPTH = 2;
|
|
78512
|
-
const getDepth = (el) => parseInt(el.tagName.match(/^h(\d)/)[1]);
|
|
78512
|
+
const getDepth = (el) => { var _a; return parseInt((_a = el.tagName) === null || _a === void 0 ? void 0 : _a.match(/^h(\d)/)[1]); };
|
|
78513
78513
|
const tocToHast = (headings = []) => {
|
|
78514
78514
|
const min = Math.min(...headings.map(getDepth));
|
|
78515
78515
|
const ast = h('ul');
|
|
@@ -78526,14 +78526,16 @@ const tocToHast = (headings = []) => {
|
|
|
78526
78526
|
while (stack.length > depth) {
|
|
78527
78527
|
stack.pop();
|
|
78528
78528
|
}
|
|
78529
|
-
|
|
78529
|
+
if (heading.properties)
|
|
78530
|
+
stack[stack.length - 1].children.push(h('li', null, h('a', { href: `#${heading.properties.id}` }, heading.children)));
|
|
78530
78531
|
});
|
|
78531
78532
|
return ast;
|
|
78532
78533
|
};
|
|
78533
78534
|
const tocToMdx = (toc, components) => {
|
|
78534
78535
|
const tree = { type: 'root', children: toc };
|
|
78535
78536
|
visit(tree, 'mdxJsxFlowElement', (node, index, parent) => {
|
|
78536
|
-
|
|
78537
|
+
const toc = components[node.name].toc || [];
|
|
78538
|
+
parent.children.splice(index, 1, ...toc);
|
|
78537
78539
|
});
|
|
78538
78540
|
const tocHast = tocToHast(tree.children);
|
|
78539
78541
|
return lib_mdx(tocHast, { hast: true });
|
package/dist/main.node.js
CHANGED
|
@@ -79962,7 +79962,7 @@ const rehypeToc = ({ components = {} }) => {
|
|
|
79962
79962
|
};
|
|
79963
79963
|
};
|
|
79964
79964
|
const MAX_DEPTH = 2;
|
|
79965
|
-
const getDepth = (el) => parseInt(el.tagName.match(/^h(\d)/)[1]);
|
|
79965
|
+
const getDepth = (el) => { var _a; return parseInt((_a = el.tagName) === null || _a === void 0 ? void 0 : _a.match(/^h(\d)/)[1]); };
|
|
79966
79966
|
const tocToHast = (headings = []) => {
|
|
79967
79967
|
const min = Math.min(...headings.map(getDepth));
|
|
79968
79968
|
const ast = h('ul');
|
|
@@ -79979,14 +79979,16 @@ const tocToHast = (headings = []) => {
|
|
|
79979
79979
|
while (stack.length > depth) {
|
|
79980
79980
|
stack.pop();
|
|
79981
79981
|
}
|
|
79982
|
-
|
|
79982
|
+
if (heading.properties)
|
|
79983
|
+
stack[stack.length - 1].children.push(h('li', null, h('a', { href: `#${heading.properties.id}` }, heading.children)));
|
|
79983
79984
|
});
|
|
79984
79985
|
return ast;
|
|
79985
79986
|
};
|
|
79986
79987
|
const tocToMdx = (toc, components) => {
|
|
79987
79988
|
const tree = { type: 'root', children: toc };
|
|
79988
79989
|
visit(tree, 'mdxJsxFlowElement', (node, index, parent) => {
|
|
79989
|
-
|
|
79990
|
+
const toc = components[node.name].toc || [];
|
|
79991
|
+
parent.children.splice(index, 1, ...toc);
|
|
79990
79992
|
});
|
|
79991
79993
|
const tocHast = tocToHast(tree.children);
|
|
79992
79994
|
return lib_mdx(tocHast, { hast: true });
|
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": "6.75.0-beta.
|
|
5
|
+
"version": "6.75.0-beta.69",
|
|
6
6
|
"main": "dist/main.node.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
8
8
|
"browser": "dist/main.js",
|