flashCard icon indicating copy to clipboard operation
flashCard copied to clipboard

Functionality with rmardown

Open bes827 opened this issue 3 years ago • 3 comments

Thanks for the great package. Will this work with static webpages created by rmarkdown? or has to be within a shiny app?

bes827 avatar Dec 23 '21 16:12 bes827

Hi, @bes827 it works for both static webpages created by rmarkdown and dynamic web by Shiny app. :)

jienagu avatar Dec 29 '21 14:12 jienagu

Thanks for the reply. I tried the syntax below, however when I render to html, it only produces the first flash card (the expected output is three different flash cards). Any suggestions on what I should do different? thanks again @jienagu

image

---
title: "flashcard libray"
output: html_document
---


```{r}

library (flashCard)


df1 <- data.frame(
front = c("Title front1","contentfront"),
back =c("Title back1","content back")
)

flashCard(df1, elementId = "card", front_text_color = "yellow")



df2 <- data.frame(
front = c("Title front2","contentfront"),
back =c("Title back2","content back")
)

 
flashCard(df2, elementId = "card", front_text_color = "yellow")

In separate chunk:

df3 <- data.frame(
front = c("Title front3","contentfront"),
back =c("Title back3","content back")
)

 
flashCard(df3, elementId = "card", front_text_color = "yellow")


bes827 avatar Jan 01 '22 23:01 bes827

Hi @bes827 , this is because you are using same elementId for all of your flash cards. Please use different elementId and you will see the problem solved.

image

jienagu avatar Jan 03 '22 15:01 jienagu