wired icon indicating copy to clipboard operation
wired copied to clipboard

Wired Output format for R Markdown

Open pvictor opened this issue 6 years ago • 0 comments

Goal : create an output format for R markdown documents.

Exemple : https://github.com/dreamRs/wired/blob/435b6f78315c244da6d614f202d603d382833527/inst/rmarkdown/example.Rmd#L12

What we can do ?

  • wrap plots in wired-image
  • wrap other outputs in wired-card ?
  • automatically add wired_divider(2) after a title ## ?

What we have ?

A draft for wired_document based on html_document https://github.com/dreamRs/wired/blob/435b6f78315c244da6d614f202d603d382833527/R/markdown.R#L13

A custom hook for plots by @cderv : https://github.com/dreamRs/wired/blob/435b6f78315c244da6d614f202d603d382833527/R/markdown.R#L31

That need to be declared via output_format in wired_document, so users don't have to do

knitr::knit_hooks$set(plot = hook_plot_wired)

After the hook can be used in chunk like that (must be declared by user this time) :

```{r pressure, echo=FALSE, wired=TRUE}
plot(pressure)
```

Could be nice to be able to set elevation parameter in ?wired_image too

pvictor avatar Oct 28 '19 15:10 pvictor