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

Integrate r variables in Mermaid Graph #483

Closed
TazDP opened this issue Mar 19, 2023 · 1 comment
Closed

Integrate r variables in Mermaid Graph #483

TazDP opened this issue Mar 19, 2023 · 1 comment

Comments

@TazDP
Copy link

TazDP commented Mar 19, 2023

Hello,

I've been pulling my hair out for this:

Is it possible to include r variables in a mermaid graph? Something like

my_var <- 10

library(DiagrammeR)

my_var <- 10

mermaid("
graph LR
    A-->B
    B[%%%my_var%%%]
")

If not, shall I initiate a pull request?

Thanks a lot!

@olivroy
Copy link
Collaborator

olivroy commented Nov 8, 2023

You can always use other existing ways. DiagrammeR could possibly support that natively, but in the meantime, I can suggest using glue that uses { and } to deliminate R objects.

my_var <- 10

mermaid(glue::glue("
graph LR
    A-->B
    B[{my_var}]
"))

If you want to use %%% as delimiters, you can use

mermaid(glue::glue("
graph LR
    A-->B
    B[%%%my_var%%%]
",
.open = "%%%",
.close = "%%%"))

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

3 participants