mwouts / jupytext

Jupyter Notebooks as Markdown Documents, Julia, Python or R scripts
https://jupytext.readthedocs.io
MIT License
6.65k stars 386 forks source link

mermaid.js scripts in ipynb markdown #1072

Open psychemedia opened 1 year ago

psychemedia commented 1 year ago

A heads up regarding a PR in JupyterLab, and associated JEP request that introduces support for rendering mermaid.js diagrams for diagrams described using the GFM syntax:

```mermaid
flowchart LR
  chicken --> egg --> chicken

In `.qmd` and `.myst` the corresponding syntax is:
flowchart LR
  chicken --> egg --> chicken


Comments to the JupyterLab PR hint that support for additional diagram types, presumably using a similar syntactic approach, are possible.
mwouts commented 1 year ago

Hey @psychemedia , thanks for the links!

Are you suggesting that we should do the translation from

```mermaid

in ipynb documents, to

```{mermaid}

in .qmd or .myst ? or should we plan something other than this?

psychemedia commented 1 year ago

It was more of a heads up that the diagram scripts are being added to ipynb/gfm markdown using one form of syntax, and qmd and myst use another.

It's going to be confusing, I think, for ipynb docs. Eg if you author ipynb docs with the JuptyerLab MSTt extension you would presumably use MyST syntax, but if you are in a vanilla JupyterLab environment, the syntax will be GLF flavoured.

Converting to qmd, MyST should be easy enough, but returning to ipynb may depend on the user. Does ipynb use metadata to say whether someone has been using MyST or GFM (default), for example, in markdown cells?