rstudio / revealjs

R Markdown Format for reveal.js Presentations
Other
325 stars 86 forks source link

Update to next reveal release for self-contained and background-image to work #137

Open cderv opened 2 years ago

cderv commented 2 years ago

This is something at the pandoc / reveal level

curl --output background.jpg -L 'https://unsplash.com/photos/8OyKWQgBsKQ/download?force=true&w=1920'

echo "# Slide {data-background-image='background.jpg'}" > slide.md
echo "" >> slide.md
echo "Content" >> slide.md

# Not self contained 
pandoc -t revealjs -s -o slide.html --metadata title="test" slide.md

# Self contained
pandoc -t revealjs --self-contained -o slide-self-contained.html --metadata title="test" slide.md

data-uri are not loaded. I believe mainly because the content of data-background-url is passed to url() in the slide section by reveal

Source is

data-background-image="data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEASABIAAD/4gIcSUNDX1BST0ZJTEUAAQEAAAIMbGNtcwIQAABtbnRyUkdCIFhZWiAH3AABABkAAwApADlhY3NwQVBQTAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA9tYAAQAAAADTLWxjbXMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAApkZXNjAAAA/

But after reveal.js process, it gets wrongly split into two url() call

<div class="slide-background-content" style="background-image: url(&quot;data:image/jpeg;base64&quot;), url(&quot;/9j/4AAQSkZJRgABAQEASABIAAD/4gIcSUNDX1BST0ZJTEUAAQEAAAIMbGNtcwIQAABtbnRyUkdCIFhZWiAH3AABABkAAwApADlhY3NwQVBQTAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA9tYAAQAAAADTLWxjbXMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAApkZXNjAAAA/

Should be as with reveal.js 3

<div class="slide-background-content" style="background-image: url(&quot;data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEASABIAAD/4gIcSUNDX1BST0ZJTEUAAQEAAAIMbGNtcwIQAABtbnRyUkdCIFhZWiAH3AABABkAAwApADlhY3NwQVBQTAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA9tYAAQAAAADTLWxjbXMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAApkZXNjAAAA/

Issue opened on Pandoc discuss to have thoughts from Pandoc teams : https://groups.google.com/g/pandoc-discuss/c/LcbGvVRDoSw

cderv commented 2 years ago

Found the related issue: https://github.com/hakimel/reveal.js/issues/2978

This is a regression from 4.1.1 when support for multiple background image was added

I'll comment there.

cderv commented 2 years ago

This is now fixed in dev version of revealjs https://github.com/hakimel/reveal.js/commit/05e57dea66529a1b472f743f8ac520fb8bed0ba2

Hoepfully, we'll get a release soon to include