Skip to content
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

multiline input for mermiad.js graphs #464

Open
wlandau opened this issue Mar 16, 2022 · 0 comments
Open

multiline input for mermiad.js graphs #464

wlandau opened this issue Mar 16, 2022 · 0 comments

Comments

@wlandau
Copy link

wlandau commented Mar 16, 2022

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"))

Screen Shot 2022-03-15 at 10 16 22 PM

But if I do not paste the lines, I see this:

Screen Shot 2022-03-15 at 10 16 36 PM

Mermaid graphs have been great for targets: ropensci/targets#802

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant