Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to load image of type pdf #149

Open
ssp3nc3r opened this issue Jan 13, 2022 · 2 comments
Open

Unable to load image of type pdf #149

ssp3nc3r opened this issue Jan 13, 2022 · 2 comments
Labels
bug an unexpected problem or unintended behavior pandoc concerns upstream pandoc reveal.js upstream lib

Comments

@ssp3nc3r
Copy link

An image of type pdf does not display on a slide either when using

knitr::include_graphics()

or markdown,

![]()

Here's an example:

---
title: "Untitled"
output: 
  revealjs::revealjs_presentation: default
---

# Slide with Plot

```{r, echo=FALSE}
pdf("myplot.pdf")
plot(x = 1:10, y = 1:10)
dev.off()
```

# load image using knitr

```{r}
knitr::include_graphics("myplot.pdf")
```

# load image using markdown

![](myplot.pdf)

Here's information from xfun::session_info('revealjs') my session?

R version 4.1.2 (2021-11-01)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Monterey 12.1, RStudio 2021.9.1.372

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     digest_0.6.29       evaluate_0.14       fastmap_1.1.0       glue_1.6.0         
  graphics_4.1.2      grDevices_4.1.2     highr_0.9           htmltools_0.5.2     jquerylib_0.1.4    
  jsonlite_1.7.2      knitr_1.37          magrittr_2.0.1      methods_4.1.2       revealjs_0.9.1.9007
  rlang_0.4.12        rmarkdown_2.11      stats_4.1.2         stringi_1.7.6       stringr_1.4.0      
  tinytex_0.36        tools_4.1.2         utils_4.1.2         xfun_0.29           yaml_2.2.1  

I've upgraded all packages and tested the issue on the development version.

@cderv
Copy link
Collaborator

cderv commented Jan 13, 2022

Thanks for the report. It seems like and issue with Pandoc

Using

❯ echo "![](myplot.pdf)" | pandoc -t revealjs
<section class="slide level6">

<p><embed data-src="myplot.pdf" /></p>
</section>

❯ echo "![](myplot.pdf)" | pandoc -t html
<p><embed src="myplot.pdf" /></p>

<embed> needs a src attribute and not a data-src. The latter is used for revealjs and this make the element not work.

It could be a special treatment by revealjs for Lazy Loading but it does not seem to work for embed element.
https://github.com/hakimel/reveal.js/blob/f7c59649fe9d72a148860220a66511cefd142907/js/controllers/slidecontent.js#L52-L59

@cderv cderv added pandoc concerns upstream pandoc plugins about revealjs plugins reveal.js upstream lib and removed plugins about revealjs plugins labels Jan 13, 2022
@cderv
Copy link
Collaborator

cderv commented Jan 13, 2022

I have opened an issue in Pandoc jgm/pandoc#7830

@cderv cderv added bug an unexpected problem or unintended behavior and removed plugins about revealjs plugins labels Jan 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug an unexpected problem or unintended behavior pandoc concerns upstream pandoc reveal.js upstream lib
Projects
None yet
Development

No branches or pull requests

2 participants