plotly / Kaleido

Fast static image export for web-based visualization libraries with zero dependencies
Other
348 stars 33 forks source link

Support for Mermaid.js in kaleido #177

Open coma007 opened 2 months ago

coma007 commented 2 months ago

Hi all,

I added new scope that would support the rendering of Mermaid graphing library. Here is an usage example:

from kaleido.scopes.mermaid import MermaidScope

scope = MermaidScope()

graphDefinition = """
    graph LR
    A --- B
    B-->C[fa:fa-ban forbidden]
    B-->D(fa:fa-spinner);
    """

data = scope.transform(graphDefinition, format="svg", config={"theme" : "default"})
with open("figure.svg", "wb") as f:
    f.write(data)

figure

Method scope.transform(markdown, **kwargs) accepts mermaid markdown and returns svg code in string bytes. Also, this method accepts custom configuration which is not mandatory.


What I did:

What needs to be done:

ayjayt commented 2 months ago

Hi! I'm trying to coordinate a rerelease of kaleido, I'm first working over the build system, updating the api, and moving it to modern version of chromium. Hoping to get buyin from plotly on CI.

What platform did you develop this on? Linux?

coma007 commented 2 months ago

Hi! I'm trying to coordinate a rerelease of kaleido, I'm first working over the build system, updating the api, and moving it to modern version of chromium. Hoping to get buyin from plotly on CI.

What platform did you develop this on? Linux?

Hi, yes, I used wsl Ubuntu for the build, because I had trouble building it on Windows. I've also tried the build on PopOS Linux on my machine and it worked. Good luck !

ayjayt commented 2 months ago

:-)

El mar, 23 de abr. de 2024 8:41 a. m., MilicaSladakovic < @.***> escribió:

Hi! I'm trying to coordinate a rerelease of kaleido, I'm first working over the build system, updating the api, and moving it to modern version of chromium. Hoping to get buyin from plotly on CI.

What platform did you develop this on? Linux?

Hi, yes, I used wsl Ubuntu for the build, because I had trouble building it on Windows. I've also tried the build on PopOS Linux on my machine and it worked. Good luck !

— Reply to this email directly, view it on GitHub https://github.com/plotly/Kaleido/pull/177#issuecomment-2072355176, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHHLRFMXXUJJXNG7VE66QQDY6ZQJPAVCNFSM6AAAAABGCBDD6KVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANZSGM2TKMJXGY . You are receiving this because you commented.Message ID: @.***>