Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nathaneastwood/knitrhooks
Extend {knitr} with hooks
https://github.com/nathaneastwood/knitrhooks
knitr r rmarkdown
Last synced: 3 months ago
JSON representation
Extend {knitr} with hooks
- Host: GitHub
- URL: https://github.com/nathaneastwood/knitrhooks
- Owner: nathaneastwood
- License: mit
- Created: 2018-10-09T10:45:44.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2018-10-17T08:45:57.000Z (about 6 years ago)
- Last Synced: 2024-06-11T08:48:12.970Z (5 months ago)
- Topics: knitr, r, rmarkdown
- Language: R
- Homepage:
- Size: 66.4 KB
- Stars: 33
- Watchers: 5
- Forks: 2
- Open Issues: 11
-
Metadata Files:
- Readme: README.Rmd
- License: LICENSE
Awesome Lists containing this project
- jimsghstars - nathaneastwood/knitrhooks - Extend {knitr} with hooks (R)
README
---
output:
md_document:
variant: markdown_github
---```{r, echo = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#",
fig.path = "tools/images/README-"
)
```# knitrhooks
**knitrhooks** provides useful **knitr** hooks to extend the functionality of **knitr**, **Rmarkdown** and **bookdown**.
## Available Hooks
The below table details the hooks currently available within the package. Some hooks are only available for particular output formats.
| hook name | description | HTML | PDF |
|---------------------|---------------------------------------------|--------|-------|
| `output_lines` | Print user specified lines of R output | X | X |
| `output_max_height` | Add a scrollbar to output of a given height | X | |
| `source_verbatim` | Print verbatim code chunks | X | X |
| `chunk_head` | Print chunk headers within outputs | X | X |## Usage
Currently the package requires you to load the functionality of each given hook before you can use it. [Alternative](https://github.com/nathaneastwood/knitrhooks/issues/3) solutions are currently being considered.
```{r max_height_example}
library(knitrhooks)
output_max_height()
```# Example document
```{r output_max_height = "300px"}
print(mtcars)
```The above code will produce the following HTML document.
![scrollable_r_output](tools/images/README-example.PNG)