Pārlūkot izejas kodu

Render R code in skeleton when pkg is installed (#55)

tags/v0.4.0
Garrick Aden-Buie pirms 5 gadiem
vecāks
revīzija
4902390cc2
Revīzijas autora e-pasta adrese nav piesaistīta nevienam kontam
2 mainītis faili ar 12 papildinājumiem un 6 dzēšanām
  1. +4
    -0
      NEWS.md
  2. +8
    -6
      inst/rmarkdown/templates/xaringanthemer/skeleton/skeleton.Rmd

+ 4
- 0
NEWS.md Parādīt failu

@@ -4,6 +4,10 @@
a corresponding CSS rule setting the `font-weight` property of `<strong>`
elements (thanks @matiasandina, #50).
* The xaringanthemer slide skeleton (R Markdown template) will now render when
packages that are used in the template but not in xaringanthemer's Imports are
not installed (#52).

* Set slide number font size in `rem` so that increasing the font size at the
slide level doesn't result in giant slide numbers (#53).


+ 8
- 6
inst/rmarkdown/templates/xaringanthemer/skeleton/skeleton.Rmd Parādīt failu

@@ -25,7 +25,7 @@ knitr::opts_chunk$set(
echo = TRUE,
message = FALSE,
warning = FALSE,
fig.show = TRUE,
fig.showtext = requireNamespace("showtext", quietly = TRUE),
hiline = TRUE
)
```
@@ -144,7 +144,7 @@ dplyr::starwars %>% dplyr::slice_sample(n = 4)

---

```{r message=TRUE}
```{r message=TRUE, eval=requireNamespace("cli", quietly = TRUE)}
cli::cli_alert_success("It worked!")
```

@@ -173,8 +173,9 @@ layout: true
## Tables

---
exclude: `r if (requireNamespace("tibble", quietly=TRUE)) "false" else "true"`

```{r}
```{r eval=requireNamespace("tibble", quietly=TRUE)}
tibble::as_tibble(mtcars)
```

@@ -185,8 +186,9 @@ knitr::kable(head(mtcars), format = 'html')
```

---
exclude: `r if (requireNamespace("DT", quietly=TRUE)) "false" else "true"`

```{r}
```{r eval=requireNamespace("DT", quietly=TRUE)}
DT::datatable(head(mtcars), fillContainer = FALSE, options = list(pageLength = 4))
```

@@ -261,14 +263,14 @@ layout: true

---

```{r plot-example}
```{r plot-example, eval=requireNamespace("ggplot2", quietly=TRUE)}
library(ggplot2)
(g <- ggplot(mpg) + aes(hwy, cty, color = class) + geom_point())
```

---

```{r plot-example-themed}
```{r plot-example-themed, eval=requireNamespace("ggplot2", quietly=TRUE)}
g + xaringanthemer::theme_xaringan(text_font_size = 16, title_font_size = 18) +
ggtitle("A Plot About Cars")
```

Notiek ielāde…
Atcelt
Saglabāt