Closed OctavianUrsu closed 4 years ago
The problem is that, when using with mdx
, you have to transform the code into a vfile
to get the path of the code. Plain text won't work.
const jsx = await mdx(mdxCode, {
skipExport: true,
remarkPlugins: [codeimport],
+ filepath: '/your/mdxCode/path',
});
Try this and see if it works?
There's also a createCompiler API which I think could be helpful too 🤔
It works if I give the "filepath". Thanks ;)
First, using the remark plugin in docusaurus works fine, but when testing the plugin using this example:
I am getting this error on "node index.js":
I made another dependency called example inside the plugin and I linked the dependencies using:
I managed to make it work by replacing
const fileAbsPath = path.resolve(file.dirname, filePath);
toconst fileAbsPath = path.resolve(file.cwd, filePath);
because file.dirname was undefined.