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

Embedded SVG images do not work for DOCX output #9195

Closed
svenboulanger opened this issue Nov 16, 2023 · 6 comments
Closed

Embedded SVG images do not work for DOCX output #9195

svenboulanger opened this issue Nov 16, 2023 · 6 comments
Labels

Comments

@svenboulanger
Copy link

svenboulanger commented Nov 16, 2023

Explain the problem.
I'm trying to embed images into markdown using the ![caption](data:image/...;base64,...) format.

It seems that embedding an SVG image fails somehow when exporting to DOCX. Opening the DOCX file using Word gives The picture can't be displayed-error. If I save the SVG image as an external SVG file, and add it to markdown using ![caption](file.svg), then that same SVG file will work as expected.

I tried looking into the DOCX file and one thing I noticed (unzipping it) is that the corresponding .svgz file in the media folder is correct and can be opened by other programs like inkscape, chrome, etc.

[edit] I should note that PNG images can be embedded without issue. Also, embedded SVG images do work when exporting to HTML. So it doesn't seem to me like a feature that isn't supported.

[edit] Maybe unrelated, but I'm not sure why the extension of all the SVG files are saved as .svgz files. A search on the internet seems to indicate it's a compressed version of SVG files, but they don't seem to be compressed. I noticed the same issue when converting embedded images in HTML to Markdown with the --extract-media option. All extracted images are saved as .svgz files, but the contents of those files are not compressed and they don't load in my Markdown editor unless I manually change all the extensions to .svg.

Pandoc version?
I'm using version 3.1.9 on Windows.

@jgm
Copy link
Owner

jgm commented Nov 16, 2023

Can you upload an md file I can test with?

I can see one potential issue already. At https://github.com/jgm/pandoc/blob/main/src/Text/Pandoc/Class/IO.hs#L124-L130
we seem to assume that data URIs are always base64-encoded, but they aren't.

@svenboulanger
Copy link
Author

svenboulanger commented Nov 17, 2023

Of course.
The following markdown file will translate correctly to HTML when using pandoc demo.md -s -o demo.html but the embedded SVG file will not show up in the DOCX when using pandoc demo.md -o demo.docx. The PNG is simply the rendered version of the SVG image.

[edit] Added a line for the SVG file in the next comment. That SVG file is also shown correctly in DOCX.

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IE0yOC45OSAzNCBoNiBNMzAuOTkgMzYgaDIiIC8+PC9nPjwvc3ZnPg==)

![SVG image external](test.svg)

@svenboulanger
Copy link
Author

test

This is the SVG file that was base64 encoded in the previous example.

@jgm
Copy link
Owner

jgm commented Nov 17, 2023

I can confirm that a file with an svgz extension is put in media, but that its contents are not compressed. Changing that manually in the docx file allows it to display.

So, we just need to figure out why that is happening.

jgm added a commit that referenced this issue Nov 17, 2023
- Only treat as base64 if ';base64' is present.
- Otherwise treat as UTF-8 (not 100% reliable but should cover most
  other cases).
- Strip off ';base64' (or ';charset=...' or whatever) from mime type.

This last change addresses #9195 (problems with data URIs in
conversion to docx).
@jgm
Copy link
Owner

jgm commented Nov 17, 2023

I've pushed a change that actually makes this work, but there's still a small problem to iron out -- we are still getting a .svgz extension. Otherwise everything is perfect.

@jgm
Copy link
Owner

jgm commented Nov 17, 2023

OK, I've fixed the .svgz issue too now.

@jgm jgm closed this as completed Nov 17, 2023
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

2 participants