Просмотр исходного кода

Don't set `fig.showtext` if it's already set to `FALSE`

Fixes #36
tags/v0.4.0
Garrick Aden-Buie 5 лет назад
Родитель
Сommit
ddcbccf55c
3 измененных файлов: 15 добавлений и 7 удалений
  1. +2
    -1
      NEWS.md
  2. +11
    -0
      R/ggplot2.R
  3. +2
    -6
      R/zzz.R

+ 2
- 1
NEWS.md Просмотреть файл

slide level doesn't result in giant slide numbers (#53). slide level doesn't result in giant slide numbers (#53).
* xaringanthemer no longer sets the `fig.showtext` chunk option when the * xaringanthemer no longer sets the `fig.showtext` chunk option when the
showtext package isn't installed (#56).
showtext package isn't installed and also when `fig.showtext = FALSE`
(thanks @mikedecr #36, #56).
* The style functions gain a `link_decoration` argument to set the * The style functions gain a `link_decoration` argument to set the
[`text-decoration`](https://developer.mozilla.org/en-US/docs/Web/CSS/text-decoration) [`text-decoration`](https://developer.mozilla.org/en-US/docs/Web/CSS/text-decoration)

+ 11
- 0
R/ggplot2.R Просмотреть файл

)) ))
} }


set_fig_showtext <- function() {
if (!requireNamespace("showtext", quietly = TRUE)) {
return(invisible())
}
curr_fst <- knitr::opts_chunk$get("fig.showtext")
if (!is.null(curr_fst) && identical(curr_fst, FALSE)) {
return(invisible())
}
knitr::opts_chunk$set(fig.showtext = TRUE)
}

requires_xaringanthemer_env <- function( requires_xaringanthemer_env <- function(
css_file = NULL, css_file = NULL,
try_css = TRUE, try_css = TRUE,

+ 2
- 6
R/zzz.R Просмотреть файл

.onLoad <- function(libname, pkgname, ...) { .onLoad <- function(libname, pkgname, ...) {


if ("knitr" %in% loadedNamespaces()) { if ("knitr" %in% loadedNamespaces()) {
if (requireNamespace("showtext", quietly = TRUE)) {
knitr::opts_chunk$set(fig.showtext = TRUE)
}
set_fig_showtext()
} }


setHook( setHook(
packageEvent("knitr", "onLoad"), packageEvent("knitr", "onLoad"),
function(...) { function(...) {
if (requireNamespace("showtext", quietly = TRUE)) {
knitr::opts_chunk$set(fig.showtext = TRUE)
}
set_fig_showtext()
} }
) )



Загрузка…
Отмена
Сохранить