-
-
Notifications
You must be signed in to change notification settings - Fork 6.7k
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 API in nodejs #1183
Comments
Mermaid relies on the browser to generate diagrams so you won’t be able to use it without browser. |
I pretty briefly dug into this because I was alarmed to find that |
I haven't tried it, but JsDOM ( https://github.com/jsdom/jsdom ) provides a fairly complete DOM API implementation for node.js without having to use the full browser stack including the renderer and CSS implementation (like puppeteer). So in its simplest form you could try to pass a JsDOM Edits: Issue #559 covers the discussion but was auto-closed by the bot due to inactivity. summary: JsDom does not work because the layout algorithm relies on letting the browser engine calculate the size of the elements. Since any custom CSS is supported and the layout is SVG, i.e. absolute pixels it looks the mermaid architecture is actually constrained to browser engines . |
Such a shame. I can't use this for server side rendering. I've tried the CLI that uses puppeteer and it seems hacky at best. Huge resource requirement and it freezes my machine. I'll have to stick with chartjs. |
Closing as wont fix |
Describe the solution you'd like
I see that mermaid provides API to operate on the browser side, but why similar API isn't provided in nodejs?
For example:
Many MD renderers will provide code blocks. We only need to render them into the SVG. Compared with introducting JS in the browser, this solution can improve the efficiency of page loading (after all, it has been processed in node )
The text was updated successfully, but these errors were encountered: