Built with blockbuilder.org
In a tweet a couple of days ago...
Can you use emoji in Rmd? Or just generally get at, e.g., stuff in Font Awesome? #rstats
— Jennifer Bryan (@JennyBryan) October 22, 2015
I have been meaning to do an htmlwidget
for emoji since the beginning of the year, and I thought it would fit well in the remoji
package. One problem though, I don't have a whole lot of experience with Unicode and emoji, so I thought I would spend the day today sketching something out. Here is the result.
#devtools::install_github("timelyportfolio/remoji@twemoji")
library(htmltools)
library(stringi)
library(remoji)
browsable(
tagList(
twemoji(),
tags$p(HTML("I 💗 emoji!")),
tags$h2(style="display:block;","hearts"),
lapply(
find_emoji("heart"),
function(heart){
tags$div(
style="float:left;",
HTML(stri_trans_general(emoji(heart),"any-hex/xml"))
)
}
),
tags$hr(style="clear:both;"),
tags$h2("sun"),
lapply(
find_emoji("sun"),
function(sun){
tags$div(
style="float:left;",
HTML(stri_trans_general(emoji(sun),"any-hex/xml"))
)
}
),
tags$hr(style="clear:both;"),
tags$h2("hi"),
lapply(
find_emoji("hi"),
function(hi){
tags$div(
style="float:left;",
HTML(stri_trans_general(emoji(hi),"any-hex/xml"))
)
}
)
)
)
# use SVG instead of PNG
browsable(
tagList(
twemoji(svg=TRUE),
lapply(
find_emoji("moon"),
function(emoj){
tags$div(
style="float:left;height:6em;width:6em;",
HTML(stri_trans_general(emoji(emoj),"any-hex/xml"))
)
}
)
)
)