asciidoctor / asciidoctor-diagram

:left_right_arrow: Asciidoctor diagram extension, with support for AsciiToSVG, BlockDiag (BlockDiag, SeqDiag, ActDiag, NwDiag), Ditaa, Erd, GraphViz, Mermaid, Msc, PlantUML, Shaape, SvgBob, Syntrax, UMLet, Vega, Vega-Lite and WaveDrom.
http://asciidoctor.org
MIT License
442 stars 107 forks source link

mermaid: 'unknown option --phantomPath' #299

Closed andrewzah closed 4 years ago

andrewzah commented 4 years ago

I get this when trying to use asciidoctor-diagram (with Hugo) with @mermaid-js/mermaid-cli version 8.8.1:

Building sites … ERROR 2020/10/14 14:50:11 posts/2020/10-14_home_services.adoc: asciidoctor: ERROR: <stdin>: line 9: Failed to generate image: mmdc failed: error: unknown option
126 '--phantomPath'

Here are the current flags for mmdc:

 (25s) website/site $ ./node_modules/.bin/mmdc --help                                                                                                                       [master]
Usage: mmdc [options]

Options:
  -V, --version                                   output the version number
  -t, --theme [theme]                             Theme of the chart, could be default, forest, dark or neutral. Optional. Default: default (default: "default")
  -w, --width [width]                             Width of the page. Optional. Default: 800 (default: "800")
  -H, --height [height]                           Height of the page. Optional. Default: 600 (default: "600")
  -i, --input <input>                             Input mermaid file. Required.
  -o, --output [output]                           Output file. It should be either svg, png or pdf. Optional. Default: input + ".svg"
  -b, --backgroundColor [backgroundColor]         Background color. Example: transparent, red, '#F0F0F0'. Optional. Default: white
  -c, --configFile [configFile]                   JSON configuration file for mermaid. Optional
  -C, --cssFile [cssFile]                         CSS file for the page. Optional
  -s, --scale [scale]                             Puppeteer scale factor, default 1. Optional
  -f, --pdfFit                                    Scale PDF to fit chart
  -p --puppeteerConfigFile [puppeteerConfigFile]  JSON configuration file for puppeteer. Optional
  -h, --help
pepijnve commented 4 years ago

How are you specifying the path to mmdc? Using the mmdc attribute or mermaid? If you use the former it will trigger a code path that's meant for the legacy mermaid CLI.

andrewzah commented 4 years ago

I'm specifying it via asciidoctor's metadata:

# My Post
:mermaid: ./node_modules/.bin/mmdc

Should it not be mmdc?

pepijnve commented 4 years ago

The value should point to mmdc indeed. The attribute name should be mmdc too. In other words give this a try:

# My Post
:mmdc: ./node_modules/.bin/mmdc
andrewzah commented 4 years ago

That did it! Thank you.