in_html {fansi} | R Documentation |
Frame HTML in a Web Page And Display
Description
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.
Usage
in_html(x, css = character(), pre = TRUE, display = TRUE, clean = display)
Arguments
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 |
Value
character(1L) the file location of the page, invisibly, but keep in
mind it will have been deleted if clean=TRUE
.
See Also
Other HTML functions:
html_esc()
,
make_styles()
,
to_html()
Examples
txt <- "\033[31;42mHello \033[7mWorld\033[m"
writeLines(txt)
html <- 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)