-
-
Notifications
You must be signed in to change notification settings - Fork 94
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for Mermaid #465
Comments
This came up on Discord server some time ago (https://discord.com/channels/794537085641818124/1111980136691146773) but looks like it's not possible to run Mermaid on server side due mermaid-js/mermaid#3650. There are a couple of alternative options that you can use:
|
I found this article: https://css-tricks.com/making-mermaid-diagrams-in-markdown/ Mermaid has cdn. And It can be used in browser. I tested in this page: Although I can not find a way to generate SVG and link/embed the svg, but this currently works. |
Yes, the only way to run mermaid is in the browser. |
Any thoughts regarding this: |
Seems that it uses puppeteer for rendering. |
deno has puppeteer. So we may avoid npm and use puppeteer in deno. I will test it. |
Here is a quick code for running puppeteer in deno and getting all svg and save the svgs in a dir: |
Okay, thanks!
|
Read this: DOC I am not sure, but you may need to run this command: |
@alaminkouser ok, the problem was the execution permissions for the downloaded binary. I've been experimenting with puppeteer (Deno already supports the Node version which is more updated). There are some issues yet but it's a good start. |
Interesting. I will also try this. |
I was able to render mermaid on server side with the Astral experimental plugin: It runs the javascript code on server side and save the generated HTML code. For example, this page https://github.com/lumeland/experimental-plugins/blob/main/astral/demo/page.vto#L24-L28
|
Amazing! Next week I will try this. It can be powerful and faster. Now generated websites can be without/less JS codes!!! |
It is downloading chrome. It may not use puppeteer, but uses chrome in server side.
|
Yes, it doesn't use puppeteer, but astral https://github.com/lino-levan/astral which is like Puppeteer but for Deno (Puppeteer doesn't work in Deno). For now, the plugin is just a POC and there are some limitations (for example, it only can load assets from external urls). But for this specific use case it works pretty well. |
Only downside being it uses chrome. So cicd will be slow. But seems stable. |
I didn't play much with the library, but seems that Firefox is also supported. If no browser is specified, it downloads chrome automatically. |
Discussion for anyone interested: What makes mermaid.js cannot work on server-side, while other visualization libs can? |
FYI I made a plugin to inject Mermaid script at the front end: https://github.com/ooker777/lume-mermaid-plugin |
To add to the list of options, I've created a Kroki plugin for Lume which converts codeblocks containing diagram descriptions into an The images are rendered by a Kroki server. By default, the plugin uses the official instance at https://kroki.io, but can be configured to use a self-hosted instance. |
Enter your suggestions in details:
Mermaid
The text was updated successfully, but these errors were encountered: