editable {xaringanExtra} | R Documentation |
Editable
Description
Editable gives you a way to write directly inside your slides. Make any
element of your slides editable by using the .can-edit[...]
class. Editable
fields are reset when the slides are reloaded, but it is possible for edits
to persist across sessions (in the same browser) by giving the editable
element a .key-<NAME>
class, where <NAME>
is a unique identifier (and
valid CSS class).
Usage
use_editable(id = NULL, expires = 14)
html_dependency_editable(expires = 14, id = NULL)
Arguments
id |
Optional. By default, when |
expires |
Editable values that also have a |
Value
An htmltools::tagList()
with the editable dependencies, or an
htmltools::htmlDependency.
Functions
-
use_editable()
: Adds editable to your xaringan slides. -
html_dependency_editable()
: Returns an htmltools::htmlDependency with the tile view dependencies. Most users will want to useuse_editable()
.
Usage
To make your xaringan presentations editable, add the following code chunk to your slides' R Markdown file.
```{r xaringan-editable, echo=FALSE} # Setup editable fields and only store values in the browser for one day # (by default values expire in 2 weeks). xaringanExtra::use_editable(expires = 1) ```
Then, to make a component of your slides editable, use the .can-edit[]
class.
## .can-edit[You can edit this slide title]
Editable fields that only have the .can-edit
class are reset whenever the
slides are re-loaded in your browser. If you want to store the edited
values and have them persist across browser sessions, give each editable
field a .key-<NAME>
class. Be sure to make each key unique and note that
the key name must be a valid CSS class, i.e. it cannot contain spaces.
## .can-edit.key-firstSlideTitle[Change this title and then reload the page]
Warning Editable fields may not work well with slide continuations. If your full slide builds up over several slides, you can only edit the currently visible slide. If the field has a key, however, all editable elements with the same key class are updated when the slides are loaded. In other words, you can edit the title on the first slide of a multi-part slide and reload the page to have the title applied to subsequent slides.
Examples
use_editable()