Skip to content

dev metadata key not honoured #368

@fkohrt

Description

@fkohrt

It seems that the dev key that can be set as part of the YAML frontmatter is not being passed on to rmarkdown::html_document(). The following R Markdown document creates a Xaringan presentation with PNG graphics instead of SVG graphics:

---
title: SVG Figure Test
output:
  xaringan::moon_reader:
    dev: "svg"
---

```{r}
#| pie,
#| echo = FALSE,
#| fig.cap = "The only acceptable use of a pie chart.",
#| fig.alt = "A pie chart with slices of 78%, 17% and 6%. The positioning and coloring of the slices create the impression of a three-dimensional pyramid with a sunny and a shady side and a blue sky above."

# see https://github.com/rstudio/blogdown/blob/8719aa7/inst/resources/hello-world.Rmd#L27-L35
# and https://svn.r-project.org/R/tags/R-3-3-0/src/library/graphics/man/pie.Rd
par(mar = c(0, 1, 0, 1))
pie(
  c("Sky" = 280, "Sunny side of pyramid" = 60, "Shady side of pyramid" = 20),
  col = c('#0292D8', '#F7EA39', '#C4B632'),
  init.angle = -50, border = NA
)
```

Only setting the chunk option dev = "svg" (or using knitr::opts_chunk$set(dev = "svg")) creates SVG figures.

xfun::session_info("xaringan")
R version 4.2.1 (2022-06-23)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 18.04.6 LTS, RStudio 2022.2.1.461

Locale:
  LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
  LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
  LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
  LC_PAPER=en_US.UTF-8       LC_NAME=C                 
  LC_ADDRESS=C               LC_TELEPHONE=C            
  LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

Package version:
  base64enc_0.1.3   bslib_0.4.2       cachem_1.0.7     
  cli_3.6.1         digest_0.6.31     ellipsis_0.3.2   
  evaluate_0.20     fastmap_1.1.1     fontawesome_0.5.0
  fs_1.6.1          glue_1.6.2        graphics_4.2.1   
  grDevices_4.2.1   highr_0.10        htmltools_0.5.5  
  httpuv_1.6.9      jquerylib_0.1.4   jsonlite_1.8.4   
  knitr_1.42        later_1.3.0       lifecycle_1.0.3  
  magrittr_2.0.3    memoise_2.0.1     methods_4.2.1    
  mime_0.12         promises_1.2.0.1  R6_2.5.1         
  rappdirs_0.3.3    Rcpp_1.0.10       rlang_1.1.0      
  rmarkdown_2.21    sass_0.4.5        servr_0.26       
  stats_4.2.1       stringi_1.7.12    stringr_1.5.0    
  tinytex_0.44      tools_4.2.1       utils_4.2.1      
  vctrs_0.6.1       xaringan_0.28.1   xfun_0.38        
  yaml_2.3.7       

By filing an issue to this repo, I promise that

  • I have fully read the issue guide at https://yihui.org/issue/.
  • 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.
  • 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions