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

Support for Mermaid.js in kaleido #177

Open
wants to merge 33 commits into
base: master
Choose a base branch
from
Open

Conversation

coma007
Copy link

@coma007 coma007 commented Apr 11, 2024

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:

  • Added all the necessary files for scope pipeline (read official documentation for more).
  • Added support for <script type="module"> tags in repos\kaleido\cc\kaleido.cc. This can be used when scope is delivered via esm.
  • Moved js methods such as is-non-empty-string and is-positive-numeric to utils so that it can be used by any scope.

What needs to be done:

  • Add support for different versions of mermaid cdn. See Mermaid's changelog.
  • Add support for different image formats. For now, only svg format is available.

coma007 and others added 30 commits March 27, 2024 19:17
Fixed python command in linux script from python to python3
Added all the necessary scope files and connected the pipeline for mermaid scope.
Moved check for module scripts from kaleido.cc to utils.h
This will be added while supporting different image formats.
Support for Mermaid.js in kaleido
Request validation & custom diagram config
@ayjayt
Copy link
Collaborator

ayjayt commented Apr 22, 2024

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
Copy link
Author

coma007 commented Apr 23, 2024

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
Copy link
Collaborator

ayjayt commented Apr 23, 2024 via email

@gvwilson gvwilson self-assigned this Jul 26, 2024
@gvwilson gvwilson removed their assignment Aug 3, 2024
@gvwilson gvwilson added feature something new community community contribution P3 not needed for current cycle labels Aug 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
community community contribution feature something new P3 not needed for current cycle
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants