2

I 1must append a config file to 2package command, required as -p puppeteer-config.json. In my init.el, I tried changing the native command as shown below:

From:

(setq ob-mermaid-cli-path "~/node_modules/.bin/mmdc")

To:

(setq ob-mermaid-cli-path "~/node_modules/.bin/mmdc -p puppeteer-config.json")

Evaluating the code block results in:

org-babel-execute:mermaid: could not find mermaid.cli executable at ~/node_modules/.bin/mmdc -p puppeteer-config.json

I'm aware of 3shell-quote-arguments, though couldn't figure out how to use them to solve my problem.

Footnotes

1 https://github.com/mermaidjs/mermaid.cli#user-content-linux-sandbox-issue

2 https://github.com/arnm/ob-mermaid

3 https://www.gnu.org/software/emacs/manual/html_node/elisp/Shell-Arguments.html

  • It looks like you could try a SQL infection trick, like ~/node_modules/.bin/mmdc\" -p \"puppeteer-config.json" ;) – cyberbisson May 25 at 2:38
2

I'm not familiar with mermaid, but did you consider making a wrapper script that has the arguments hard coded (assuming those arguments will not change)?

1

org-babel-execute:mermaid constructs its shell command like so:

(concat (shell-quote-argument (expand-file-name ob-mermaid-cli-path))
        " -i " (org-babel-process-file-name temp-file)
        " -o " (org-babel-process-file-name out-file))

So there isn't any facility to specify other options.

The sensible thing to do is to submit a feature request or patch to ob-mermaid to provide a new user option for configuring custom arguments for this command.

The workaround is to do what Beetle B has suggested, and write a shell script like:

#!/bin/sh
/path/to/node_modules/.bin/mmdc -p puppeteer-config.json "$@"

and then point the ob-mermaid-cli-path variable at the path to that script.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.