yihui / xaringan

Presentation Ninja 幻灯忍者 · 写轮眼
https://slides.yihui.org/xaringan/
Other
1.49k stars 280 forks source link

curly brackets for {{hightlight}} conflicts with recent changes in rlang #215

Closed filipwastberg closed 5 years ago

filipwastberg commented 5 years ago

I'm writing slides in xaringan to show how you can use {{}} for tidy evaluation with rlang 0.4.0.

However, this is also how we can highlight code in xaringan

---
title: "Presentation Ninja"
subtitle: "⚔<br/>with xaringan"
author: "Yihui Xie"
institute: "RStudio, Inc."
date: "2016/12/12 (updated: `r Sys.Date()`)"
output:
  xaringan::moon_reader:
    lib_dir: libs
    nature:
      highlightStyle: github
      highlightLines: true
      countIncrementalSlides: false
---

## How you can use tidy evaluation

```{r message=FALSE}
library(dplyr)
sum_function <- function(df, group) {
  {{df}} %>% 
    group_by({{group}}) %>% 
    summarise(mean_hp = mean(hp, na.rm = T))
}

sum_function(mtcars, cyl)

Which yields:

![Screenshot 2019-07-03 at 11 23 31](https://user-images.githubusercontent.com/20815525/60580233-031db300-9d85-11e9-9b87-7fc0273a2758.png)

Not sure how to properly handle this.

xfun::session_info('xaringan')

> R version 3.6.0 (2019-04-26)

> Platform: x86_64-apple-darwin15.6.0 (64-bit)

> Running under: macOS Mojave 10.14.5

>

> Locale: en_US.UTF-8 / en_US.UTF-8 / en_US.UTF-8 / C / en_US.UTF-8 / en_US.UTF-8

>

> Package version:

> base64enc_0.1.3 BH_1.69.0.1 digest_0.6.19 evaluate_0.13

> glue_1.3.1.9000 graphics_3.6.0 grDevices_3.6.0 highr_0.8

> htmltools_0.3.6 httpuv_1.5.1 jsonlite_1.6 knitr_1.23

> later_0.8.0 magrittr_1.5 markdown_0.9 methods_3.6.0

> mime_0.6 promises_1.0.1 R6_2.4.0 Rcpp_1.0.1

> rlang_0.4.0 rmarkdown_1.12 servr_0.13 stats_3.6.0

> stringi_1.4.3 stringr_1.4.0 tinytex_0.13 tools_3.6.0

> utils_3.6.0 xaringan_0.10.1 xfun_0.7 yaml_2.2.0



<sup>Created on 2019-07-03 by the [reprex package](https://reprex.tidyverse.org) (v0.2.1)</sup>
<!--
Please keep the below portion in your issue. Your issue will be closed if any of the above boxes is not checked. In certain (rare) cases, you may be exempted if you give a brief explanation (e.g., you are only making a suggestion for improvement). Thanks!
-->

---

By filing an issue to this repo, I promise that

- [x] I have fully read the issue guide at https://yihui.name/issue/.
- [x] I have provided the necessary information about my issue.
    - If I'm asking a question, I have already asked it on Stack Overflow or RStudio Community, waited for at least 24 hours, and included a link to my question there.
    - If I'm filing a bug report, I have included a minimal, self-contained, and reproducible example, and have also included `xfun::session_info('xaringan')`. I have upgraded all my packages to their latest versions (e.g., R, RStudio, and R packages), and also tried the development version: `remotes::install_github('yihui/xaringan')`.
    - If I have posted the same issue elsewhere, I have also mentioned it in this issue.
- [x] I have learned the Github Markdown syntax, and formatted my issue correctly.

I understand that my issue may be closed if I don't fulfill my promises.
yihui commented 5 years ago

Should be fixed now. Thanks for the report!

BTW, please read the issue guide more carefully next time to correctly format your example (which requires four backticks). I have edited it.