asciidoctor / docker-asciidoctor

:ship: A Docker image for using the Asciidoctor toolchain to process AsciiDoc content
https://hub.docker.com/r/asciidoctor/docker-asciidoctor/
Other
321 stars 151 forks source link

Could not find the 'mermaid' exeutable in PATH #109

Open klemmchr opened 4 years ago

klemmchr commented 4 years ago

I'm using the latest version of the image and wanted to include a mermaid diagram into my pdf. If I create a new pdf using this input

[mermaid]
....
sequenceDiagram
    Alice->John: Hello John, how are you?
    loop Reply every minute
        John-->Alice: Great!
    end
....

and this command

asciidoctor-pdf -r asciidoctor-diagram [...]

the error Could not find the 'mermaid' exeutable in PATH will be printed to the final document and no diagram is generated. Instead it's displayed as source code.

davinkevin commented 4 years ago

I don't see mermaid-cli inside the Dockerfile declaration, so I think this image doesn't support it for now.

I will need mermaid too for a project, so I think I will create an image derivated from this one with the mermaid plugin installed (node and so on too...).

juracy commented 4 years ago

I've started to implement nodejs support on it, but I've realized mermaid-cli needs puppeteer and therefore chromium, what is a huge increase on docker image size... So I'm in doubt about change this image or create a fork... @dduportal what do you think?

juracy commented 4 years ago

