3

I'm trying to generate a quarto document in pdf (and word later). I'm meeting an issue with the mermaid graph. Please find bellow a sample .qmd file to illustrate the issue.

So first it's supposed to support the {mermaid} tag but when i do that, I can't "run" the cell in rstudio, but also my document doesn't actually generated and the "background jobs" in rstudio gets stuck on "output file: testmermaid.knit.md"

So I use DiagrammeR::mermaid to encapsulate this, then the document is indeed generated but the size is too small and if I resize the figure generated then it becomes all blurry. I made many attempts but none of them worked so if someone would have a simple solution where the diagram would go Xcm from the left to Ycm to the right, and be generated correctly in pdf and word?

EDIT:

After @Shafee's comment, I've noticed I didn't have the quarto package installed, I have now installed the latest R package quarto 1.0.36 and reinstalled RStudio (2022.07.1 build 554) for the sake of it, but the problem is unchanged.
I've also noticed my personal computer (same version of RStudio and quarto) doesn't have these issues (still can't run a mermaid chunk in Rstudio IDE though)

EDIT2:

after a full reinstall on the local hard drive (instead of windows network drive) I get this:
output file: testmermaid.knit.md
ERROR: Couldn't find open server

my version is now:

quarto::quarto_version() 1 ‘1.1.189’

mermaid diagram narrow

---
title: "TestMermaid"
format: pdf
---

```{r libimport}
library(quarto)
library(DiagrammeR)
knitr::opts_chunk$set(echo = F)
```


## Quarto

Quarto enables you to weave together content and executable code into a finished document. To learn more about Quarto see <https://quarto.org>.


Attempt #1

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

Attempt #2

```{r attempt2}
mermaid("
sequenceDiagram
  participant ParticipantA
  participant ParticipantB
  participant ParticipantC
  ParticipantA->>ParticipantB: I want something
  ParticipantB->>ParticipantC: he want something
  ParticipantC->>ParticipantB: here is something
  ParticipantB->>ParticipantA: he got something for you
  ", height = '100%', width = '100%')
```
Will
  • 910
  • 7
  • 17
  • Both of these attempts work fine for me. What's your quarto version? ( I am using version `‘1.0.38’`) – shafee Sep 07 '22 at 17:24
  • Hello Shafee, Thank you for your input. I'm adding details to the original post as it's too long for a comment, but it looks like a problem that doesn't get solved :( – Will Sep 08 '22 at 11:00
  • Well, you don't need to call the `{quarto}` r package in your case. And Can you add the quarto version (NOT the version of `{quarto}` r package, I am talking about the version of **quarto CLI**). To check the version of quarto you can run `quarto::quarto_version()`. – shafee Sep 08 '22 at 11:54
  • the 1.0.36 version I mentioned is the output of quarto::quarto_version() . Now I have installed the quarto CLI version v 1.1.189, the output of quarto::quarto_version() is still 1.0.36 but when i render I see now: output file: testmermaid.knit.md ERROR: Couldn't find open server – Will Sep 08 '22 at 12:15
  • as mentioned I've actually *reinstallled* RStudio (so I closed the app before reinstall) Anyway I have restarted and got an additional error message complaining about : Check file:///C:/[...]/puppeteer@9-0-2/mod.ts ERROR: Couldn't find open server now I have reinstalled quarto to the local drive instead of the network drive, created a clear quarto project and reused the same ref code. Now if I run quarto::quarto_version() I do get "1.1.189" but still the render doesn't work: "output file: testmermaid.knit.md ERROR: Couldn't find open server" – Will Sep 08 '22 at 15:22
  • 1
    Same problem here. I don't find a solution – Cmagelssen Oct 13 '22 at 06:43

1 Answers1

0

Your code executes as intended once the library(quarto) call is removed from line 7.

As per the documentation for Quarto figures. The size can be increase through the use of chunk options.

```{mermaid attempt1}
%%| fig-width: 6.5
%%| fig-cap: Fig 1. Test figure
flowchart LR
  A[Hard edge] --> B(Round edge)
  B --> C{Decision}
  C --> D[Result one]
  C --> E[Result two]
```
hisspott
  • 416
  • 6
  • 18