@readme/markdown 6.75.0-beta.67 → 6.75.0-beta.68
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 +4 -2
- package/dist/main.node.js +4 -2
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -78509,8 +78509,9 @@ 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
|
+
console.log({ headings });
|
|
78514
78515
|
const min = Math.min(...headings.map(getDepth));
|
|
78515
78516
|
const ast = h('ul');
|
|
78516
78517
|
const stack = [ast];
|
|
@@ -78533,7 +78534,8 @@ const tocToHast = (headings = []) => {
|
|
|
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,8 +79962,9 @@ 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
|
+
console.log({ headings });
|
|
79967
79968
|
const min = Math.min(...headings.map(getDepth));
|
|
79968
79969
|
const ast = h('ul');
|
|
79969
79970
|
const stack = [ast];
|
|
@@ -79986,7 +79987,8 @@ const tocToHast = (headings = []) => {
|
|
|
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.68",
|
|
6
6
|
"main": "dist/main.node.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
8
8
|
"browser": "dist/main.js",
|