multiline input for mermiad.js graphs
wlandau opened this issue · comments
Would it be possible to allow multiline input for mermaid.js graphs? I find it convenient to keep a mermaid.js
graph as a character vector of lines:
graph <- c(
"graph LR",
" subgraph Legend",
" outdated([Outdated]):::outdated --- stem([Stem]):::none",
" stem([Stem]):::none --- function>Function]:::none",
" end",
" subgraph Graph", " g>g]:::outdated --> f>f]:::outdated",
" y1([y1]):::outdated --> z([z]):::outdated",
" y2([y2]):::outdated --> z([z]):::outdated",
" f>f]:::outdated --> y1([y1]):::outdated",
" end",
" classDef outdated stroke:#000000,color:#000000,fill:#78B7C5;",
" classDef none stroke:#000000,color:#000000,fill:#94a4ac;",
" linkStyle 0 stroke-width:0px;",
" linkStyle 1 stroke-width:0px;"
)
After installing 91059fd and then updating mermaid.js
using #421 (comment), I can generate the desired graph if I paste the lines together.
DiagrammeR::mermaid(paste0(graph, collapse = "\n"))
But if I do not paste the lines, I see this:
Mermaid graphs have been great for targets
: ropensci/targets#802