-
-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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
server side mermaid with jsdom #559
Comments
is there any progress? I'm trying to do server side rendering of mermaid, but just like you said, puppeteer is too heavyweight. I just tried to use mermaid with JSDOM, but it failed by negative width like |
It seems to be impossible. Mostly because jsdom doesn't do text font rendering so we cannot measure the width and height of text nodes. Without these information it is impossible to layout the diagrams properly. |
I'm not sure if |
@dead-horse maybe mathjax use pre-defined font family, so it could know the width and height of text without rendering? Update: I think I am correct: https://github.com/mathjax/MathJax-node/blob/89d1e0af912eb2666592195a555f9edaa325f1e5/lib/main.js#L315-L320 But mermaid allow customization font family using CSS, and different font family has different text size. |
Removed my comment on SVG option, since it referenced an also edited comment ;-) |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Has anyone managed to server-render mermaid without puppeteer ? |
So stop allowing font-family and font-size to be controlled by the user. There's no need for it. Once SVG has been rendered they can scale that if they don't like the font size. |
Here is an interesting example for D3 to work together with jsdom:
https://bl.ocks.org/tomgp/c99a699587b5c5465228
PhantomJS is heavyweight. And it is discontinued: http://carstenwindler.de/software-testing/phantomjs-is-discontinued/
Chrome headless sounds promising but it's heavyweight too. It required the installation of Chrome browser.
I think it is best if we could make mermaid work with jsdom. It is lightweight(compared to PhantomJS and Chrome headless). And it works with Node.js out of the box.
The text was updated successfully, but these errors were encountered: