fumadocs-core
Version:
The React.js library for building a documentation website
40 lines (38 loc) • 923 B
JavaScript
import { valueToEstree } from "estree-util-value-to-estree";
//#region src/mdx-plugins/mdast-utils.ts
function flattenNode(node) {
if ("children" in node) return node.children.map((child) => flattenNode(child)).join("");
if ("value" in node && typeof node.value === "string") return node.value;
return "";
}
function toMdxExport(name, value) {
return {
type: "mdxjsEsm",
value: "",
data: { estree: {
type: "Program",
sourceType: "module",
body: [{
type: "ExportNamedDeclaration",
attributes: [],
specifiers: [],
source: null,
declaration: {
type: "VariableDeclaration",
kind: "let",
declarations: [{
type: "VariableDeclarator",
id: {
type: "Identifier",
name
},
init: valueToEstree(value)
}]
}
}]
} }
};
}
//#endregion
export { toMdxExport as n, flattenNode as t };
//# sourceMappingURL=mdast-utils-mc9-X-PK.js.map