From dd577766840430c02fb602e13f413160f61eb64d Mon Sep 17 00:00:00 2001 From: Garrick Aden-Buie Date: Thu, 4 Mar 2021 12:26:22 -0500 Subject: [PATCH] v0.3.3 --- DESCRIPTION | 4 +- NEWS.md | 14 +- R/ggplot2.R | 10 +- README.Rmd | 2 +- README.md | 2 +- cran-comments.md | 46 +- .../xaringanthemer/skeleton/skeleton.Rmd | 585 +++++------------- make.R | 3 + man-roxygen/style_solarized_dark.R | 2 +- man-roxygen/style_solarized_light.R | 2 +- man/figures/lifecycle-archived.svg | 1 + man/figures/lifecycle-defunct.svg | 1 + man/figures/lifecycle-deprecated.svg | 1 + man/figures/lifecycle-experimental.svg | 1 + man/figures/lifecycle-maturing.svg | 1 + man/figures/lifecycle-questioning.svg | 1 + man/figures/lifecycle-stable.svg | 1 + man/figures/lifecycle-superseded.svg | 1 + man/fragments/_fonts.Rmd | 2 +- man/fragments/_thanks.Rmd | 4 +- man/fragments/_themes.Rmd | 2 +- man/scale_xaringan.Rd | 2 +- man/style_solarized_dark.Rd | 2 +- man/style_solarized_light.Rd | 2 +- man/theme_xaringan.Rd | 2 +- man/theme_xaringan_base.Rd | 2 +- man/theme_xaringan_inverse.Rd | 2 +- man/theme_xaringan_set_defaults.Rd | 2 +- man/xaringanthemer-package.Rd | 2 +- vignettes/ggplot2-themes.Rmd | 2 +- 30 files changed, 219 insertions(+), 485 deletions(-) create mode 100644 man/figures/lifecycle-archived.svg create mode 100644 man/figures/lifecycle-defunct.svg create mode 100644 man/figures/lifecycle-deprecated.svg create mode 100644 man/figures/lifecycle-experimental.svg create mode 100644 man/figures/lifecycle-maturing.svg create mode 100644 man/figures/lifecycle-questioning.svg create mode 100644 man/figures/lifecycle-stable.svg create mode 100644 man/figures/lifecycle-superseded.svg diff --git a/DESCRIPTION b/DESCRIPTION index 56adcd56..7e3706fa 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Type: Package Package: xaringanthemer Title: Custom 'xaringan' CSS Themes -Version: 0.3.0.9000 +Version: 0.3.3 Authors@R: person(given = "Garrick", family = "Aden-Buie", @@ -15,7 +15,7 @@ Description: Create beautifully color-coordinated and customized your slides' 'R Markdown' source file or in a separate external script. License: MIT + file LICENSE -URL: https://pkg.garrickadenbuie.com/xaringanthemer, +URL: https://pkg.garrickadenbuie.com/xaringanthemer/, https://github.com/gadenbuie/xaringanthemer BugReports: https://github.com/gadenbuie/xaringanthemer/issues Depends: diff --git a/NEWS.md b/NEWS.md index 5ac72482..fffdee0f 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,10 +1,16 @@ -# xaringanthemer 0.3.0.9000 +# xaringanthemer 0.3.3 -- Add `inverse_link_color` to control color of links on inverse slides (thanks @dmi3kno, #44) +* Add `inverse_link_color` to control color of links on inverse slides + (thanks @dmi3kno, #44) -- .pull-right[] now clears floats just for its immediate sibling +* .pull-right[] now clears floats just for its immediate sibling -- Add `header_font_family_fallback` to control fallback fonts for headings (thanks @mattwarkentin, #41) +* Add `header_font_family_fallback` to control fallback fonts for headings + (thanks @mattwarkentin, #41) + +* New xaringanthemer presentation skeleton with a kitchen sink of typical + slide elements with the goal of making it easier to preview new themes + during development. # xaringanthemer 0.3.0 diff --git a/R/ggplot2.R b/R/ggplot2.R index a4527741..d96572e8 100644 --- a/R/ggplot2.R +++ b/R/ggplot2.R @@ -3,7 +3,7 @@ #' #' @description #' -#' **Lifecycle:** [Maturing](https://www.tidyverse.org/lifecycle/#maturing) +#' `r lifecycle::badge("maturing")` #' #' Creates \pkg{ggplot2} themes to match the xaringanthemer theme used in the #' \pkg{xaringan} slides that seamlessly matches the "normal" slide colors and @@ -96,7 +96,7 @@ theme_xaringan <- function( #' #' @description #' -#' **Lifecycle:** [Maturing](https://www.tidyverse.org/lifecycle/#maturing) +#' `r lifecycle::badge("maturing")` #' #' A \pkg{ggplot2} xaringanthemer plot theme to seamlessly match the "inverse" #' \pkg{xaringan} slide colors and styles as styled by [xaringanthemer]. See @@ -185,7 +185,7 @@ theme_xaringan_inverse <- function( #' #' @description #' -#' **Lifecycle:** [Maturing](https://www.tidyverse.org/lifecycle/#maturing) +#' `r lifecycle::badge("maturing")` #' #' Provides a base plot theme for \pkg{ggplot2} to match the \pkg{xaringan} #' slide theme created by [xaringanthemer]. The theme is designed to create a @@ -380,7 +380,7 @@ theme_xaringan_base <- function( #' #' @description #' -#' **Lifecycle:** [Maturing](https://www.tidyverse.org/lifecycle/#maturing) +#' `r lifecycle::badge("maturing")` #' #' Set \pkg{ggplot2} _geom_ defaults to match [theme_xaringan()] with #' `theme_xaringan_set_defaults()` and restore the standard or previously-set @@ -511,7 +511,7 @@ safely_set_geom <- function(geom, new) { #' #' @description #' -#' **Lifecycle:** [Maturing](https://www.tidyverse.org/lifecycle/#maturing) +#' `r lifecycle::badge("maturing")` #' #' Color and fill single-color scales for discrete and continuous values, #' created using the primary accent color of the xaringanthemer styles. See diff --git a/README.Rmd b/README.Rmd index d11c3a88..ec2fe54a 100644 --- a/README.Rmd +++ b/README.Rmd @@ -21,7 +21,7 @@ library(xaringanthemer) [![CRAN status](https://www.r-pkg.org/badges/version/xaringanthemer)](https://CRAN.R-project.org/package=xaringanthemer) -[![Lifecycle: stable](https://img.shields.io/badge/lifecycle-stable-brightgreen.svg)](https://www.tidyverse.org/lifecycle/#stable) +[![Lifecycle: stable](https://img.shields.io/badge/lifecycle-stable-brightgreen.svg)](https://lifecycle.r-lib.org/articles/stages.html) [![CI by {tic}](https://github.com/gadenbuie/xaringanthemer/workflows/tic/badge.svg?branch=master)](https://github.com/gadenbuie/xaringanthemer/actions) [![Codecov](https://img.shields.io/codecov/c/github/gadenbuie/xaringanthemer)](https://codecov.io/github/gadenbuie/xaringanthemer) diff --git a/README.md b/README.md index 7c78fa76..720fa1a4 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ [![CRAN status](https://www.r-pkg.org/badges/version/xaringanthemer)](https://CRAN.R-project.org/package=xaringanthemer) [![Lifecycle: -stable](https://img.shields.io/badge/lifecycle-stable-brightgreen.svg)](https://www.tidyverse.org/lifecycle/#stable) +stable](https://img.shields.io/badge/lifecycle-stable-brightgreen.svg)](https://lifecycle.r-lib.org/articles/stages.html) [![CI by {tic}](https://github.com/gadenbuie/xaringanthemer/workflows/tic/badge.svg?branch=master)](https://github.com/gadenbuie/xaringanthemer/actions) [![Codecov](https://img.shields.io/codecov/c/github/gadenbuie/xaringanthemer)](https://codecov.io/github/gadenbuie/xaringanthemer) diff --git a/cran-comments.md b/cran-comments.md index 4b7ad9c1..ef9c2c34 100644 --- a/cran-comments.md +++ b/cran-comments.md @@ -1,46 +1,8 @@ -## Test environments -* local OS X install, R 3.6.2 -* local OS X install, R 4.0.0 -* local Ubuntu 18.04, R 3.6.3 -* local Ubuntu 18.04, R 4.0.0 -* win-builder (devel and release) -* Microsoft Windows Server 2019 (on GitHub Actions), R 3.6.3 -* MacOS (release and devel, on GitHub Actions) -* Ubuntu 18.04 (on GitHub Action), R 3.6.3 - ## R CMD check results -0 errors | 0 warnings | 1 note - -* This is a new release. - -## Changes in this resubmission - -> Package names are case sensitive. (in title:) --> 'xaringan' - -The title was changed accordingly. - -> Please do not modify the global environment (e.g. by using <<- or -> assign() without a specified environment) in your functions. - -`assign()` is used but always with an explicit environment to ensure -that the global environment is not modified. - -> Please make sure you do not write or download anything without the -> user's permission. - -I've verified that all file outputs are consented, either by setting a function -argument to the path of an outfile or by prompt. In one case where a required -file needs to be downloaded, the user's consent is requested prior to the -download. If the user consents, the file is downloaded into the temp folder. - -> Please make sure that you do not change the user's options, par or -> working directory. - -The global options are not modified by any functions in the package. There are -a few places in the tests where options are temporarily modified for the test, -but the options are reverted when exiting the scope of the test. +0 errors | 0 warnings | 0 notes -> Missing Rd-tags: \value, \arguments +No reverse dependencies. -I've added the missing Rd tags in all files. +Replaces previous submission with corrected links +for three URLs that were moved to a new location. diff --git a/inst/rmarkdown/templates/xaringanthemer/skeleton/skeleton.Rmd b/inst/rmarkdown/templates/xaringanthemer/skeleton/skeleton.Rmd index 631c077b..21069696 100644 --- a/inst/rmarkdown/templates/xaringanthemer/skeleton/skeleton.Rmd +++ b/inst/rmarkdown/templates/xaringanthemer/skeleton/skeleton.Rmd @@ -7,16 +7,27 @@ author: date: '`r Sys.Date()`' output: xaringan::moon_reader: - lib_dir: libs css: xaringan-themer.css nature: + slideNumberFormat: "%current%" highlightStyle: github highlightLines: true - countIncrementalSlides: false + ratio: 16:9 + countIncrementalSlides: true --- ```{r setup, include=FALSE} options(htmltools.dir.version = FALSE) +knitr::opts_chunk$set( + fig.width=9, fig.height=3.5, fig.retina=3, + out.width = "100%", + cache = FALSE, + echo = TRUE, + message = FALSE, + warning = FALSE, + fig.show = TRUE, + hiline = TRUE +) ``` ```{r xaringan-themer, include=FALSE, warning=FALSE} @@ -28,548 +39,292 @@ style_duo_accent( ) ``` -background-image: url(https://upload.wikimedia.org/wikipedia/commons/b/be/Sharingan_triple.svg) - -??? - -Image credit: [Wikimedia Commons](https://commons.wikimedia.org/wiki/File:Sharingan_triple.svg) - ---- -class: center, middle - -# xaringan - -### /ʃæ.'riŋ.ɡæn/ - ---- -class: inverse, center, middle - -# Get Started - ---- - -# Hello World - -Install the **xaringan** package from [Github](https://github.com/yihui/xaringan): - -```{r eval=FALSE, tidy=FALSE} -devtools::install_github("yihui/xaringan") -``` - --- +## Typography -You are recommended to use the [RStudio IDE](https://www.rstudio.com/products/rstudio/), but you do not have to. +Text can be **bold**, _italic_, ~~strikethrough~~, or `inline code`. -- Create a new R Markdown document from the menu `File -> New File -> R Markdown -> From Template -> Ninja Presentation`;1 +[Link to another slide](#colors). --- +### Lorem Ipsum -- Click the `Knit` button to compile it; - --- +Dolor imperdiet nostra sapien scelerisque praesent curae metus facilisis dignissim tortor. +Lacinia neque mollis nascetur neque urna velit bibendum. +Himenaeos suspendisse leo varius mus risus sagittis aliquet venenatis duis nec. -- or use the [RStudio Addin](https://rstudio.github.io/rstudioaddins/)2 "Infinite Moon Reader" to live preview the slides (every time you update and save the Rmd document, the slides will be automatically reloaded in RStudio Viewer. +- Dolor cubilia nostra nunc sodales -.footnote[ -[1] 中文用户请看[这份教程](http://slides.yihui.name/xaringan/zh-CN.html) +- Consectetur aliquet mauris blandit -[2] See [#2](https://github.com/yihui/xaringan/issues/2) if you do not see the template or addin in RStudio. -] +- Ipsum dis nec porttitor urna sed --- -background-image: url(`r xaringan:::karl`) -background-position: 50% 50% -class: center, bottom, inverse - -# You only live once! +name: colors ---- +## Colors -# Hello Ninja +- Text Color -As a presentation ninja, you certainly should not be satisfied by the "Hello World" example. You need to understand more about two things: +- Header Color -1. The [remark.js](https://remarkjs.com) library; +- Link Color -1. The **xaringan** package; +- Bold Color -Basically **xaringan** injected the chakra of R Markdown (minus Pandoc) into **remark.js**. The slides are rendered by remark.js in the web browser, and the Markdown source needed by remark.js is generated from R Markdown (**knitr**). +- `inline code color` --- -# remark.js +# Big Topic or Inverse Slides `#` -You can see an introduction of remark.js from [its homepage](https://remarkjs.com). You should read the [remark.js Wiki](https://github.com/gnab/remark/wiki) at least once to know how to +## Slide Headings `##` -- create a new slide (Markdown syntax* and slide properties); +### Sub-slide Headings `###` -- format a slide (e.g. text alignment); +#### Bold Call-Out `####` -- configure the slideshow; +This is a normal paragraph text. Only use header levels 1-4. -- and use the presentation (keyboard shortcuts). +##### Possible, but not recommended `#####` -It is important to be familiar with remark.js before you can understand the options in **xaringan**. - -.footnote[[*] It is different with Pandoc's Markdown! It is limited but should be enough for presentation purposes. Come on... You do not need a slide for the Table of Contents! Well, the Markdown support in remark.js [may be improved](https://github.com/gnab/remark/issues/142) in the future.] +###### Definitely don't use h6 `######` --- -background-image: url(`r xaringan:::karl`) -background-size: cover -class: center, bottom, inverse - -# I was so happy to have discovered remark.js! +class: inverse center middle ---- -class: inverse, middle, center +# Topic Changing Interstitial -# Using xaringan - ---- - -# xaringan - -Provides an R Markdown output format `xaringan::moon_reader` as a wrapper for remark.js, and you can use it in the YAML metadata, e.g. +-- -```yaml ---- -title: "A Cool Presentation" -output: - xaringan::moon_reader - yolo: true - nature: - autoplay: 30000 ---- ``` - -See the help page `?xaringan::moon_reader` for all possible options that you can use. +class: inverse center middle +``` --- +layout: true -# remark.js vs xaringan - -Some differences between using remark.js (left) and using **xaringan** (right): - -.pull-left[ -1. Start with a boilerplate HTML file; - -1. Plain Markdown; - -1. Write JavaScript to autoplay slides; - -1. Manually configure MathJax; - -1. Highlight code with `*`; - -1. Edit Markdown source and refresh browser to see updated slides; -] - -.pull-right[ -1. Start with an R Markdown document; - -1. R Markdown (can embed R/other code chunks); - -1. Provide an option `autoplay`; - -1. MathJax just works;* - -1. Highlight code with `{{}}`; - -1. The RStudio addin "Infinite Moon Reader" automatically refreshes slides on changes; -] - -.footnote[[*] Not really. See next page.] +## Blocks --- -# Math Expressions - -You can write LaTeX math expressions inside a pair of dollar signs, e.g. $\alpha+\beta$ renders $\alpha+\beta$. You can use the display style with double dollar signs: - -``` -$$\bar{X}=\frac{1}{n}\sum_{i=1}^nX_i$$ -``` +### Blockquote -$$\bar{X}=\frac{1}{n}\sum_{i=1}^nX_i$$ - -Limitations: - -1. The source code of a LaTeX math expression must be in one line, unless it is inside a pair of double dollar signs, in which case the starting `$$` must appear in the very beginning of a line, followed immediately by a non-space character, and the ending `$$` must be at the end of a line, led by a non-space character; - -1. There should not be spaces after the opening `$` or before the closing `$`. - -1. Math does not work on the title slide (see [#61](https://github.com/yihui/xaringan/issues/61) for a workaround). +> This is a blockquote following a header. +> +> When something is important enough, you do it even if the odds are not in your favor. --- -# R Code +### Code Blocks -```{r comment='#'} -# a boring regression -fit = lm(dist ~ 1 + speed, data = cars) -coef(summary(fit)) -dojutsu = c('地爆天星', '天照', '加具土命', '神威', '須佐能乎', '無限月読') -grep('天', dojutsu, value = TRUE) -``` +#### R Code ---- - -# R Plots - -```{r cars, fig.height=4, dev='svg'} -par(mar = c(4, 4, 1, .1)) -plot(cars, pch = 19, col = 'darkgray', las = 1) -abline(fit, lwd = 2) +```{r eval=FALSE} +ggplot(gapminder) + + aes(x = gdpPercap, y = lifeExp, size = pop, color = country) + + geom_point() + + facet_wrap(~year) ``` ---- - -# Tables - -If you want to generate a table, make sure it is in the HTML format (instead of Markdown or other formats), e.g., +#### JavaScript -```{r} -knitr::kable(head(mtcars), format = 'html') +```js +var fun = function lang(l) { + dateformat.i18n = require('./lang/' + l) + return true; +} ``` --- -# HTML Widgets - -I have not thoroughly tested HTML widgets against **xaringan**. Some may work well, and some may not. It is a little tricky. - -Similarly, the Shiny mode (`runtime: shiny`) does not work. I might get these issues fixed in the future, but these are not of high priority to me. I never turn my presentation into a Shiny app. When I need to demonstrate more complicated examples, I just launch them separately. It is convenient to share slides with other people when they are plain HTML/JS applications. +### More R Code -See the next page for two HTML widgets. - ---- - -```{r out.width='100%', fig.height=6, eval=require('leaflet')} -library(leaflet) -leaflet() %>% addTiles() %>% setView(-93.65, 42.0285, zoom = 17) +```{r eval=FALSE} +dplyr::starwars %>% dplyr::slice_sample(n = 4) ``` --- -```{r eval=require('DT'), tidy=FALSE} -DT::datatable( - mtcars[1:6, 1:6], - fillContainer = FALSE, options = list(pageLength = 8) -) +```{r message=TRUE} +cli::cli_alert_success("It worked!") ``` ---- - -# Some Tips - -- When you use the "Infinite Moon Reader" addin in RStudio, your R session will be blocked by default. You can click the red button on the right of the console to stop serving the slides, or use the _daemonized_ mode so that it does not block your R session. To do the latter, you can set the option - - ```r - options(servr.daemon = TRUE) - ``` - - in your current R session, or in `~/.Rprofile` so that it is applied to all future R sessions. I do the latter by myself. - - To know more about the web server, see the [**servr**](https://github.com/yihui/servr) package. - -- -- Do not forget to try the `yolo` option of `xaringan::moon_reader`. - - ```yaml - output: - xaringan::moon_reader: - yolo: true - ``` - ---- - -# Some Tips +```{r message=TRUE} +message("Just a friendly message") +``` -- Slides can be automatically played if you set the `autoplay` option under `nature`, e.g. go to the next slide every 30 seconds in a lightning talk: +-- - ```yaml - output: - xaringan::moon_reader: - nature: - autoplay: 30000 - ``` +```{r warning=TRUE} +warning("This could be bad...") +``` -- -- A countdown timer can be added to every page of the slides using the `countdown` option under `nature`, e.g. if you want to spend one minute on every page when you give the talk, you can set: - - ```yaml - output: - xaringan::moon_reader: - nature: - countdown: 60000 - ``` +```{r error=TRUE} +stop("I hope you're sitting down for this") +``` - Then you will see a timer counting down from `01:00`, to `00:59`, `00:58`, ... When the time is out, the timer will continue but the time turns red. --- +layout: true -# Some Tips - -- There are several ways to build incremental slides. See [this presentation](https://slides.yihui.name/xaringan/incremental.html) for examples. - -- The option `highlightLines: true` of `nature` will highlight code lines that start with `*`, or are wrapped in `{{ }}`, or have trailing comments `#<<`; - - ```yaml - output: - xaringan::moon_reader: - nature: - highlightLines: true - ``` - - See examples on the next page. +## Tables --- -# Some Tips - - -.pull-left[ -An example using a leading `*`: - - ```r - if (TRUE) { - ** message("Very important!") - } - ``` -Output: -```r -if (TRUE) { -* message("Very important!") -} -``` - -This is invalid R code, so it is a plain fenced code block that is not executed. -] - -.pull-right[ -An example using `{{}}`: - - `r ''````{r tidy=FALSE} - if (TRUE) { - *{{ message("Very important!") }} - } - ``` -Output: -```{r tidy=FALSE} -if (TRUE) { -{{ message("Very important!") }} -} +```{r} +tibble::as_tibble(mtcars) ``` -It is valid R code so you can run it. Note that `{{}}` can wrap an R expression of multiple lines. -] - --- -# Some Tips - -An example of using the trailing comment `#<<` to highlight lines: - -````markdown -`r ''````{r tidy=FALSE} -library(ggplot2) -ggplot(mtcars) + - aes(mpg, disp) + - geom_point() + #<< - geom_smooth() #<< +```{r} +knitr::kable(head(mtcars), format = 'html') ``` -```` -Output: +--- -```{r tidy=FALSE, eval=FALSE} -library(ggplot2) -ggplot(mtcars) + - aes(mpg, disp) + - geom_point() + #<< - geom_smooth() #<< +```{r} +DT::datatable(head(mtcars), fillContainer = FALSE, options = list(pageLength = 4)) ``` --- +layout: true -# Some Tips - -- To make slides work offline, you need to download a copy of remark.js in advance, because **xaringan** uses the online version by default (see the help page `?xaringan::moon_reader`). - -- You can use `xaringan::summon_remark()` to download the latest or a specified version of remark.js. By default, it is downloaded to `libs/remark-latest.min.js`. - -- Then change the `chakra` option in YAML to point to this file, e.g. - - ```yaml - output: - xaringan::moon_reader: - chakra: libs/remark-latest.min.js - ``` - -- If you used Google fonts in slides (the default theme uses _Yanone Kaffeesatz_, _Droid Serif_, and _Source Code Pro_), they won't work offline unless you download or install them locally. The Heroku app [google-webfonts-helper](https://google-webfonts-helper.herokuapp.com/fonts) can help you download fonts and generate the necessary CSS. +## Lists --- -# Macros - -- remark.js [allows users to define custom macros](https://github.com/yihui/xaringan/issues/80) (JS functions) that can be applied to Markdown text using the syntax `![:macroName arg1, arg2, ...]` or `![:macroName arg1, arg2, ...](this)`. For example, before remark.js initializes the slides, you can define a macro named `scale`: +.pull-left[ +#### Here is an unordered list: - ```js - remark.macros.scale = function (percentage) { - var url = this; - return ''; - }; - ``` +* Item foo +* Item bar +* Item baz +* Item zip +] - Then the Markdown text +.pull-right[ - ```markdown - ![:scale 50%](image.jpg) - ``` +#### And an ordered list: - will be translated to - - ```html - - ``` +1. Item one +1. Item two +1. Item three +1. Item four +] --- -# Macros (continued) +### And a nested list: -- To insert macros in **xaringan** slides, you can use the option `beforeInit` under the option `nature`, e.g., - - ```yaml - output: - xaringan::moon_reader: - nature: - beforeInit: "macros.js" - ``` - - You save your remark.js macros in the file `macros.js`. - -- The `beforeInit` option can be used to insert arbitrary JS code before `remark.create()`. Inserting macros is just one of its possible applications. +- level 1 item + - level 2 item + - level 2 item + - level 3 item + - level 3 item +- level 1 item + - level 2 item + - level 2 item + - level 2 item +- level 1 item + - level 2 item + - level 2 item +- level 1 item --- -# CSS +### Nesting an ol in ul in an ol -Among all options in `xaringan::moon_reader`, the most challenging but perhaps also the most rewarding one is `css`, because it allows you to customize the appearance of your slides using any CSS rules or hacks you know. - -You can see the default CSS file [here](https://github.com/yihui/xaringan/blob/master/inst/rmarkdown/templates/xaringan/resources/default.css). You can completely replace it with your own CSS files, or define new rules to override the default. See the help page `?xaringan::moon_reader` for more information. +- level 1 item (ul) + 1. level 2 item (ol) + 1. level 2 item (ol) + - level 3 item (ul) + - level 3 item (ul) +- level 1 item (ul) + 1. level 2 item (ol) + 1. level 2 item (ol) + - level 3 item (ul) + - level 3 item (ul) + 1. level 4 item (ol) + 1. level 4 item (ol) + - level 3 item (ul) + - level 3 item (ul) +- level 1 item (ul) --- +layout: true -# CSS - -For example, suppose you want to change the font for code from the default "Source Code Pro" to "Ubuntu Mono". You can create a CSS file named, say, `ubuntu-mono.css`: - -```css -@import url(https://fonts.googleapis.com/css?family=Ubuntu+Mono:400,700,400italic); - -.remark-code, .remark-inline-code { font-family: 'Ubuntu Mono'; } -``` - -Then set the `css` option in the YAML metadata: - -```yaml -output: - xaringan::moon_reader: - css: ["default", "ubuntu-mono.css"] -``` - -Here I assume `ubuntu-mono.css` is under the same directory as your Rmd. - -See [yihui/xaringan#83](https://github.com/yihui/xaringan/issues/83) for an example of using the [Fira Code](https://github.com/tonsky/FiraCode) font, which supports ligatures in program code. +## Plots --- -# Themes - -Don't want to learn CSS? Okay, you can use some user-contributed themes. A theme typically consists of two CSS files `foo.css` and `foo-fonts.css`, where `foo` is the theme name. Below are some existing themes: - -```{r} -names(xaringan:::list_css()) -``` - -To use a theme, you can specify the `css` option as an array of CSS filenames (without the `.css` extensions), e.g., - -```yaml -output: - xaringan::moon_reader: - css: [default, metropolis, metropolis-fonts] +```{r plot-example} +library(ggplot2) +(g <- ggplot(mpg) + aes(hwy, cty, color = class) + geom_point()) ``` -If you want to contribute a theme to **xaringan**, please read [this blog post](https://yihui.name/en/2017/10/xaringan-themes). - --- -class: inverse, middle, center -background-image: url(https://upload.wikimedia.org/wikipedia/commons/3/39/Naruto_Shiki_Fujin.svg) -background-size: contain -# Naruto +```{r plot-example-themed} +g + xaringanthemer::theme_xaringan(text_font_size = 16, title_font_size = 18) + + ggtitle("A Plot About Cars") +``` --- -background-image: url(https://upload.wikimedia.org/wikipedia/commons/b/be/Sharingan_triple.svg) -background-size: 100px -background-position: 90% 8% - -# Sharingan - -The R package name **xaringan** was derived1 from **Sharingan**, a dōjutsu in the Japanese anime _Naruto_ with two abilities: +layout: false -- the "Eye of Insight" +## Square image -- the "Eye of Hypnotism" +
-I think a presentation is basically a way to communicate insights to the audience, and a great presentation may even "hypnotize" the audience.2,3 - -.footnote[ -[1] In Chinese, the pronounciation of _X_ is _Sh_ /ʃ/ (as in _shrimp_). Now you should have a better idea of how to pronounce my last name _Xie_. - -[2] By comparison, bad presentations only put the audience to sleep. - -[3] Personally I find that setting background images for slides is a killer feature of remark.js. It is an effective way to bring visual impact into your presentations. -] +.footnote[GitHub Octocat] --- -# Naruto terminology - -The **xaringan** package borrowed a few terms from Naruto, such as +### Wide image -- [Sharingan](http://naruto.wikia.com/wiki/Sharingan) (写輪眼; the package name) +![](https://guides.github.com/activities/hello-world/branching.png) -- The [moon reader](http://naruto.wikia.com/wiki/Moon_Reader) (月読; an attractive R Markdown output format) +.footnote[Wide images scale to 100% slide width] -- [Chakra](http://naruto.wikia.com/wiki/Chakra) (查克拉; the path to the remark.js library, which is the power to drive the presentation) - -- [Nature transformation](http://naruto.wikia.com/wiki/Nature_Transformation) (性質変化; transform the chakra by setting different options) +--- -- The [infinite moon reader](http://naruto.wikia.com/wiki/Infinite_Tsukuyomi) (無限月読; start a local web server to continuously serve your slides) +## Two images -- The [summoning technique](http://naruto.wikia.com/wiki/Summoning_Technique) (download remark.js from the web) +.pull-left[ +![](https://octodex.github.com/images/motherhubbertocat.png) +] -You can click the links to know more about them if you want. The jutsu "Moon Reader" may seem a little evil, but that does not mean your slides are evil. +.pull-right[ +![](https://octodex.github.com/images/dinotocat.png) +] --- -class: center - -# Hand seals (印) - -Press `h` or `?` to see the possible ninjutsu you can use in remark.js. +### Definition lists can be used with HTML syntax. -![](https://upload.wikimedia.org/wikipedia/commons/7/7e/Mudra-Naruto-KageBunshin.svg) +
+
Name
+
Godzilla
+
Born
+
1952
+
Birthplace
+
Japan
+
Color
+
Green
+
--- - class: center, middle # Thanks! -Slides created via the R package [**xaringan**](https://github.com/yihui/xaringan). +Slides created via the R packages: + +[**xaringan**](https://github.com/yihui/xaringan)
+[gadenbuie/xaringanthemer](https://github.com/gadenbuie/xaringanthemer) The chakra comes from [remark.js](https://remarkjs.com), [**knitr**](http://yihui.name/knitr), and [R Markdown](https://rmarkdown.rstudio.com). diff --git a/make.R b/make.R index d6cea1bd..bc8c0714 100644 --- a/make.R +++ b/make.R @@ -11,5 +11,8 @@ unlink("README.html") message("Checking package") devtools::check(document = FALSE) +message("Checking urls") +urlchecker::url_check() + message("Building and Installing Package with Vignettes") devtools::install(build_vignettes = TRUE) diff --git a/man-roxygen/style_solarized_dark.R b/man-roxygen/style_solarized_dark.R index b682f331..6ab046e2 100644 --- a/man-roxygen/style_solarized_dark.R +++ b/man-roxygen/style_solarized_dark.R @@ -2,7 +2,7 @@ #' @description A dark theme based around on the solarized color scheme. #' Works well with "\code{highlightStyle: solarized-dark}" or #' "\code{highlighStyle: solarized-light}". -#' @references \url{http://ethanschoonover.com/solarized} +#' @references \url{https://ethanschoonover.com/solarized/} #' @examples #' # Create a xaringan style in a temporary file #' xaringan_themer_css <- tempfile("xaringan-themer-", fileext = ".css") diff --git a/man-roxygen/style_solarized_light.R b/man-roxygen/style_solarized_light.R index 62c8d605..42bda7e4 100644 --- a/man-roxygen/style_solarized_light.R +++ b/man-roxygen/style_solarized_light.R @@ -2,7 +2,7 @@ #' @description A light theme based around on the solarized color scheme. #' Works well with "\code{highlightStyle: solarized-dark}" or #' "\code{highlighStyle: solarized-light}". -#' @references \url{http://ethanschoonover.com/solarized} +#' @references \url{https://ethanschoonover.com/solarized/} #' @examples #' # Create a xaringan style in a temporary file #' xaringan_themer_css <- tempfile("xaringan-themer-", fileext = ".css") diff --git a/man/figures/lifecycle-archived.svg b/man/figures/lifecycle-archived.svg new file mode 100644 index 00000000..48f72a6f --- /dev/null +++ b/man/figures/lifecycle-archived.svg @@ -0,0 +1 @@ + lifecyclelifecyclearchivedarchived \ No newline at end of file diff --git a/man/figures/lifecycle-defunct.svg b/man/figures/lifecycle-defunct.svg new file mode 100644 index 00000000..01452e5f --- /dev/null +++ b/man/figures/lifecycle-defunct.svg @@ -0,0 +1 @@ +lifecyclelifecycledefunctdefunct \ No newline at end of file diff --git a/man/figures/lifecycle-deprecated.svg b/man/figures/lifecycle-deprecated.svg new file mode 100644 index 00000000..4baaee01 --- /dev/null +++ b/man/figures/lifecycle-deprecated.svg @@ -0,0 +1 @@ +lifecyclelifecycledeprecateddeprecated \ No newline at end of file diff --git a/man/figures/lifecycle-experimental.svg b/man/figures/lifecycle-experimental.svg new file mode 100644 index 00000000..d1d060e9 --- /dev/null +++ b/man/figures/lifecycle-experimental.svg @@ -0,0 +1 @@ +lifecyclelifecycleexperimentalexperimental \ No newline at end of file diff --git a/man/figures/lifecycle-maturing.svg b/man/figures/lifecycle-maturing.svg new file mode 100644 index 00000000..df713101 --- /dev/null +++ b/man/figures/lifecycle-maturing.svg @@ -0,0 +1 @@ +lifecyclelifecyclematuringmaturing \ No newline at end of file diff --git a/man/figures/lifecycle-questioning.svg b/man/figures/lifecycle-questioning.svg new file mode 100644 index 00000000..08ee0c90 --- /dev/null +++ b/man/figures/lifecycle-questioning.svg @@ -0,0 +1 @@ +lifecyclelifecyclequestioningquestioning \ No newline at end of file diff --git a/man/figures/lifecycle-stable.svg b/man/figures/lifecycle-stable.svg new file mode 100644 index 00000000..e015dc81 --- /dev/null +++ b/man/figures/lifecycle-stable.svg @@ -0,0 +1 @@ +lifecyclelifecyclestablestable \ No newline at end of file diff --git a/man/figures/lifecycle-superseded.svg b/man/figures/lifecycle-superseded.svg new file mode 100644 index 00000000..75f24f55 --- /dev/null +++ b/man/figures/lifecycle-superseded.svg @@ -0,0 +1 @@ + lifecyclelifecyclesupersededsuperseded \ No newline at end of file diff --git a/man/fragments/_fonts.Rmd b/man/fragments/_fonts.Rmd index 628356f4..7f6f7ead 100644 --- a/man/fragments/_fonts.Rmd +++ b/man/fragments/_fonts.Rmd @@ -45,7 +45,7 @@ _Droid Serif_, is no longer officially included in Google Fonts. If you would like to use the fonts from the -[default xaringan theme](https://slides.yihui.name/xaringan/), +[default xaringan theme](https://slides.yihui.org/xaringan/), you can use the following arguments in your style function. ```{r eval=FALSE, echo=TRUE} diff --git a/man/fragments/_thanks.Rmd b/man/fragments/_thanks.Rmd index a2b79a40..0c960427 100644 --- a/man/fragments/_thanks.Rmd +++ b/man/fragments/_thanks.Rmd @@ -5,8 +5,8 @@ **xaringanthemer** was built by [Garrick Aden-Buie](https://www.garrickadenbuie.com) ([@grrrck](https://twitter.com/grrrck)). -Big thank you to [Yihui Xie](https://yihui.name), especially for [xaringan]. -Also thanks to [Ole Petter Bang](http://gnab.org) for [remark.js][remarkjs]. +Big thank you to [Yihui Xie](https://yihui.org), especially for [xaringan]. +Also thanks to [Ole Petter Bang](http://www.gnab.org/) for [remark.js][remarkjs]. Feel free to [file an issue](https://github.com/gadenbuie/xaringanthemer/issues) if you find a bug or have a theme suggestion -- or better yet, submit a pull request! diff --git a/man/fragments/_themes.Rmd b/man/fragments/_themes.Rmd index 195dc52c..0caad42a 100644 --- a/man/fragments/_themes.Rmd +++ b/man/fragments/_themes.Rmd @@ -119,7 +119,7 @@ demo_function_call(style_duo_accent_inverse, 2) ### Solarized -There are also two themes based around the [solarized color palette](http://ethanschoonover.com/solarized), `style_solarized_light()` and `style_solarized_dark()`. +There are also two themes based around the [solarized color palette](https://ethanschoonover.com/solarized/), `style_solarized_light()` and `style_solarized_dark()`. For both themes, it is advisted to change the syntax highlighting theme to `solarized-light` or `solarized-dark` (looks great paired or constrasted). #### `style_solarized_light()` diff --git a/man/scale_xaringan.Rd b/man/scale_xaringan.Rd index 210ab1cb..b0765924 100644 --- a/man/scale_xaringan.Rd +++ b/man/scale_xaringan.Rd @@ -96,7 +96,7 @@ value of \code{inverse_header_color}} \item{end}{Number in the range of \code{[0, 1]} indicating to which point in the color scale the largest data value should be mapped.} } \description{ -\strong{Lifecycle:} \href{https://www.tidyverse.org/lifecycle/#maturing}{Maturing} +\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#maturing}{\figure{lifecycle-maturing.svg}{options: alt='[Maturing]'}}}{\strong{[Maturing]}} Color and fill single-color scales for discrete and continuous values, created using the primary accent color of the xaringanthemer styles. See diff --git a/man/style_solarized_dark.Rd b/man/style_solarized_dark.Rd index 5a1e4e06..1eabab86 100644 --- a/man/style_solarized_dark.Rd +++ b/man/style_solarized_dark.Rd @@ -442,7 +442,7 @@ style_solarized_dark( # file.edit(xaringan_themer_css) } \references{ -\url{http://ethanschoonover.com/solarized} +\url{https://ethanschoonover.com/solarized/} } \seealso{ Other themes: diff --git a/man/style_solarized_light.Rd b/man/style_solarized_light.Rd index 7354dca7..3a186f4a 100644 --- a/man/style_solarized_light.Rd +++ b/man/style_solarized_light.Rd @@ -442,7 +442,7 @@ style_solarized_light( # file.edit(xaringan_themer_css) } \references{ -\url{http://ethanschoonover.com/solarized} +\url{https://ethanschoonover.com/solarized/} } \seealso{ Other themes: diff --git a/man/theme_xaringan.Rd b/man/theme_xaringan.Rd index 14f4ab42..65a10b83 100644 --- a/man/theme_xaringan.Rd +++ b/man/theme_xaringan.Rd @@ -72,7 +72,7 @@ not available locally.} A ggplot2 theme } \description{ -\strong{Lifecycle:} \href{https://www.tidyverse.org/lifecycle/#maturing}{Maturing} +\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#maturing}{\figure{lifecycle-maturing.svg}{options: alt='[Maturing]'}}}{\strong{[Maturing]}} Creates \pkg{ggplot2} themes to match the xaringanthemer theme used in the \pkg{xaringan} slides that seamlessly matches the "normal" slide colors and diff --git a/man/theme_xaringan_base.Rd b/man/theme_xaringan_base.Rd index e4bf264b..399d5a05 100644 --- a/man/theme_xaringan_base.Rd +++ b/man/theme_xaringan_base.Rd @@ -69,7 +69,7 @@ not available locally.} A ggplot2 theme } \description{ -\strong{Lifecycle:} \href{https://www.tidyverse.org/lifecycle/#maturing}{Maturing} +\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#maturing}{\figure{lifecycle-maturing.svg}{options: alt='[Maturing]'}}}{\strong{[Maturing]}} Provides a base plot theme for \pkg{ggplot2} to match the \pkg{xaringan} slide theme created by \link{xaringanthemer}. The theme is designed to create a diff --git a/man/theme_xaringan_inverse.Rd b/man/theme_xaringan_inverse.Rd index 435b9aee..39bd0287 100644 --- a/man/theme_xaringan_inverse.Rd +++ b/man/theme_xaringan_inverse.Rd @@ -72,7 +72,7 @@ not available locally.} A ggplot2 theme } \description{ -\strong{Lifecycle:} \href{https://www.tidyverse.org/lifecycle/#maturing}{Maturing} +\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#maturing}{\figure{lifecycle-maturing.svg}{options: alt='[Maturing]'}}}{\strong{[Maturing]}} A \pkg{ggplot2} xaringanthemer plot theme to seamlessly match the "inverse" \pkg{xaringan} slide colors and styles as styled by \link{xaringanthemer}. See diff --git a/man/theme_xaringan_set_defaults.Rd b/man/theme_xaringan_set_defaults.Rd index ada1f980..7ac3475d 100644 --- a/man/theme_xaringan_set_defaults.Rd +++ b/man/theme_xaringan_set_defaults.Rd @@ -37,7 +37,7 @@ Invisibly returns a list of the current ggplot2 geom defaults Invisibly returns a list of the current ggplot2 geom defaults } \description{ -\strong{Lifecycle:} \href{https://www.tidyverse.org/lifecycle/#maturing}{Maturing} +\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#maturing}{\figure{lifecycle-maturing.svg}{options: alt='[Maturing]'}}}{\strong{[Maturing]}} Set \pkg{ggplot2} \emph{geom} defaults to match \code{\link[=theme_xaringan]{theme_xaringan()}} with \code{theme_xaringan_set_defaults()} and restore the standard or previously-set diff --git a/man/xaringanthemer-package.Rd b/man/xaringanthemer-package.Rd index 289dfea8..d1b31ab3 100644 --- a/man/xaringanthemer-package.Rd +++ b/man/xaringanthemer-package.Rd @@ -18,7 +18,7 @@ Create beautifully color-coordinated and customized \seealso{ Useful links: \itemize{ - \item \url{https://pkg.garrickadenbuie.com/xaringanthemer} + \item \url{https://pkg.garrickadenbuie.com/xaringanthemer/} \item \url{https://github.com/gadenbuie/xaringanthemer} \item Report bugs at \url{https://github.com/gadenbuie/xaringanthemer/issues} } diff --git a/vignettes/ggplot2-themes.Rmd b/vignettes/ggplot2-themes.Rmd index b46dbd36..cc8c49db 100644 --- a/vignettes/ggplot2-themes.Rmd +++ b/vignettes/ggplot2-themes.Rmd @@ -345,7 +345,7 @@ in the xaringanthemer package. ```{r eval=FALSE} font_url <- file.path( - "https://fontlibrary.org/assets/fonts/glacial-indifference", + "https://fontlibrary.org/assets/fonts/glacial-indifference/", "5f2cf277506e19ec77729122f27b1faf/0820b3c58fed35de298219f314635982", "GlacialIndifferenceRegular.ttf" )