Mermaid diagram problem

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Mermaid diagram problem

rodwatkins
Hi all,

I've been trying to get mermaid diagrams working using the asciidoctor-diagram extension.

This is the code for the diagram I am trying to render:

[mermaid, "sample", png]
....
sequenceDiagram
A->> B: Query
B->> C: Forward query
Note right of C: Thinking...
C->> B: Response
B->> A: Forward response
....

When I render a file with that content using mermaid at the terminal, it generates a png correctly. But when I build my document using asciidoctor, mermaid throws this error:

Failed to generate image: C:\Users\...\Roaming\npm/mermaid.CMD failed: Num files to execute : 0

sequenceDiagram
A->> B: Query
B->> C: Forward query
Note right of C: Thinking...
C->> B: Response
B->> A: Forward response

Any help would be appreciated.

Cheers,
Rod

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Mermaid diagram problem

rodwatkins
I've investigated further. It appears to be a problem specific to windows machines. Yes,I know. I have a linux machine (where mermaid works just fine), but I'd also like to get it running on windows.

The problem appears to be that the diagram extension saves the generated image as a temp file that is then copied to the "imagesoutdir". Unfortunately, because of the way Ruby handles files on windows, the generated file is garbage collected (i.e, deleted) before it can be copied to the output folder. As a result, the conversion process fails. I am not versed enough in Ruby to understand how to correct this. One way or another, there must be a way for the generated png to kept long enough for the copy operation. Anyone have any ideas?

Cheers,
rod

Loading...