@readme/markdown 8.4.0 → 8.4.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/main.js
CHANGED
|
@@ -83693,10 +83693,10 @@ const tocToHast = (headings = []) => {
|
|
|
83693
83693
|
});
|
|
83694
83694
|
return ast;
|
|
83695
83695
|
};
|
|
83696
|
-
const
|
|
83696
|
+
const tocHastToMdx = (toc, components) => {
|
|
83697
83697
|
const tree = { type: 'root', children: toc };
|
|
83698
83698
|
visit(tree, 'mdxJsxFlowElement', (node, index, parent) => {
|
|
83699
|
-
const subToc = components[node.name]
|
|
83699
|
+
const subToc = components[node.name] || [];
|
|
83700
83700
|
parent.children.splice(index, 1, ...subToc);
|
|
83701
83701
|
});
|
|
83702
83702
|
const tocHast = tocToHast(tree.children);
|
|
@@ -88862,10 +88862,12 @@ const makeUseMDXComponents = (more = {}) => {
|
|
|
88862
88862
|
const run_run = async (string, _opts = {}) => {
|
|
88863
88863
|
const { Fragment } = jsx_runtime_namespaceObject;
|
|
88864
88864
|
const { components = {}, terms, variables, baseUrl, imports = {}, ...opts } = _opts;
|
|
88865
|
+
const tocsByTag = {};
|
|
88865
88866
|
const exportedComponents = Object.entries(components).reduce((memo, [tag, mod]) => {
|
|
88866
88867
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
88867
88868
|
const { default: Content, toc, Toc, stylesheets, ...rest } = mod;
|
|
88868
88869
|
memo[tag] = Content;
|
|
88870
|
+
tocsByTag[tag] = toc;
|
|
88869
88871
|
if (rest) {
|
|
88870
88872
|
Object.entries(rest).forEach(([subTag, component]) => {
|
|
88871
88873
|
memo[subTag] = component;
|
|
@@ -88886,7 +88888,7 @@ const run_run = async (string, _opts = {}) => {
|
|
|
88886
88888
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
88887
88889
|
const { Toc: _Toc, toc, default: Content, stylesheet, ...exports } = await exec(string);
|
|
88888
88890
|
let Toc;
|
|
88889
|
-
const tocMdx =
|
|
88891
|
+
const tocMdx = tocHastToMdx(toc, tocsByTag);
|
|
88890
88892
|
if (tocMdx) {
|
|
88891
88893
|
const compiledToc = await lib_compile(tocMdx);
|
|
88892
88894
|
const tocModule = await exec(compiledToc, { useMDXComponents: () => ({ p: Fragment }) });
|
package/dist/main.node.js
CHANGED
|
@@ -88275,10 +88275,10 @@ const tocToHast = (headings = []) => {
|
|
|
88275
88275
|
});
|
|
88276
88276
|
return ast;
|
|
88277
88277
|
};
|
|
88278
|
-
const
|
|
88278
|
+
const tocHastToMdx = (toc, components) => {
|
|
88279
88279
|
const tree = { type: 'root', children: toc };
|
|
88280
88280
|
visit(tree, 'mdxJsxFlowElement', (node, index, parent) => {
|
|
88281
|
-
const subToc = components[node.name]
|
|
88281
|
+
const subToc = components[node.name] || [];
|
|
88282
88282
|
parent.children.splice(index, 1, ...subToc);
|
|
88283
88283
|
});
|
|
88284
88284
|
const tocHast = tocToHast(tree.children);
|
|
@@ -93444,10 +93444,12 @@ const makeUseMDXComponents = (more = {}) => {
|
|
|
93444
93444
|
const run_run = async (string, _opts = {}) => {
|
|
93445
93445
|
const { Fragment } = jsx_runtime_namespaceObject;
|
|
93446
93446
|
const { components = {}, terms, variables, baseUrl, imports = {}, ...opts } = _opts;
|
|
93447
|
+
const tocsByTag = {};
|
|
93447
93448
|
const exportedComponents = Object.entries(components).reduce((memo, [tag, mod]) => {
|
|
93448
93449
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
93449
93450
|
const { default: Content, toc, Toc, stylesheets, ...rest } = mod;
|
|
93450
93451
|
memo[tag] = Content;
|
|
93452
|
+
tocsByTag[tag] = toc;
|
|
93451
93453
|
if (rest) {
|
|
93452
93454
|
Object.entries(rest).forEach(([subTag, component]) => {
|
|
93453
93455
|
memo[subTag] = component;
|
|
@@ -93468,7 +93470,7 @@ const run_run = async (string, _opts = {}) => {
|
|
|
93468
93470
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
93469
93471
|
const { Toc: _Toc, toc, default: Content, stylesheet, ...exports } = await exec(string);
|
|
93470
93472
|
let Toc;
|
|
93471
|
-
const tocMdx =
|
|
93473
|
+
const tocMdx = tocHastToMdx(toc, tocsByTag);
|
|
93472
93474
|
if (tocMdx) {
|
|
93473
93475
|
const compiledToc = await lib_compile(tocMdx);
|
|
93474
93476
|
const tocModule = await exec(compiledToc, { useMDXComponents: () => ({ p: Fragment }) });
|