I have a rmarkdown presentation (ioslides) with 3 slides with flow diagrams worked in DiagrammeR
's mermaid. The following file saved as .Rmd can reproduce the example (at least in my machine, hopefully yours too):
---
title: "Untitled"
author: "author"
date: "28 de enero de 2018"
output: ioslides_presentation
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = FALSE)
require(DiagrammeR)
```
## DiagrammeR's mermaid
It's not producing consistent results in slides when using line breaks.
```{r flow}
mermaid("
graph LR
C(CLIENTES <br>Clients) --> D[Doctors]
U(USUARIOS <br>Users <br>Patients <br>Nurses) --> D
D --> S(SALIDAS <br>Medicines <br>Surgery)
style C fill: #f5f5dc
style D fill: #4682b4
style U fill: #ffe4c4
")
```
## Second attempt
```{r flow2}
mermaid("
graph LR
C(CLIENTES <br>Clients) --> D[Doctors]
U(USUARIOS <br>Users <br>Patients <br>Nurses) --> D
D --> S(SALIDAS <br>Medicines <br>Surgery)
")
```
## Third attempt
```{r flow3}
mermaid("
graph LR
C(CLIENTES <br>Clients) --> D[Doctors]
U(USUARIOS <br>Users <br>Patients <br>Nurses) --> D
D --> S(SALIDAS <br>Medicines <br>Surgery)
style C fill: #f5f5dc
style D fill: #4682b4
style U fill: #ffe4c4
")
```
When run, it produces two normal-sized diagrams and a small one. Things I've noticed:
- The last chunk that gets modified (text entered or deleted, even carriage returns), gets properly displayed (if I "touch" the tree of them, normally the first one displays wrong)
cache = FALSE
orcache = TRUE
don't make a difference- Adding line breaks (additional) between lines of the mermaid declaration don't work (suggested as a solution here)
- Inserting or removing the styling declarations don't make a difference
- Browser used doesn't make a difference (initially viewed with RStudio browser, but if seen in firefox the display is similarly wrong)
- When presentation output
ioslides
is changed toslidy
, it works (that's my alternative, but I'd rather prefer ioslides if there's a solution).
Relevant parts or R.Version
and Sys.info
:
> Sys.info()
sysname
"Linux"
release
"4.9.0-5-amd64"
version
"#1 SMP Debian 4.9.65-3+deb9u2 (2018-01-04)"
nodename
"pavos"
machine
"x86_64"
## R and packages Versions
> R.Version()
$`svn rev`
[1] "73796"
$version.string
[1] "R version 3.4.3 (2017-11-30)"
$nickname
[1] "Kite-Eating Tree"
> packageVersion("DiagrammeR")
[1] ‘0.9.2’
> packageVersion("rmarkdown")
[1] ‘1.8’
What I expect: a consistently displayed presentation with fully sized and properly colored diagrams in all slides in ioslides output.
Thanks