Skip to content

Commit 2542e4d

Browse files
committed
fix: correctly check for length of array
1 parent 7124535 commit 2542e4d

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/core/jupyter/jupyter.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1555,11 +1555,18 @@ async function mdFromCodeCell(
15551555

15561556
for (const { index, output } of sortedOutputs) {
15571557
// compute output label
1558-
const outputLabel = label && (labelCellContainer || Array.isArray(sortedOutputs)) && isDisplayData(output)
1558+
const outputLabel = label &&
1559+
(
1560+
labelCellContainer ||
1561+
(Array.isArray(sortedOutputs) && (sortedOutputs.length > 1))
1562+
) &&
1563+
isDisplayData(output)
15591564
? (label + "-" + nextOutputSuffix++)
15601565
: label;
15611566
// If the user specifies a top-level array for images but also labels give a warning.
1562-
if (labelCellContainer === false && Array.isArray(sortedOutputs) == true) {
1567+
if (labelCellContainer === false &&
1568+
(Array.isArray(sortedOutputs) == true && (sortedOutputs.length > 1))
1569+
) {
15631570
warning("Warning: using multiple top-level figures with labels might result in unwanted behaviour.")
15641571
}
15651572
// If this output has been marked to not be displayed

0 commit comments

Comments
 (0)