rich-iannone / DiagrammeR

Graph and network visualization using tabular data in R
https://rich-iannone.github.io/DiagrammeR/
Other
1.68k stars 247 forks source link

.mmd file read and preview #481

Open yfu-caredx opened 1 year ago

yfu-caredx commented 1 year ago

it seems mermaid() function is unable to supporting reading from a file name, instead it shows "syntax error". subsequently, the .mmd file preview function in RStudio is also broken as it basically calls the mermaid() function to preview. I tested a simple example and it works fine as a string input to mermaid(), but when I saved it as .mmd file and use the filename as input to the function, the syntax error occurs.

retodomax commented 1 year ago

Same problem for me (with DiagrammeR version 1.0.9)

Here a reproducible example

my_diag <- "graph LR
    A-->B
    A-->C"
DiagrammeR::DiagrammeR(my_diag) ## works as expected
write(my_diag, file = "test.mmd")
DiagrammeR::mermaid("test.mmd") ## does not work