@readme/markdown 10.0.0 → 10.0.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/lib/mdx.d.ts
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import type { Root as HastRoot } from 'hast';
|
|
2
2
|
import type { Root as MdastRoot } from 'mdast';
|
|
3
|
-
|
|
3
|
+
import type { PluggableList } from 'unified';
|
|
4
|
+
import type { VFile } from 'vfile';
|
|
5
|
+
interface Opts {
|
|
6
|
+
file?: VFile | string;
|
|
4
7
|
hast?: boolean;
|
|
5
|
-
remarkTransformers?:
|
|
6
|
-
}
|
|
8
|
+
remarkTransformers?: PluggableList;
|
|
9
|
+
}
|
|
10
|
+
export declare const mdx: (tree: HastRoot | MdastRoot, { hast, remarkTransformers, file, ...opts }?: Opts) => string;
|
|
7
11
|
export default mdx;
|
package/dist/main.js
CHANGED
|
@@ -90747,7 +90747,7 @@ function compilers() {
|
|
|
90747
90747
|
|
|
90748
90748
|
|
|
90749
90749
|
|
|
90750
|
-
const mdx_mdx = (tree, { hast = false, remarkTransformers = [], ...opts } = {}) => {
|
|
90750
|
+
const mdx_mdx = (tree, { hast = false, remarkTransformers = [], file, ...opts } = {}) => {
|
|
90751
90751
|
const processor = unified()
|
|
90752
90752
|
.use(hast ? rehypeRemark : undefined)
|
|
90753
90753
|
.use(remarkMdx)
|
|
@@ -90761,7 +90761,7 @@ const mdx_mdx = (tree, { hast = false, remarkTransformers = [], ...opts } = {})
|
|
|
90761
90761
|
.use(remarkStringify, opts);
|
|
90762
90762
|
// @ts-expect-error - @todo: coerce the processor and tree to the correct
|
|
90763
90763
|
// type depending on the value of hast
|
|
90764
|
-
return processor.stringify(processor.runSync(tree));
|
|
90764
|
+
return processor.stringify(processor.runSync(tree, file));
|
|
90765
90765
|
};
|
|
90766
90766
|
/* harmony default export */ const lib_mdx = (mdx_mdx);
|
|
90767
90767
|
|
|
@@ -90776,12 +90776,31 @@ const migrateCallouts = () => (tree) => {
|
|
|
90776
90776
|
};
|
|
90777
90777
|
/* harmony default export */ const migrate_callouts = (migrateCallouts);
|
|
90778
90778
|
|
|
90779
|
+
;// ./processor/transform/migrate-link-references.ts
|
|
90780
|
+
|
|
90781
|
+
|
|
90782
|
+
const migrateLinkReferences = () => {
|
|
90783
|
+
return (tree, vfile) => {
|
|
90784
|
+
visit(tree, 'linkReference', (node, index, parent) => {
|
|
90785
|
+
if (!('children' in parent))
|
|
90786
|
+
return;
|
|
90787
|
+
parent.children.splice(index, 1, {
|
|
90788
|
+
type: NodeTypes.plain,
|
|
90789
|
+
value: String(vfile).slice(node.position.start.offset, node.position.end.offset),
|
|
90790
|
+
});
|
|
90791
|
+
});
|
|
90792
|
+
};
|
|
90793
|
+
};
|
|
90794
|
+
/* harmony default export */ const migrate_link_references = (migrateLinkReferences);
|
|
90795
|
+
|
|
90779
90796
|
;// ./lib/migrate.ts
|
|
90780
90797
|
|
|
90781
90798
|
|
|
90782
90799
|
|
|
90800
|
+
|
|
90783
90801
|
const migrate = (doc, { rdmd }) => {
|
|
90784
|
-
|
|
90802
|
+
const ast = lib_mdastV6(doc, { rdmd });
|
|
90803
|
+
return (lib_mdx(ast, { remarkTransformers: [migrate_callouts, migrate_link_references], file: doc })
|
|
90785
90804
|
.replaceAll(/ /g, ' ')
|
|
90786
90805
|
// @note: I'm not sure what's happening, but I think mdx is converting an
|
|
90787
90806
|
// 'a' to 'a' as a means of escaping it. I think this helps with
|
package/dist/main.node.js
CHANGED
|
@@ -107657,7 +107657,7 @@ function compilers() {
|
|
|
107657
107657
|
|
|
107658
107658
|
|
|
107659
107659
|
|
|
107660
|
-
const mdx_mdx = (tree, { hast = false, remarkTransformers = [], ...opts } = {}) => {
|
|
107660
|
+
const mdx_mdx = (tree, { hast = false, remarkTransformers = [], file, ...opts } = {}) => {
|
|
107661
107661
|
const processor = unified()
|
|
107662
107662
|
.use(hast ? rehypeRemark : undefined)
|
|
107663
107663
|
.use(remarkMdx)
|
|
@@ -107671,7 +107671,7 @@ const mdx_mdx = (tree, { hast = false, remarkTransformers = [], ...opts } = {})
|
|
|
107671
107671
|
.use(remarkStringify, opts);
|
|
107672
107672
|
// @ts-expect-error - @todo: coerce the processor and tree to the correct
|
|
107673
107673
|
// type depending on the value of hast
|
|
107674
|
-
return processor.stringify(processor.runSync(tree));
|
|
107674
|
+
return processor.stringify(processor.runSync(tree, file));
|
|
107675
107675
|
};
|
|
107676
107676
|
/* harmony default export */ const lib_mdx = (mdx_mdx);
|
|
107677
107677
|
|
|
@@ -107686,12 +107686,31 @@ const migrateCallouts = () => (tree) => {
|
|
|
107686
107686
|
};
|
|
107687
107687
|
/* harmony default export */ const migrate_callouts = (migrateCallouts);
|
|
107688
107688
|
|
|
107689
|
+
;// ./processor/transform/migrate-link-references.ts
|
|
107690
|
+
|
|
107691
|
+
|
|
107692
|
+
const migrateLinkReferences = () => {
|
|
107693
|
+
return (tree, vfile) => {
|
|
107694
|
+
visit(tree, 'linkReference', (node, index, parent) => {
|
|
107695
|
+
if (!('children' in parent))
|
|
107696
|
+
return;
|
|
107697
|
+
parent.children.splice(index, 1, {
|
|
107698
|
+
type: NodeTypes.plain,
|
|
107699
|
+
value: String(vfile).slice(node.position.start.offset, node.position.end.offset),
|
|
107700
|
+
});
|
|
107701
|
+
});
|
|
107702
|
+
};
|
|
107703
|
+
};
|
|
107704
|
+
/* harmony default export */ const migrate_link_references = (migrateLinkReferences);
|
|
107705
|
+
|
|
107689
107706
|
;// ./lib/migrate.ts
|
|
107690
107707
|
|
|
107691
107708
|
|
|
107692
107709
|
|
|
107710
|
+
|
|
107693
107711
|
const migrate = (doc, { rdmd }) => {
|
|
107694
|
-
|
|
107712
|
+
const ast = lib_mdastV6(doc, { rdmd });
|
|
107713
|
+
return (lib_mdx(ast, { remarkTransformers: [migrate_callouts, migrate_link_references], file: doc })
|
|
107695
107714
|
.replaceAll(/ /g, ' ')
|
|
107696
107715
|
// @note: I'm not sure what's happening, but I think mdx is converting an
|
|
107697
107716
|
// 'a' to 'a' as a means of escaping it. I think this helps with
|