GithubHelp home page GithubHelp logo

Comments (6)

tylerlong avatar tylerlong commented on June 14, 2024

I think it'd be neat to programmatically use mermaid, in node. Maybe call it "mermaid-serverside".

The idea of mermaid-serverside is cool. However, mermaid currently cannot work without a browser (either a normal browser or a headless browser such as puppeteer). So mermaid could not be a pure node.js library (which doesn't depend on browsers)

I'd like to make an img-url parser, so you can inline the source of the graph in the URL and get an image.

We have something similar: https://mermaidjs.github.io/mermaid-live-editor/#/view/Z3JhcGggVEQKQVtDaHJpc3RtYXNdIC0tPnxHZXQgbW9uZXl8IEIoR28gc2hvcHBpbmcpCkIgLS0-IEN7TGV0IG1lIHRoaW5rfQpDIC0tPnxPbmV8IERbTGFwdG9wXQpDIC0tPnxUd298IEVbaVBob25lXQpDIC0tPnxUaHJlZXwgRltDYXJdCg

It would also mean that I can pre-render graphs, so there is no flash of graph-source on pages (I made a gatsby plugin, for example, that has some hacks to make it work browser-only, but I'd prefer they were pre-built.)

As I said above, pre-render without a browser is currently impossible. But if you know how to make it possible, that would be super great! I used to try jsdom but failed.

If we had this, it'd be really simple to just wrap the CLI around that bit. If there is interest, I'd be happy to write it, and make a PR for this project to use the lib.

I don't know if this is helpful. Because this library needs a browser to work. So there is no pre-render in memory only. And it is not a pure node library which doesn't depend on browsers.

Please feel free to post more comments. I will leave this issue open for now.

from mermaid.cli.

konsumer avatar konsumer commented on June 14, 2024

We have something similar:

That's cool, but I meant like this, with source inline in image-link, so you can use it directly:

image

As I said above, pre-render without a browser is currently impossible

Yeh, I get that, but I mean in the same way you use puppeteer to create a chrome-headless client, render it, and return it. I dunno, maybe it makes no sense to integrate with this. The CLI is pretty light, maybe I should just make a separate library that works the same way, based on your great work. At some point, if I get a wild hair, maybe I'll do some realy node-space rendering though, as mermaid uses d3, and there is a node d3.

from mermaid.cli.

tylerlong avatar tylerlong commented on June 14, 2024

It will be super cool if you can make mermaid a pure node.js library. Actually I think it is possible, just more investigation is needed.

from mermaid.cli.

konsumer avatar konsumer commented on June 14, 2024

Yep, totally agreed. I think it's very close with node-d3, but in the interim, I could wrap puppeteer, as you have, to make a server-side renderer (which was my original thought.)

If I have some time, I will investigate this week, and see what it would take to make it render in node-d3. If nothing else, it'd give us a list to work through for things needed to support that.

from mermaid.cli.

rhinenoir avatar rhinenoir commented on June 14, 2024

@konsumer If you dont mind, Any solution now?

Sent from my PRO 6 using FastHub

from mermaid.cli.

tylerlong avatar tylerlong commented on June 14, 2024

Please read this thread: mermaid-js/mermaid#559

I will close it for now.

from mermaid.cli.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.