Search code examples
rr-markdownxaringan

Using emoji in xaringan presentation


I'd like to know if there is a way to use markdown syntax for adding emoji in xaringan presentation. A minimal example would be

---

# Slide #1 :smile:

---

that would produce

Slide #1 😄

Thanks!


Solution

  • Since xaringan is an html5 page, you can insert an emoji in it like any other webpage. Multiple ways to do so:

    1. Insert emoji directly: copy & paste the emoji 😄 into the rmd, knit your slides and it'll work.

    2. Insert unicode emoji using HTML character escape:

      • From this wiki page you can lookup an emoticon and copy & paste the html code☀ into your rmd file, which will be rendered as ☀ . The &# and ; are used to escape the unicode character.
    3. There's a package emo by Hadley, which is designed to make it very easy to insert emoji into RMarkdown documents." so you can do

      ---
      
      # Slide #1 `r emo::ji("smile")`
      
      ---