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

--embed-resources drops the classes of embedded image when embedding element has classes of their own #9652

Closed
cscheid opened this issue Apr 12, 2024 · 1 comment · Fixed by #9653
Labels

Comments

@cscheid
Copy link
Contributor

cscheid commented Apr 12, 2024

Explain the problem.

When --embed-resources is used to embed an svg file that contains classes, and the image element that references it also contains classes, then pandoc picks the classes of the image element and drops those of the svg element.

Instead, I believe it should merge the two class lists. Repro follows:

$ cat svg_in.html
<img class="something" src="svg_with_classes.svg" />
$ cat svg_with_classes.svg
<?xml version='1.0' encoding='UTF-8' ?>
<svg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' class='please-do-not-delete-me' width='504.00pt' height='360.00pt' viewBox='0 0 504.00 360.00'>
</svg>
$ pandoc --embed-resources -f html -t html svg_in.html
<svg id="svg_b627f92299158b36552b" role="img" class="something" width="504.00pt" height="360.00pt" viewBox="0 0 504.00 360.00">
</svg>

Note that please-do-not-delete-me is missing from the result.

Pandoc version?

Pandoc 3.1.13, built from the github repo on macOS 13.5.2 (22G91), Apple Silicon.

I'll contribute the fix to this one, it affects Quarto's embedding of R plots with the svglite graphics device.

@jgm
Copy link
Owner

jgm commented Apr 12, 2024

Sounds good, I'll await your PR.

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

Successfully merging a pull request may close this issue.

2 participants