A dev tool to inspect the ast transformations done remark and rehype plugins during MDX compilation.
mdxdebugger.mp4
$ npm i mdx-debugger
import { withDebugger } from "mdx-debugger";
const file = { value: "# Hello", path: "test.md" };
const debugCompile = withDebugger(compile);
const result = await debugCompile(file, {
remarkPlugins: [...],
rehypePlugins: [...],
});
import { withDebugger } from "mdx-debugger";
const file = { value: "# Hello", path: "test.md" };
const debugCompile = withDebugger(compile, {
// only debug some files:
filter: (file) => file?.path.includes("test.md"),
// customize the message logged to the console:
log: (filepath, url) => console.log(`${filepath} -> ${url}`),
});
const result = await debugCompile(file, {
remarkPlugins: [...],
rehypePlugins: [...],
});
PRs welcome.
MIT