export_to_html {rock} | R Documentation |
Export parsed sources to HTML or Markdown
Description
These function can be used to convert one or more parsed sources to HTML, or to convert all sources to tabbed sections in Markdown.
Usage
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)
)
Arguments
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 |
Value
A character vector or a list of character vectors.
Examples
### 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]]);