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

data-background doesn't embed base64 images in --self-contained reveal.js #3979

Closed
ntnsndr opened this issue Oct 17, 2017 · 15 comments
Closed

Comments

@ntnsndr
Copy link

ntnsndr commented Oct 17, 2017

In pandoc-discuss, I noticed this post, which has no reply, which is the best description of a problem I've been having as well.

When converting to reveal.js in --self-contained mode, images in format embed as base64, but those in the "data-background" field do not. The remain as either relative addresses or URLs, and thus are not self-contained. Is this a bug? Or is there a workaround?

I'm using version 1.17.2, and I'm running this command:
INPUT_FILE_CONVERSION_COMMAND | pandoc --smart -s -f markdown -t revealjs --self-contained --variable revealjs-url=LOCAL_FILE -o OUTPUT_FILENAME

Thanks to all contributors to mighty pandoc. I'm greatly appreciative of what you do.

@jgm
Copy link
Owner

jgm commented Oct 17, 2017 via email

@ntnsndr
Copy link
Author

ntnsndr commented Oct 17, 2017

Thanks for the prompt reply, and I'm sorry for the trouble there. I just tried on 1.19.2 and the nightly, and the problem persists on both.

@jgm
Copy link
Owner

jgm commented Oct 17, 2017

Can you give a (preferably short) input we can use to reproduce this?

@jgm
Copy link
Owner

jgm commented Oct 17, 2017

Never mind, I see how to do it.

jgm added a commit that referenced this issue Oct 17, 2017
This should help with #3979.

In my test, I got a data uri for data-background. But it didn't
actually work in the browser (the background image didn't show).
Not sure whether this is a problem in reveal.js or a problem
in pandoc...
@jgm
Copy link
Owner

jgm commented Oct 17, 2017

As noted in the commit message,

In my test, I got a data uri for data-background. But it didn't
actually work in the browser (the background image didn't show).
Not sure whether this is a problem in reveal.js or a problem
in pandoc...

@ntnsndr
Copy link
Author

ntnsndr commented Oct 18, 2017

Thanks for taking this up. Were you able to address this in the commit, or does it remain a mystery?

@jgm
Copy link
Owner

jgm commented Oct 18, 2017 via email

@jgm
Copy link
Owner

jgm commented Oct 21, 2017

Mystery removed: you need data-background-image, not data-background.

This works:

# My slide {data-background-image="test/lalune.jpg"}

Hi there

@jgm jgm closed this as completed Oct 21, 2017
jgm added a commit that referenced this issue Oct 21, 2017
@Jmuccigr
Copy link
Contributor

Is this the kind of thing that could go into the User's Manual?

PS I also notice that an empty header with the data-background-image attribute will also work, in case you don't have a header on a slide.

@jgm
Copy link
Owner

jgm commented Jan 25, 2018

If you want to propose an addition to the User's Manual, feel free, but use a separate issue or PR.

@Jmuccigr
Copy link
Contributor

Jmuccigr commented Feb 7, 2018

@jgm Thoughts on the manual PR?

@jgm
Copy link
Owner

jgm commented Feb 7, 2018 via email

@Jmuccigr
Copy link
Contributor

Jmuccigr commented Feb 7, 2018

I was wondering about that. Let me shorten it.

@Jmuccigr
Copy link
Contributor

Jmuccigr commented Feb 7, 2018

OK, @jgm, it's shortened and has passed the tests.

@gabrielodom
Copy link

I know this issue is old, but I'll leave this comment for anyone who is still looking for a solution.

I am writing a reveal.js presentation in Rmarkdown and publishing it to Rpubs. I originally had a very large figure as a fullscreen slide by using

## {background="figures/my_giant_picture.png"}

This worked when I knit the document and when I displayed it locally as a rendered .html page. However, when I published it to Rpubs, that slide was blank. I used @jgm's solution above (copied here), and everything is beautiful.

## {data-background-image="figures/my_giant_picture.png"}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants