Skip to content

Commit ab0d4d2

Browse files
committed
Don't test only for svg at the start
It seems Jupyter can output as svg mimetime a whole html document.
1 parent 83d0bd7 commit ab0d4d2

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/core/jupyter/jupyter.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1930,11 +1930,15 @@ function mdImageOutput(
19301930
? (data as string[]).join("")
19311931
: data as string;
19321932

1933-
// base64 decode if it's not encoded svg
1934-
// when used in embed context, Pandoc will generate ipynb with base64 encoded svg data
1935-
// https://github.com/quarto-dev/quarto-cli/issues/9793
19361933
const outputFile = join(options.assets.base_dir, imageFile);
1937-
if (mimeType !== kImageSvg || !imageText.trimStart().startsWith("<svg")) {
1934+
if (
1935+
// base64 decode if it's not svg
1936+
mimeType !== kImageSvg ||
1937+
// or if it is encoded svg; this could happen when used in embed context,
1938+
// as Pandoc will generate ipynb with base64 encoded svg data
1939+
// https://github.com/quarto-dev/quarto-cli/issues/9793
1940+
!/<svg/.test(imageText)
1941+
) {
19381942
const imageData = base64decode(imageText);
19391943

19401944
// if we are in retina mode, then derive width and height from the image

0 commit comments

Comments
 (0)