This is an early version of a R htmlwidget version of CodeMirror by Marijn Haverbeke.
devtools::install_github("timelyportfolio/codemirrorR")
library(codemirrorR)
codemirror("hi")
library(codemirrorR)
codemirror(
"
library(codemirror)
codemirror('hi')
",
mode = "r"
)
library(codemirrorR)
codemirror(
system.file(
"htmlwidgets/codemirror.js",
package = "codemirrorR"
),
mode = "javascript"
)
library(codemirrorR)
library(xml2)
# ?xml2::readxml
cd <- read_xml("http://www.xmlfiles.com/examples/cd_catalog.xml")
codemirror(cd, mode = "xml")
library(codemirrorR)
codemirror(
system.file(
"htmlwidgets/codemirror.js",
package = "codemirrorR"
),
mode = "javascript",
theme = "night"
)
will add much better support for addons
library(codemirrorR)
library(xml2)
# ?xml2::readxml
cd <- read_xml("http://www.xmlfiles.com/examples/cd_catalog.xml")
cm <- codemirror(
cd,
mode = "xml",
lineNumbers = TRUE
)
cm_foldcode(cm, "xml-fold")
# brace fold
library(pipeR)
codemirror(
system.file(
"htmlwidgets/codemirror.js",
package = "codemirrorR"
),
mode = "javascript",
theme = "night"
) %>>% cm_foldcode("brace-fold")