Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/r-lib/asciicast
Turn R scripts into terminal screencasts
https://github.com/r-lib/asciicast
Last synced: 5 days ago
JSON representation
Turn R scripts into terminal screencasts
- Host: GitHub
- URL: https://github.com/r-lib/asciicast
- Owner: r-lib
- License: other
- Created: 2019-07-16T12:28:14.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2024-08-05T16:04:52.000Z (7 months ago)
- Last Synced: 2024-10-05T19:20:05.323Z (5 months ago)
- Language: R
- Homepage: https://asciicast.r-lib.org/
- Size: 11.6 MB
- Stars: 224
- Watchers: 5
- Forks: 11
- Open Issues: 13
-
Metadata Files:
- Readme: README.Rmd
- Changelog: NEWS.md
- Contributing: .github/CONTRIBUTING.md
- License: LICENSE
- Code of conduct: .github/CODE_OF_CONDUCT.md
- Support: .github/SUPPORT.md
Awesome Lists containing this project
- jimsghstars - r-lib/asciicast - Turn R scripts into terminal screencasts (R)
README
---
output: github_document
always_allow_html: yes
---```{r, include = FALSE, cache = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%",
asciicast_at = "all",
asciicast_theme = if (Sys.getenv("IN_PKGDOWN") == "true") "pkgdown" else "readme"
)
asciicast::init_knitr_engine()
```# asciicast
> Turn R scripts into terminal screencasts
[](https://lifecycle.r-lib.org/articles/stages.html#experimental)
[](https://cran.r-project.org/package=asciicast)
[](https://app.codecov.io/gh/r-lib/asciicast?branch=main)
[](https://github.com/r-lib/asciicast/actions/workflows/R-CMD-check.yaml)asciicast takes an R script and turns it into an
[asciinema](https://asciinema.org/) cast. It can simulate typing, and
records all terminal output in real time as it happens.## Features
* Input is an R script, output is a
[v2 asciicast recording](https://github.com/asciinema/asciinema/blob/develop/doc/asciicast-v2.md).
* Record all terminal output in real time, as it happens.
* Simulate typing in the commands, with a configurable, randomized speed.
* Alternatively, whole comment blocks or expressions can just appear on
the screen.
* Convert casts to SVG images using
[svg-term](https://github.com/marionebl/svg-term). The package comes with
its own svg-term bundle, no external dependencies are needed.
* Render a single frame of a cast as an SVG image.
* Configurable delay at the beginning, at the end and between paragraphs.
* [HTML widget](http://www.htmlwidgets.org), to be used in Rmarkdown
documents, e.g. in vignettes.
* Read casts from asciinema JSON files (version 2), or from
directly.
* Special knitr engine to create R markdown files with ascii casts. See
the `asciicast-demo` vignette.
* Create ascii casts in GitHub READMEs via animated SVG files. See an
example in `inst/examples` or the `README.Rmd` source of the README
file you are reading.## Limitations
* asciicast works best in an UTF-8 locale. It also works well if all output
is ASCII, but non-ASCII output might cause problems
(https://github.com/r-lib/asciicast/issues/36).## Installation
You can install the released version of asciicast from
[CRAN](https://CRAN.R-project.org):``` r
install.packages("asciicast")
```## Examples
See the [`inst/examples` directory](https://github.com/r-lib/asciicast/tree/main/inst/examples)
for these examples.### Hello world
The input script:
```{r code = readLines("inst/examples/hello.R"), eval = FALSE}
```The result:
```{asciicast, code = readLines("inst/examples/hello.R"), cache = TRUE}
```### Asciicast demo in asciicast
Input script that uses asciicast itself:
```{r code = readLines("inst/examples/asciicast.R"), eval = FALSE}
``````{asciicast, code = readLines("inst/examples/asciicast.R"), cache = TRUE}
```### Errors are recorded
Input script with errors:
```{r code = readLines("inst/examples/errors.R"), eval = FALSE}
``````{asciicast, code = readLines("inst/examples/errors.R"), cache = TRUE}
```## Related tools
* asciinema: https://asciinema.org/
* The original terminal session recorder:
https://github.com/asciinema/asciinema
* svg-term: https://github.com/marionebl/svg-term,
https://github.com/marionebl/svg-term-cli## License
MIT @ [RStudio](https://github.com/rstudio)