Open MayaGans opened 3 years ago
Well, that was one thing that was not perfectly clear if I remember correctly, hopefully I've clarified that in the book here. It was probably slightly different when you read that part.
You could, of course, within the play
function with: sprintf("<h2>%s</h2>", message)
but that's probably not ideal. I created an example in a repo to which I'll invite you in a minute.
Ah wonderful! Perfect excuse to reinforce the earlier chapters and read the book again, thank you!!!
No no, thank you for the feedback!
Hey John! This isn't a note for the book as much as it is a general question but I have a question but essentially my mental model after being a little over halfway through the book is that htmlwidgets allows you to supply data through R and pass that to a JS object.
....What if I want to add some html in the mix? For instance I was wondering in the first example
play(shiny::h2("Chocolate is a colour", style = "color:chocolate;"))
how would I update theplay
function so that the user only needs to supply the message, and it's always a chocolate<h2>
?I was thinking I could add some kind of
htmltools::tags$h2(....)
but I'm not quite sure how that'd work.Does this make sense? Any tips/helps appreciated!