Closed SilentButeo2 closed 2 years ago
Mermaid supports generating PNG files. So you can set the output format for the diagram on the diagram block. See https://docs.asciidoctor.org/diagram-extension/latest/#creating-a-diagram
Yes, I found that also after I added this issue. And trying to get it working, but I get (on Windows!):
asciidoctor-pdf -v -r asciidoctor-diagram -o test.pdf test.adoc
asciidoctor: DEBUG: Finding 'mmdc' in attributes
asciidoctor: DEBUG: Finding 'mmdc' in environment
asciidoctor: DEBUG: Finding 'mermaid' in attributes
asciidoctor: DEBUG: Finding 'mermaid' in environment
asciidoctor: ERROR: test.adoc: line 35: Failed to generate image: Could not find the 'mmdc' executable in PATH; add it to the PATH or specify its location using the 'mmdc' document attribute
If I
gem list --local
I actually see
asciidoctor-diagram (2.1.2)
But mmdc is not found.
Please see https://docs.asciidoctor.org/diagram-extension/latest/#specifying-diagram-generator-paths. If mmdc is not on your PATH (as the error indicates), you need to specify the path to mmdc so that Asciidoctor Diagram can find it.
-a mmdc=c:/path/to/mmdc
Ok, installed mermaid with npm but asccidoctor doesn't seem to see the mmdc file as an executable?
M:\software\docs>asciidoctor-pdf -v -r asciidoctor-diagram -a mmdc=m:/software/tools/node_modules/.bin/mmdc -o test.pdf test.adoc
asciidoctor: DEBUG: Finding 'mmdc' in attributes
asciidoctor: DEBUG: Found value 'm:/software/tools/node_modules/.bin/mmdc' in attribute 'mmdc'
asciidoctor: DEBUG: Is 'm:/software/tools/node_modules/.bin/mmdc' executable? false
asciidoctor: DEBUG: Finding 'mmdc' in environment
asciidoctor: DEBUG: Finding 'mermaid' in attributes
asciidoctor: DEBUG: Finding 'mermaid' in environment
asciidoctor: ERROR: test.adoc: line 35: Failed to generate image: Could not find the 'mmdc' executable in PATH; add it to the PATH or specify its location using the 'mmdc' document attribute
M:\software\docs>m:\software\tools\node_modules\.bin\mmdc --version
0.5.1
Adding that .bin folder to the PATH fixes this. Seems that mmdc=... is broken?
But now it works.
Next I have to add the same stuff for [svgbob][wavedrom]
Please followup in the community chat at https://asciidoctor.zulipchat.com. It's better suited for these kinds of conversations.
If I understand it correctly, asciidoctor-pdf uses Asciidoctor Diagram to render some diagram images. Trying to make a simple mermaid diagram fails. As I understand, Asciidoctor Diagram will create a .svg that on his turn is converted by prawn-svg into a .png file. But that fails for mermaid generated .svg's (see mogest/prawn-svg#143).
Is it possible to use mermaid-cli directly, to create a .png file? I just did a quick test to see if the mermaid-cli creates a correct .png file, and it seems it does.
docker run -it -v c:\Testing:/data minlag/mermaid-cli -i /data/mermaid.mmd -o output.svg