ipynb - check if svg display data is encoded or not #9795
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
fixes #9793
We assumed svg mime type data was never encoded.
However, this is not the case when the Notebook file is produced by a pandoc convert
--to ipynb
. In this case, Pandoc will base64 encode the svg file. The svg data needs to be decoded before being written to the file at embedding time.Welcome to the quarto GitHub repo!For Quarto, this will mostly happens in render context when embed is used as we generate this type of ipynb document internally.
It could also happens if a Python code in cell would also output a
display_data
with svg mime type and encoded data. It does not seem to be the common usage.This is quite a narrow fix I believe, and as mentioned in #9793 , this is doing the same kind of check that we do in another function
quarto-cli/src/core/jupyter/jupyter.ts
Lines 991 to 997 in 122b0f3
cc @cwickham if you want to try on your side, though I added your example as a test