Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

flair + flipbooks = love #15

Open
kbodwin opened this issue Jun 17, 2020 · 3 comments
Open

flair + flipbooks = love #15

kbodwin opened this issue Jun 17, 2020 · 3 comments

Comments

@kbodwin
Copy link
Collaborator

kbodwin commented Jun 17, 2020

This issue is for brainstorming how to integrate flair functionality into the awesomeness of flipbooks.

(https://github.com/EvaMaeRey/flipbookr)

@brshallo
Copy link

brshallo commented Jun 17, 2020

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)
```

```{r flair-fun, include = FALSE}
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 (#BREAKs, 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")

@kbodwin
Copy link
Collaborator Author

kbodwin commented Jun 17, 2020

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...

@EvaMaeRey
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants