This issue is in echo with issues #231, #227, #241, #294, #329, #363, #421, #470, #473 and maybe some others...
The need to update the version of mermaid.js embedded in the DiagrammeR package is pressing.
As suggested in #421, we can manually update the file /DiagrammeR/htmlwidgets/lib/mermaid/dist/mermaid.slim.min.js in the installation folder of the package with the last version downloaded from https://cdn.jsdelivr.net/npm/mermaid/dist/mermaid.min.js.
One way to always have the latest version of DiagrammeR in the package could be to add an updateMermaid function in the package:
#' Update the mermaid library in the package
#' @param version A [character] of the desired version (the latest by default)
#' @return See value returned by [download.file]
updateMermaid <- function(version = "") {
url <- "https://cdn.jsdelivr.net/npm/mermaid@version/dist/mermaid.min.js"
if (version != "") {
stopifnot(grepl("^[[:digit:]]+\\.[[:digit:]]+\\.[[:digit:]]+$", version))
version <- paste0("@", version)
}
url <- gsub("@version", version, url)
try(
download.file(url,
system.file("htmlwidgets/lib/mermaid/dist/mermaid.slim.min.js",
package = "DiagrammeR"))
)
}
There are several issues with this solution:
- this url could not be the best one to use to get an up to date and persistent reference for downloading the mermaid.js library
- I don't know if the CRAN authorises to modify the content of the library by itself. But I don't know where to locate the mermaid.js library file elsewhere
@rich-iannone what do you think of that?
This issue is in echo with issues #231, #227, #241, #294, #329, #363, #421, #470, #473 and maybe some others...
The need to update the version of mermaid.js embedded in the DiagrammeR package is pressing.
As suggested in #421, we can manually update the file
/DiagrammeR/htmlwidgets/lib/mermaid/dist/mermaid.slim.min.jsin the installation folder of the package with the last version downloaded from https://cdn.jsdelivr.net/npm/mermaid/dist/mermaid.min.js.One way to always have the latest version of DiagrammeR in the package could be to add an
updateMermaidfunction in the package:There are several issues with this solution:
@rich-iannone what do you think of that?