Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problems using custom parser #16

Open
flesser opened this issue Mar 30, 2016 · 1 comment
Open

Problems using custom parser #16

flesser opened this issue Mar 30, 2016 · 1 comment
Assignees

Comments

@flesser
Copy link

flesser commented Mar 30, 2016

I try to use a custom Markdown parser by setting parser = ./custom-markdown-parser in my .prezrc file.

However, I keep getting the following error:

/usr/lib/node_modules/prez/lib/convert.js:32
        throw new Error("Error while loading parser '" + parser + "' (" + e1 + ")");
        ^

Error: Error while loading parser './custom-markdown-parser' (Error: Cannot find module './parsers/./custom-markdown-parser')

The problem seems to be that the script never looks for my custom parser in my local project dir instead of the global prez install path.
In convert.js:20, it seems to never enter the // No module: try to load user implementation conditional branch.

If I modify the line to omit the && e1.message.indexOf("'" + parser + "'") !== -1) condition, it works. (But I guess that condition has a reason to be there?)

@naholyr
Copy link
Member

naholyr commented Mar 30, 2016

Honestly I feel quite uncomfortable with this condition ;) so I guess you nailed it and there is a bug lying in there.
In the first place it was here in case of missing optional dependency. For example, to use "marky" you have to install a prez's peer dependency "marky". But:

  1. This is not well documented
  2. This is hard to detect

I'm not sure how to handle those "default but not enabled parsers" properly, in the meantime your fix is OK and I'll push a version modifying this.

Thanks for your report and fix proposal!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants