Skip to content

Commit b8f5731

Browse files
committed
remove newlines because deno's base64 decoder became more strict
1 parent 3625e76 commit b8f5731

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/core/jupyter/jupyter.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1991,7 +1991,7 @@ function mdImageOutput(
19911991
// get the data
19921992
const imageText = Array.isArray(data)
19931993
? (data as string[]).join("")
1994-
: data as string;
1994+
: (data as string).trim();
19951995

19961996
const outputFile = join(options.assets.base_dir, imageFile);
19971997
if (
@@ -2002,7 +2002,9 @@ function mdImageOutput(
20022002
// https://github.com/quarto-dev/quarto-cli/issues/9793
20032003
!/<svg/.test(imageText)
20042004
) {
2005-
const imageData = base64decode(imageText);
2005+
// we need to remove the newlines from the base64 encoded data
2006+
// because base64decode doesn't like the multiline-encoded style
2007+
const imageData = base64decode(imageText.replaceAll("\n", ""));
20062008

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

0 commit comments

Comments
 (0)