export_to_html | R Documentation |
These function can be used to convert one or more parsed sources to HTML, or to convert all sources to tabbed sections in Markdown.
export_to_html(
input,
output = NULL,
template = "default",
fragment = FALSE,
preventOverwriting = rock::opts$get(preventOverwriting),
encoding = rock::opts$get(encoding),
silent = rock::opts$get(silent)
)
export_to_markdown(
input,
heading = "Sources",
headingLevel = 2,
template = "default",
silent = rock::opts$get(silent)
)
input |
An object of class |
output |
For |
template |
The template to load; either the name of one of the ROCK templates (currently, only 'default' is available), or the path and filename of a CSS file. |
fragment |
Whether to include the CSS and HTML tags ( |
preventOverwriting |
For |
encoding |
For |
silent |
Whether to suppress messages. |
heading , headingLevel |
For |
A character vector or a list of character vectors.
### Get path to example source
examplePath <-
system.file("extdata", package="rock");
### Parse a selection of example sources in that directory
parsedExamples <- rock::parse_sources(
examplePath,
regex = "(test|example)(.txt|.rock)"
);
### Export results to a temporary directory
tmpDir <- tempdir(check = TRUE);
prettySources <-
export_to_html(input = parsedExamples,
output = tmpDir);
### Show first one
print(prettySources[[1]]);
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.