in_html {fansi} | R Documentation |
Helper function that assembles user provided HTML and CSS into a temporary text file, and by default displays it in the browser. Intended for use in examples.
in_html(x, css = character(), pre = TRUE, display = TRUE, clean = display)
x |
character vector of html encoded strings. |
css |
character vector of css styles. |
pre |
TRUE (default) or FALSE, whether to wrap |
display |
TRUE or FALSE, whether to display the resulting page in a browser window. If TRUE, will sleep for one second before returning, and will delete the temporary file used to store the HTML. |
clean |
TRUE or FALSE, if TRUE and |
character(1L) the file location of the page, invisibly, but keep in
mind it will have been deleted if clean=TRUE
.
Other HTML functions:
html_esc()
,
make_styles()
,
sgr_to_html()
txt <- "\033[31;42mHello \033[7mWorld\033[m" writeLines(txt) html <- sgr_to_html(txt) ## Not run: in_html(html) # spawns a browser window ## End(Not run) writeLines(readLines(in_html(html, display=FALSE))) css <- "SPAN {text-decoration: underline;}" writeLines(readLines(in_html(html, css=css, display=FALSE))) ## Not run: in_html(html, css) ## End(Not run)