remark-cite
remark-cite copied to clipboard
Export citePlugin as default
This seems to fix #1 by exporting a default method.
I've also ensured options is set, because otherwise I got an exception:
1:1 error TypeError: Cannot read property 'syntax' of undefined
at Function.citePlugin (/Users/ben/Code/remark-cite/remark-cite/dist/index.cjs.js:21:72)
…
I'm not sure if there's a better way of writing that — I've never used typescript before.
Thanks for the PR! I tried testing this locally with remark-cli (by installing remark-cli alongside remark-cite in a project, but replacing the @benrbray/remark-cite version string in package.json with the path to my local copy of your fork).
Were you able to successfully test this locally? What was your setup?
Also as a side note: I think this will be a breaking change to the package since it changes how the citePlugin needs to be imported (as a default rather than named export). So I will need to bump the major version. I don't mind doing this as long as it does indeed fix the issue with remark-cli.
I ran this locally by doing npm run build then npm install -g, and I was able to confirm that my …/node_modules/@benrbray/remark-cite/dist/index.*.js had the changes applied.
Then I was able to run remark test.md as normal and see first of all that in debug mode the extension was listed as being loaded (when it hadn't previously), and secondly that the output was as expected (citation nodes in the AST output, preserved citations in the markdown output).
remark-cite now has a default export, so I believe this issue is resolved. Let me know if that's not the case!