pandoc with mermaid filter

kevin henderson's Avatar

kevin henderson

12 Feb, 2022 05:08 PM

I have a custom processor set up and trying to use it with mermaid-filter but I'm getting an error :-/
I'm using the non app-store, local version of Marked2, Version 2.6.13 (1027) on MacOS
pandoc and mmdc (mermaid-cli) were installed via homebrew, mermaid-filter via npm
Running from the cli works (details below)
Running pandoc from Marked works but just not with the mermaid-filter applied

links to mermaid filter & cli (both in path):

Sample doc (with backticks not quotes):

# Test


flowchart LR;

hello --> world;

cli (works):

pandoc --from=markdown --to=html5 -i -F /Users/kgh/.nvm/versions/node/v16.13.0/bin/mermaid-filter --standalone -o test.html

custom processor:

path = /usr/local/bin/pandoc
args = - --from=markdown --to=html --standalone --filter=/Users/kgh/.nvm/versions/node/v16.13.0/bin/mermaid-filter

here's the error:
I suspect this probably has to do with configuring the marked2 environment variables,
since it's trying to create the error file in the root directory,
but I'm just not sure how/where to change these.

Any suggestions/advice would be appreciated, thank you.

throw er; // Unhandled 'error' event ^

Error: EROFS: read-only file system, open '/mermaid-filter.err'
Emitted 'error' event on WriteStream instance at:
at emitErrorNT (node:internal/streams/destroy:164:8) at emitErrorCloseNT (node:internal/streams/destroy:129:3) at processTicksAndRejections (node:internal/process/task_queues:83:21) { errno: -30, code: 'EROFS', syscall: 'open', path: '/mermaid-filter.err' }

Node.js v17.5.0
Error running filter /Users/kgh/.nvm/versions/node/v16.13.0/bin/mermaid-filter:
Filter returned error status 1

  1. Support Staff 1 Posted by Brett on 12 Feb, 2022 07:27 PM

    Brett's Avatar

    I'm afraid I have no expertise at ALL with pandoc filters. I assume that the mermaid filter needs to write out an image/SVG file of some kind, and it's unable to do so because the environment isn't configured properly. Unfortunately, I don't know which environment variable it would be referencing.

    I know pandoc has some options like --data-dir that might allow you to specify a working directory within your user home somehow, but again, I have little experience with Pandoc filters.


Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:


Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac