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

Image in CSS with url() are not made self contained if included in template and not through a CSS file #8193

Closed
cderv opened this issue Jul 22, 2022 · 0 comments
Labels

Comments

@cderv
Copy link
Contributor

cderv commented Jul 22, 2022

here is how to reproduce:

Get an image

curl -o image.png https://upload.wikimedia.org/wikipedia/commons/thumb/4/48/Markdown-mark.svg/175px-Markdown-mark.svg.png

Include in CSS Property

---
title: "mwe"
header-includes: |
  <style type="text/css">
    body {
      background-image: url(image.png)
    }
  </style>
---

# Title

Convert to self contained document

pandoc -t html --self-contained -s -o test.html test.md

Image is not embeded

> cat test.html | grep 'background-image'
      background-image: url(image.png)

However, when included inside a CSS file

---
title: "mwe"
---

# Title
body {
  background-image: url(image.png)
}
pandoc -t html --self-contained -s --css style.css -o test.html test.Rmd
$ cat test.html | grep 'background-image'
<style type="text/css">body {background-image: url(data:image/png;base64, <truncated>

Is this a known limitation ? Shouldn't <style> be process the same as CSS file ?

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

No branches or pull requests

1 participant