Skip to content

Diagrams are not rendering on pkgdown site #1497

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

Closed
JosiahParry opened this issue Feb 6, 2023 · 6 comments · Fixed by #1498
Closed

Diagrams are not rendering on pkgdown site #1497

JosiahParry opened this issue Feb 6, 2023 · 6 comments · Fixed by #1498

Comments

@JosiahParry
Copy link

Mermaid diagrams are not properly rendering on the pkgdown site.
Here is a screencap from https://tibble.tidyverse.org/articles/formats.html
image

@krlmlr
Copy link
Member

krlmlr commented Feb 16, 2023

@maelle: How can we make Mermaid work in pkgdown?

@maelle
Copy link
Contributor

maelle commented Feb 16, 2023

Related question: @krlmlr does this diagram work for you when you knit the vignette? It does not for me.

@maelle
Copy link
Contributor

maelle commented Feb 16, 2023

Interestingly DiagrammeR has a pkgdown website http://visualizers.co/diagrammer/ but no mermaid diagram sadly.

@maelle
Copy link
Contributor

maelle commented Feb 16, 2023

After experimenting a bit I discovered what works is using the Markdown of the diagram directly, I mean:

```{r echo = FALSE}
DiagrammeR::mermaid("graph TD
  Import --> Tidy
  Tidy --> Transform
  Transform --> Visualize
  Visualize --> Communicate
  Visualize --> Model
  Model -.-> Transform
")
```

image

I'm a bit surprised. I'm not sure whether this is pkgdown or DiagrammeR's doing however note I observe the same behavior (using the filename: the Markdown is printed in the doc; using the Markdown: the diagram appears) when knitting.

@maelle
Copy link
Contributor

maelle commented Feb 16, 2023

This works too:

```{r echo = FALSE}
text <- paste(
  readLines("r4ds.mmd"),
  collapse = "\n"
)
DiagrammeR::mermaid(text)
```

@krlmlr do you want me to make a PR with this "quick fix" or to investigate further/report to DiagrammeR?

@krlmlr
Copy link
Member

krlmlr commented Feb 16, 2023

Thanks. A quick fix is fine, we can even use something like

```{r echo = FALSE}
text <- "
<mermaid code>
"
DiagrammeR::mermaid(text)
```

@github-actions github-actions bot locked and limited conversation to collaborators Feb 21, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants