Skip to content
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

Why does Mermaid CLI require a browser for image generation? #750

Open
JockeM opened this issue Sep 22, 2024 · 1 comment
Open

Why does Mermaid CLI require a browser for image generation? #750

JockeM opened this issue Sep 22, 2024 · 1 comment
Labels
blocked This issue/PR is blocked by another issue/PR (potentially in a different project) enhancement New feature or request

Comments

@JockeM
Copy link

JockeM commented Sep 22, 2024

I was surprised to encounter an error running the Mermaid CLI, stating that I need a browser to generate an image. I’m wondering why this is necessary. For a CLI tool, it feels counterintuitive to rely on a browser for something like image generation.

Is there a technical reason for this? I’d prefer the tool not require a browser at all. Are there any plans to make this dependency optional or to provide a pure Node.js solution for generating images without a browser?

I’d appreciate any insights or future plans around this.

Thanks!

@aloisklink
Copy link
Member

Unfortunately, Mermaid requires a CSS layout engine to correctly calculate the width/heights of boxes, and there doesn't seem to yet be a pure Node.JS/WASM solution for this. Only browsers have it:

Once that's done, the mermaid-cli project shouldn't need a browser to render an SVG, but we might still need one for SVG to PNG/PDF conversion. Although, we could make a separate library called something like mermaid-cli-svg so that most users can use just that instead, if they don't want a browser.

@aloisklink aloisklink added blocked This issue/PR is blocked by another issue/PR (potentially in a different project) enhancement New feature or request labels Sep 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked This issue/PR is blocked by another issue/PR (potentially in a different project) enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants