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",
width = "100%",
height = "400px"
)
library(codemirrorR)
library(xml2)
## Warning: package 'xml2' was built under R version 3.2.3
# ?xml2::readxml
cd <- read_xml("//www.xmlfiles.com/examples/cd_catalog.xml")
codemirror(cd, mode = "xml", width = "100%", height = "400px")
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("//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")
For those of you who don’t know the incredible work of Marijn Haverbeke, go see it and fund him. Thanks Marijn!