@dduportal what do you think about increase size of container for supporting mermaid? (nodejs, puppeteer, chromium and so on?

dduportal commented 4 years ago

Hello there, thank for your patience with the delays in answers, sorry for that.

Given the upcoming changes that will take place in #79 (splitting in 2 images: a really light one as "base" and a "kitchen sink" with eveytrhing inside), it could make sense.

However, let's first check the size increase: how much does it add?

dduportal commented 4 years ago

As a "quick test" (but I'm not 100 % sure if it is working with any PDF example):

Adding the following code in the Dockerfile:

## Install Mermaid CLI (along with pupeeter and Chromium)
RUN apk add --no-cache npm \
  && cd /root \
  && npm install mermaid.cli

ENV PATH="${PATH}:/root/node_modules/.bin"

increased the image size almost by 2:

docker image ls | grep ascii    
asciidoctor/docker-asciidoctor   feature-mermaid           1d6c4240e561        5 seconds ago       827MB
asciidoctor/docker-asciidoctor   enhancement-alpine-3.11   fa099c425cad        19 minutes ago      428MB

I understand the need for mermaid, but it looks like these additional ~ 400 Mb will be a heavy penance for other users.

WDYT if we decline the upcoming asciidoctor/box image (that will replace the current asciidoctor/docker-asciidoctor with a "PDF exporter" variant (with chromium, pupeeter, ghostscript, etc.) ?

juracy commented 4 years ago

Well, let's wait for decision about asciidoctor/box, I like the idea of a big foot version (all-in-one) apart from a lighter one (suitable for most users).

Xendar commented 3 years ago

Any update on this one? I'm generating asciidoc with Asciidoctor and Mermaid through Gradle and the Gradle Node plugin (to install via npm Mermaid) and as NPM is not in the image it fails (which seems expected)

CWempe commented 3 years ago

Any news on this?

I tried this image:

FROM cwempe/docker-asciidoctor:ghostscript

RUN  apk -U upgrade \
     && apk add --no-cache npm\
     && cd /root \
     && npm install mermaid.cli

ENV PATH="${PATH}:/root/node_modules/.bin"

But I get the following error:

asciidoctor: ERROR: images/diagrams/Profile_und_Tags.mmd: line 0: Failed to generate image: mmdc failed: /root/node_modules/puppeteer/lib/Launcher.js:348
      reject(new Error([
             ^
Error: Failed to launch chrome! spawn /root/node_modules/puppeteer/.local-chromium/linux-686378/chrome-linux/chrome ENOENT
TROUBLESHOOTING: https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md
    at onClose (/root/node_modules/puppeteer/lib/Launcher.js:348:14)
    at ChildProcess.<anonymous> (/root/node_modules/puppeteer/lib/Launcher.js:339:64)
    at ChildProcess.emit (events.js:315:20)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
    at onErrorNT (internal/child_process.js:465:16)
    at processTicksAndRejections (internal/process/task_queues.js:80:21)

Well, let's wait for decision about asciidoctor/box, I like the idea of a big foot version (all-in-one) apart from a lighter one (suitable for most users).

I am voting for a complete "PDF exporter"-Image, too. 👍

lfvjimisola commented 1 year ago

@mojavelinux Any ideas on this?

mojavelinux commented 1 year ago

I'm not the maintainer of this project.

lfvjimisola commented 1 year ago

I'm not the maintainer of this project.

Ok. Do you have an idea of who is? @dduportal ?

@dduportal This issue is almost 3 years old and it gives a bad first experience with AsciiDoctor when you try to use mermaid and the docs states

This Docker image provides:

Asciidoctor 2.0.17

Asciidoctor Diagram 2.2.1 with ERD and Graphviz integration (supports plantuml and graphiz diagrams)

but you get

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

unless my colleague is doing something wrong. He got as far as the the chrome/puppeteer error above.

mojavelinux commented 1 year ago

This issue is almost 3 years old

Given this is an open source project, the contract is that the maintainer(s) work on it when time and interest permits. If this issue is important to you, then you can investigate the problem and submit a fix for it. The age of an issue has no bearing on when an issue will be fixed. It will be fixed when someone is interested in fixing it.

I'm sorry if this problem gives a bad experience for some new users, but pinging people to demand that they fix it is not the way to go about getting it solved. Open source is fueled by people who are willing to put in the effort to solve the problem collaboratively. If you need to talk to someone about how to participate in that way, please ask in the project chat at https://chat.asciidoctor.org.

lfvjimisola commented 1 year ago

I'm not expecting it to be fixed by maintainer(s) and I did not write that. If that is the way it was interpreted then I can only apologize.

In this particular case it seems as it should work according to the documentation but it does not. It is a bug or is the documentation wrong?

Our team are providing PRs whenever we can to various projects (e.g. currently working on a Jinja2 Template for OpenAPI JSON Spec File to AsciiDoc). But, sometimes you need help with/contact from the maintainer to know what the right way is to go e.g. build on this container or create an extended one, also if someone has an idea about the error messages. My colleague is working on it but he might need some help. I'll direct him to the chat. Thanks.

mojavelinux commented 1 year ago

I think we're on the same page now. Thanks for the follow-up. In the future, just understand the @ mentioning people out of the blue is often interpreted as demanding attention. I'll keep an eye out for your colleague in that chat and do my best to provide helpful resources.

it should work according to the documentation but it does not.

I'd like to challenge this point. The documentation states: Asciidoctor Diagram 2.2.1 with ERD and Graphviz integration (supports plantuml and graphiz diagrams). I don't see "mermaid" written there. It's also no where in this file: https://github.com/asciidoctor/docker-asciidoctor/blob/main/Dockerfile. That would tell me not to expect it. Thus, it's not a bug. It's just hasn't yet been added, perhaps for good reason (or perhaps just because no one added it).

Update: If we look at the comments above, we find the reason why it has not been added:

I understand the need for mermaid, but it looks like these additional ~ 400 Mb will be a heavy penance for other users.

dduportal commented 1 year ago

maintainer here: I'm going to check this in the upcoming days, but @mojavelinux summarized it very well!

@lfvjimisola if you/your colleague can spend some time on this, it is worth the effort to check the current size change of adding mermaid: it was 400mb addition layer, maybe it's better now.

@lfvjimisola also, you can already help by proposing a documentation update that would:

I'm late though, to implement the long due proposale I made years ago for different images: "ascidoctor" with nothing but adoc root projects, "slim" which would be the current one (minus some elements) and a "community" that would weight 1-2 Gb but would have tols such as mermaid.

lfvelias commented 1 year ago

Hello,

FYI I'm the colleague of @lfvjimisola and I've now got some tips/feedback from mojavelinux in the project chat.

lfvjimisola commented 1 year ago

I think we're on the same page now. Thanks for the follow-up. In the future, just understand the @ mentioning people out of the blue is often interpreted as demanding attention. I'll keep an eye out for your colleague in that chat and do my best to provide helpful resources.

I'll take that with me regarding the @.

it should work according to the documentation but it does not.

I'd like to challenge this point. The documentation states: Asciidoctor Diagram 2.2.1 with ERD and Graphviz integration (supports plantuml and graphiz diagrams). I don't see "mermaid" written there. It's also no where in this file: https://github.com/asciidoctor/docker-asciidoctor/blob/main/Dockerfile. That would tell me not to expect it. Thus, it's not a bug. It's just hasn't yet been added, perhaps for good reason (or perhaps just because no one added it).

No, you're correct but AsciiDoctor Diagram includes e.g. mermaid. It's easy to interpret it as "AsciiDoctor Diagram with additional support for..." So, perhaps it could be clearer, e.g.:

Asciidoctor Diagram 2.2.1 with ERD and Graphviz integration (only supports plantuml and graphiz diagrams)

Update: If we look at the comments above, we find the reason why it has not been added:

I understand the need for mermaid, but it looks like these additional ~ 400 Mb will be a heavy penance for other users.

Yes, agreed and also the reason why I wrote "know what the right way is to go e.g. build on this container or create an extended one" above.

lfvjimisola commented 1 year ago

@lfvjimisola if you/your colleague can spend some time on this, it is worth the effort to check the current size change of adding mermaid: it was 400mb addition layer, maybe it's better now.

He is the chat now and working on it. Thanks.

@lfvjimisola also, you can already help by proposing a documentation update that would:

  • Mention that Mermaid is not supported today out of the box
  • Steps to install mermaid by providing 2 solutions:

    • Dockerfile example to extend the image with mermaid
    • A command line to run inside the current container, that would (temporarly) install mermaid in the running container

I can file an issue/PR regarding the documentation about mermaid missing. Are there other things in AsciiDoctor Diagrams that don't work that you know of? Is it even so that only "ERD and Graphviz integration (plantuml and graphiz diagrams)" works?

I'm late though, to implement the long due proposale I made years ago for different images: "ascidoctor" with nothing but adoc root projects, "slim" which would be the current one (minus some elements) and a "community" that would weight 1-2 Gb but would have tols such as mermaid.

I think that is the way to go. asciidoctor-community would be able to build on the slim version then.

mojavelinux commented 1 year ago

only supports plantuml and graphiz diagrams

I like the idea that the statement is very clear about what is included. Asciidoctor Diagram supports a lot of integrations, but each one requires external tools. The image provides a selection of those tools.

mojavelinux commented 1 year ago

I can file an issue/PR regarding the documentation about mermaid missing. Are there other things in AsciiDoctor Diagrams that don't work that you know of?

I think it's best to look it from the other perspective. The README should state which external tools are included and state that if it isn't mentioned, then it isn't there.

mojavelinux commented 1 year ago

I was thinking that it might also be useful for the README to show a brief example of how to extend the converter. We could even consider using this particular use case as the example. That knocks out two tasks at once. And sorry that I missed this suggestion in your earlier post:

know what the right way is to go e.g. build on this container or create an extended one

I'm in agreement, at least until the effort for an "all-in-one" container materializes.

I'm happy to help update and/or review the changes to the README. I'll watch for a PR and chime with my feedback. It's always best to send a PR early to get help, so don't worry if it isn't exactly how you want it to be yet.

everflux commented 1 year ago

As a regular (happy) user, I would love to have the option of a prebuild image containing mermaid support.

It seems that the idea was to land mermaid in https://hub.docker.com/r/asciidoctor/box - that image was not updated for two years :(

I can understand the reason to not include a huge dependency by default, it would be really nice to have different image flavor including mermaid to choose, though.

dduportal commented 1 year ago

It seems that the idea was to land mermaid in https://hub.docker.com/r/asciidoctor/box - that image was not updated for two years :(

Thanks for your testimony!

As a maintainer, I'm seeking help to bootstrap the box project (missing time): if anyone is willing to contribute, I can help but I do not have the bandwidth to do it alone.

barthel commented 1 year ago

If there is still a need, I have created a multi-platform Docker image for Ascciidoctor that also has mermaid pre-installed:

github Project: https://github.com/barthel/docker-asciidoctor Docker Hub project: https://hub.docker.com/r/uwebarthel/asciidoctor

danmack commented 3 months ago

Pretty much agree that it's too bad we don't have an official Dockerfile that supports mermaid and agree that the 400mb increase is pretty substantial and maybe not worth it. It would be neat to use deno or bun to build just a static mmdc binary (instead of having to download the world with npm) But, deno cannot build natively on alpine because librustyv8 I think wont build (even though its a rust program using cargo). sigh. Thanks for the efforts.

jcouton commented 3 months ago

Hello, You can use Kroki to generate Mermaid diagrams. It's there out of the box.

asciidoctor-revealjs -r asciidoctor-kroki index.adoc