fumadocs-core
Version:
The React.js library for building a documentation website
24 lines (22 loc) • 760 B
JavaScript
import * as JsxRuntime from "react/jsx-runtime";
import { remark } from "remark";
import remarkGfm from "remark-gfm";
import remarkRehype from "remark-rehype";
import { toJsxRuntime } from "hast-util-to-jsx-runtime";
//#region src/content/index.ts
function rehypeReact(options = {}) {
this.compiler = (tree, file) => {
return toJsxRuntime(tree, {
development: false,
filePath: file.path,
...JsxRuntime,
...options
});
};
}
async function Markdown({ children: content, remarkPlugins = [], rehypePlugins = [], ...options }) {
return (await remark().use(remarkGfm).use(remarkPlugins).use(remarkRehype).use(rehypePlugins).use(rehypeReact, options).process(content)).result;
}
//#endregion
export { Markdown };
//# sourceMappingURL=index.js.map