@vxrn/mdx 1.1.321 → 1.1.323
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.js +5 -4
- package/dist/index.js.map +1 -1
- package/dist/index.native.js +5 -4
- package/dist/index.native.js.map +2 -2
- package/package.json +1 -1
- package/src/getHeadings.ts +1 -1
- package/src/getMDXBySlug.tsx +7 -3
- package/src/index.ts +2 -3
- package/types/getMDXBySlug.d.ts +3 -2
- package/types/getMDXBySlug.d.ts.map +1 -1
- package/types/index.d.ts +2 -2
- package/types/index.d.ts.map +1 -1
package/dist/index.js
CHANGED
|
@@ -7573,7 +7573,7 @@ var getTitle = (source) => source.replace(/^\#+\s+/, "").replace(/\<.*\>/, " "),
|
|
|
7573
7573
|
`).filter((x) => x.startsWith("#")).map((x) => ({
|
|
7574
7574
|
title: getTitle(x),
|
|
7575
7575
|
priority: x.trim().split(" ")[0].length,
|
|
7576
|
-
id: `#${getTitle(x).replace(/\s
|
|
7576
|
+
id: `#${getTitle(x).replace(/\s+/g, "-").toLowerCase()}`
|
|
7577
7577
|
}));
|
|
7578
7578
|
|
|
7579
7579
|
// src/getAllFrontmatter.tsx
|
|
@@ -17966,13 +17966,13 @@ function rehypeSlug(options2 = {}) {
|
|
|
17966
17966
|
}
|
|
17967
17967
|
|
|
17968
17968
|
// src/getMDXBySlug.tsx
|
|
17969
|
-
var getMDXBySlug = async (basePath, slug2) => {
|
|
17969
|
+
var getMDXBySlug = async (basePath, slug2, extraPlugins) => {
|
|
17970
17970
|
let mdxPath = slug2;
|
|
17971
17971
|
if (!slug2.includes(".") && basePath.includes("components")) {
|
|
17972
17972
|
let versions = getAllVersionsFromPath(import_node_path2.default.join(basePath, slug2));
|
|
17973
17973
|
mdxPath += `/${versions[0]}`;
|
|
17974
17974
|
}
|
|
17975
|
-
let filePath = import_node_path2.default.join(basePath, `${mdxPath}.mdx`), source = import_node_fs2.default.readFileSync(filePath, "utf8"), { frontmatter, code } = await getMDX(source);
|
|
17975
|
+
let filePath = import_node_path2.default.join(basePath, `${mdxPath}.mdx`), source = import_node_fs2.default.readFileSync(filePath, "utf8"), { frontmatter, code } = await getMDX(source, extraPlugins);
|
|
17976
17976
|
return {
|
|
17977
17977
|
frontmatter: {
|
|
17978
17978
|
...frontmatter,
|
|
@@ -17982,11 +17982,12 @@ var getMDXBySlug = async (basePath, slug2) => {
|
|
|
17982
17982
|
code
|
|
17983
17983
|
};
|
|
17984
17984
|
};
|
|
17985
|
-
async function getMDX(source) {
|
|
17985
|
+
async function getMDX(source, extraPlugins) {
|
|
17986
17986
|
return await (0, import_mdx_bundler.bundleMDX)({
|
|
17987
17987
|
source,
|
|
17988
17988
|
mdxOptions(options2) {
|
|
17989
17989
|
let plugins = [
|
|
17990
|
+
...extraPlugins || [],
|
|
17990
17991
|
...options2.rehypePlugins ?? [],
|
|
17991
17992
|
rehypeMetaAttribute_default,
|
|
17992
17993
|
rehypeHighlightCode,
|