Open kbodwin opened 4 years ago
Tweet thread of initial discussion.
Idea on basic interface:
I am wondering if you could take in a user-specified flair function (e.g. generated by flair::decorate_flipbook()
) which could then be passed into flipbookr::chunk_reveal()
(where on the internals it would map through the code of each reveal step, the output of which would replace the default xaringan
formatted code output).
ex. simple user code:
```{r demo-pipes, include = FALSE}
mpg %>%
select(year, cty, hwy) %>%
filter(hwy > 25)
highlight_pipes <- decorate_flipbook() %>%
flair("%>%")
r chunk_reveal("cars", break_type = "auto", flair_fun = highlight_pipes)
So that `flipbookr` interface would be essentially the same (`#BREAK`s, `break_type` etc. would be respected), but provides users ability to input `flair` function to control highlighting. `decorate_flipbook()` might also have an argument like `persistent` that if `FALSE` would only highlight the current break and if `TRUE` would highlight current break as well as all prior breaks.
Per @EvaMaeRey twitter comment, when `flair_fun` is not `NULL`, `display_type` could become `display_type = c("flair", "output")`
I like this vision a lot. I need to dig into {flipbookr} to figure out what object would have to be created by decorate_flipbook()
. It may be that the ordinary decorate()
would suffice; as long as the {flair} package is loaded, the objects (with_flair
) have their own print method, so they behave just like any other output.
I wonder if we could maybe have {flipbookr} be imported/suggested by {flair}, and then the function decorate_flipbook()
would auto-generate the flipbook under the hood...
Ah! This is fun to think about! From my end (I'm still weak on the flair side), one idea is using flair on partial code sequences (a list of character strings with code) https://evamaerey.github.io/flipbooks/flipbookr/flipbookr_building_blocks#42, then the output of that could be injected as markdown - a vector. (md argument and display_type = "md" is brand new in flipbookr!) md example: https://evamaerey.github.io/flipbooks/flipbookr/skeleton#62 --- https://github.com/EvaMaeRey/flipbookr/blob/fdfbfd931d4742bebb74d7edcf846c9cd99031f8/inst/rmarkdown/templates/template-name/skeleton/skeleton.Rmd#L310
This issue is for brainstorming how to integrate flair functionality into the awesomeness of flipbooks.
(https://github.com/EvaMaeRey/flipbookr)