quarto-dev / quarto

Quarto open-source scientific and technical publishing system
https://quarto.org
GNU Affero General Public License v3.0
280 stars 19 forks source link

Quarto should support JupyterLab syntax for Mermaid charts #445

Closed stefansimik closed 1 month ago

stefansimik commented 1 month ago

Problem is, that this code works in JupyterLab flawlessly and immediately renders chart:

```mermaid
flowchart LR
  A[Hard edge] --> B(Round edge)
  B --> C{Decision}
  C --> D[Result one]
  C --> E[Result two]
```
flowchart LR
  A[Hard edge] --> B(Round edge)
  B --> C{Decision}
  C --> D[Result one]
  C --> E[Result two]

but to make it usable with Quarto rendering, we have to wrap "mermaid" into curly brackets , which completely breaks functionality in JupyterLab and it works only during Quarto rendering.

```{mermaid}
flowchart LR
  A[Hard edge] --> B(Round edge)
  B --> C{Decision}
  C --> D[Result one]
  C --> E[Result two]
```

Expected fix

  1. We should keep basic compatibility with Jupyter - so we can write classic supported Mermaid charts in JupyterLab (= without curly brackets) and still be rendered nicely using Quarto rendering.
  2. The same problem will probably apply to Graphviz charts.
cscheid commented 1 month ago

Thanks for the suggestion, but we're not going to do that. We already have notation for it.

cderv commented 1 month ago

flawlessly and immediately renders chart

@stefansimik just curious: is this the missing piece ?

Are you using the Quarto Extension for Jupyter Lab already ? https://quarto.org/docs/tools/jupyter-lab.html

I am mentioning this because, with this extension, the mermaid cells will also be rendered live in Jupyter Lab when using the Quarto syntax. chrome_4F61Aiqesb This document can then be previewed and rendered using Quarto to any of the supported output formats.

Maybe this helps.

stefansimik commented 1 month ago

Thank you @cderv I haven't tried yet JupyterLab extension for Quarto, but going to do so immediately. Looks like an elegant solution, that I was looking for 👍

PS: I tested it and it works flawlessly. Love you for letting me know ❤️

cderv commented 1 month ago

I tested it and it works flawlessly. Love you for letting me know ❤️

Awesome !