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

[ERROR] The specified engine has not resolved. #224

Closed
simonmaris opened this issue May 1, 2020 · 7 comments
Closed

[ERROR] The specified engine has not resolved. #224

simonmaris opened this issue May 1, 2020 · 7 comments

Comments

@simonmaris
Copy link

simonmaris commented May 1, 2020

Hi!

For some reason, I seem to be unable to define an engine for marp-cli. I was going to add custom markdown-it plugins, but have tested this minimal example to show the problem.

Screen Shot 2020-05-01 at 16 31 46

The same error message happens when I tried to add --engine ./engine.js with the following:

const { Marp } = require('@marp-team/marp-core')
const markdownItFootnote = require('markdown-it-footnote')

module.exports = (opts) => new Marp(opts).use(markdownItFootnote)

Any ideas?

Thank you very much for building this!

@yhatt
Copy link
Member

yhatt commented May 2, 2020

You're lacking a step to install modules. As shown in the example, the custom engine has to install Marp Core package and plugins through npm package manager individually.

npm i @marp-team/marp-core markdown-it-footnote --save-dev

@yhatt yhatt added the question 🙅 Not issue, just a question (should post to Marp discussion) label May 2, 2020
@simonmaris
Copy link
Author

I installed both before globally. Do they need to be local?

@yhatt
Copy link
Member

yhatt commented May 2, 2020

Yep. Global install is generally evil.

@simonmaris
Copy link
Author

simonmaris commented May 2, 2020

Right, that's unfortunate.

I tried local install and it works.

I was hoping to use marp-cli on multiple presentations without scattering node-modules/ directories everywhere. This (also discussed on SO) is from the npm release logs v1.0 (year 2011 :))

In general, the rule of thumb is:

  1. If you’re installing something that you want to use in your program, using require('whatever'), then install it locally, at the root of your project.
  2. If you’re installing something that you want to use in your shell, on the command line or something, install it globally, so that its binaries end up in your PATH environment variable.

Obviously not up-to-date but I couldn't find anything in the latest docs.. I was hoping to do 2., would there be a way to still do this (knowingly running into version issues later)?

I will try npx now..

Thank you!

@yhatt
Copy link
Member

yhatt commented May 2, 2020

@simonmaris I found out a way to enable global modules.

NODE_PATH=$(npm root -g) marp --engine @marp-team/marp-core

Node.js's require() does not find from global modules by default. By adding NODE_PATH env, you can add the target directory for finding.

@simonmaris
Copy link
Author

WOW, thank you, that's fantastic!

May I ask one last question? 😇
I would like to customize the markdown-it-footnote output, however I am struggling to add this the right way.

const md = require('markdown-it')().use(require('markdown-it-footnote'));
 
md.renderer.rules.footnote_block_open = () => (
  '<h4 class="mt-3">Footnotes</h4>\n' +
  '<section class="footnotes">\n' +
  '<ol class="footnotes-list">\n'
);

I couldn't find any examples of a custom engine that extends md.renderer.rules. I saw the official plugins like math using marpitPlugin, would this be the way to go?

I would be very grateful for a pointer or basic example!

@yhatt
Copy link
Member

yhatt commented May 2, 2020

Please follow our contribuding guildeline.

https://github.com/marp-team/.github/blob/master/CONTRIBUTING.md#report-issue

Please not contain multiple reports into one issue. It should have only one theme.

https://github.com/marp-team/.github/blob/master/SUPPORT.md#no_good-github-issue

Please keep in mind that GitHub issue tracker is not a support forum.

In general, GitHub issue is designed for tracking problems occured in project. A personal question about Marp will prevent Marp team focusing to resolve core issues.

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