You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
2.7 KiB
2.7 KiB
---
output: rmarkdown::github_document
editor_options:
chunk_output_type: console
---
```{r pkg-knitr-opts, include=FALSE}
hrbrpkghelpr::global_opts()
```
```{r badges, results='asis', echo=FALSE, cache=FALSE}
hrbrpkghelpr::stinking_badges()
```
```{r description, results='asis', echo=FALSE, cache=FALSE}
hrbrpkghelpr::yank_title_and_description()
```
## WIP
This is package is in rapid development mode. The API will most certainly change.
## What's Inside The Tin
The following functions are implemented:
```{r ingredients, results='asis', echo=FALSE, cache=FALSE}
hrbrpkghelpr::describe_ingredients()
```
## Installation
```{r install-ex, results='asis', echo=FALSE, cache=FALSE}
hrbrpkghelpr::install_block()
```
## Usage
```{r lib-ex}
library(purplerain)
# current version
packageVersion("purplerain")
```
### Render an HTML file to PDF with some extra/custom CSS rules
```{r ex-01, eval=FALSE}
prince() %>%
pr_add_sources(
source_paths = c(
system.file("examples", "lab-report.html", package = "purplerain")
)
) %>%
pr_add_css_rules("body { font-family: sans-serif; }") %>%
pr_add_css_rules(c(
"h1, h2.subtitle{ text-align: center; }",
"h2.subtitle { font-size: 14pt; }"
)) %>%
pr_add_css_rules("
#hello {
color: red;
text-align: center;
font-size: large;
font-style: italic;
font-family: serif;
}") %>%
pr_render(tempfile(fileext=".pdf"), open = FALSE)
```
### Rasterize an HTML file to PNG with some extra/custom CSS rules
```{r ex-02, eval=FALSE}
prince() %>%
pr_add_sources(
source_paths = c(
system.file("examples", "lab-report.html", package = "purplerain")
)
) %>%
pr_add_css_rules("body { font-family: sans-serif; }") %>%
pr_add_css_rules(c(
"h1, h2.subtitle{ text-align: center; }",
"h2.subtitle { font-size: 14pt; }"
)) %>%
pr_add_css_rules("
#hello {
color: red;
text-align: center;
font-size: large;
font-style: italic;
font-family: serif;
}") %>%
pr_raster(tempfile(pattern = "ex-%02d", fileext=".png"))
```
### Render an HTML file from an R Markdown file then render that result to PDF and rasterize it, too
```{r ex-03, eval=FALSE}
rmarkdown::render(
input = system.file("examples", "r-markdown.Rmd", package = "purplerain"),
output_file = "/tmp/example.html",
quiet = TRUE
)
prince() %>%
pr_add_sources("/tmp/example.html") %>%
pr_render("/tmp/r-markdown.pdf", TRUE)
prince() %>%
pr_add_sources("/tmp/example.html") %>%
pr_raster("/tmp/r-markdown-%02d.png")
```
## purplerain Metrics
```{r cloc, echo=FALSE}
cloc::cloc_pkg_md()
```
## Code of Conduct
Please note that this project is released with a Contributor Code of Conduct.
By participating in this project you agree to abide by its terms.