mermaid-server icon indicating copy to clipboard operation
mermaid-server copied to clipboard

Updated Mermaid CLI to latest

Open diraneyya opened this issue 9 months ago • 2 comments

The code can now be run using make run which would install the mermaid-cli using npm and create the in/out directories. It also passes the path for the provided puppeteer configuration file.

diraneyya avatar Mar 22 '25 09:03 diraneyya

Hey @diraneyya,

Thanks for raising this PR! Very much appreciated.

I'm fully onboard with updating mermaid cli to the latest version, however it looks like this PR contains some changes to run the API locally outside of the docker image.

While that's fine in general it's not the aim:

Go implementation of a HTTP server to allow remote generation of mermaid-js diagrams without any pre-requisites installed locally.

If you have to install everything to run it locally, is there any benefit to using mermaid-server over mermaid cli?

It also looks like I have to do some maintenance to get tests passing - I haven't touched this repo in a while. I won't block the PR on that.

TomWright avatar Mar 24 '25 14:03 TomWright

Hello Tom. I identified your work as the best way currently to add Mermaid diagrams into Jupyter notebooks. Using this server locally (without Docker) was the most efficient and least disk space way for me to run a Mermaid server locally.

The advantage that your work offers over mermaid.ink is that it is not a full-fledged web application and only uses the CLI to render the diagrams. The size of the node_modules in this case is 25MB compared to 300MB.

Ideally, I would envision this project to use a globally installed CLI npm module to reduce it to a Golang binary, which surely can also be shipped via Docker. Having the CLI inside of the Docker image implies having the NodeJS runtime inside of Docker which is wasteful for folks like me with Node version managers who do not want to continue to pay a heavy disk space price for every new tool we use.

Obviously there is a lot of different directions in which this project can go but for my use case I would like it to:

  • Exclude the CLI from the package, or offer flexibility in terms of how to install it
  • Allow the tool to be ran either via Docker or without Docker as long as the NodeJS runtime is not shipped within the container to allow running the Mermaid CLI

Basically it is just offering a REST API for rendering Mermaid diagrams, which is what we currently need for rendering Mermaid in Jupyter notebooks.

I am well aware that this might not be the trajectory it is on or the direction you want for it. But I have done what worked for my use case and wanted to share it with you anyways.

Thank you for your work.

diraneyya avatar Mar 25 '25 12:03 diraneyya