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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

emoji in Rmarkdown #171

Closed
nancym opened this issue Aug 1, 2017 · 7 comments
Closed

emoji in Rmarkdown #171

nancym opened this issue Aug 1, 2017 · 7 comments
Milestone

Comments

@nancym
Copy link

@nancym nancym commented Aug 1, 2017

If I put this in config.toml:

enableEmoji = true

An emoji like :smile: in a markdown file will be rendered as 馃槃 in the HTML output. Is there anything I can put in _output.yml to get emoji to work in an Rmarkdown file, e.g. something like this:

blogdown::html_page:
  md_extensions: +emoji

Thanks!

@yihui
Copy link
Member

@yihui yihui commented Aug 1, 2017

No, not to my knowledge. However, if you are okay with Blackfriday's Markdown, you will be able to render R Markdown to Markdown instead of HTML after I implement #165. Then emoji will work.

@yihui yihui added this to the v0.1 milestone Aug 10, 2017
@yihui
Copy link
Member

@yihui yihui commented Aug 10, 2017

#165 has been implemented. Please see the documentation about .Rmarkdown files at https://bookdown.org/yihui/blogdown/output-format.html

@yihui yihui closed this Aug 10, 2017
@ProQuestionAsker
Copy link
Collaborator

@ProQuestionAsker ProQuestionAsker commented Nov 16, 2017

Just for clarification, does this mean that emojis can't be rendered in either .Rmd or .Rmarkdown files if the output is like this?

output:
    blogdown::html_page:
        toc:true

And the workaround is to render the output like this

output:
    md_document:
        toc:true

Or to write in a .md document instead of .Rmd or .Rmarkdown?

@yihui
Copy link
Member

@yihui yihui commented Nov 16, 2017

@ProQuestionAsker The life cycles of .Rmd vs .Rmarkdown:

  • .Rmd -> knitr -> .md (intermediate) -> pandoc -> .html
  • .Rmarkdown -> knitr -> .markdown -> Hugo/Blackfriday -> .html

Emoji is a Markdown extension only in Blackfriday. Pandoc does not support it. As a result, you must use .Rmarkdown if you must have emojis.

For TOC in .Rmarkdown, you have to use the Hugo variable .TableOfContents: https://bookdown.org/yihui/blogdown/templates.html#how-to

This won't work in blogdown:

output:
    md_document:
        toc:true

blogdown only supports the output format blogdown::html_page. All other output formats are ignored.

@ProQuestionAsker
Copy link
Collaborator

@ProQuestionAsker ProQuestionAsker commented Nov 16, 2017

Ah, that makes sense. Thank you!!

@andry-tino
Copy link

@andry-tino andry-tino commented Apr 29, 2019

@yihui: Is there a way to extend the generation pipeline so that I can process the generated HTML and enable emojis? It is such a shame that we cannot use Hugo features with .Rmd files as I need all the features there plus Hugo :(

@aosmith16
Copy link

@aosmith16 aosmith16 commented May 10, 2019

@andry-tino I may be missing what you are asking for, but you can put emojis in .Rmd files via the emo package.

The code would look something like `r emo::ji("grinning")`, which you can add directly within the plain text of a post.

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

Successfully merging a pull request may close this issue.

None yet
5 participants