Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions news/changelog-1.5.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ All changes included in 1.5:
- ([#9422](https://github.com/quarto-dev/quarto-cli/issues/9422)): Improve the stream merging algorithm in output cells to avoid merging outputs that should not be merged.
- ([#9536](https://github.com/quarto-dev/quarto-cli/issues/9536)): Provide traceback when available in Jupyter error outputs.
- ([#9470](https://github.com/quarto-dev/quarto-cli/issues/9470)): Fix images rendered by the Jupyter engine to be displayed with the same dimensions as those in notebooks.
- ([#5413](https://github.com/quarto-dev/quarto-cli/issues/5413)): Fix issue with Jupyter engine cells and images with captions containing newlines.

## Website Listings

Expand Down
7 changes: 6 additions & 1 deletion src/core/jupyter/jupyter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1326,7 +1326,12 @@ async function mdFromCodeCell(
}

// resolve caption (main vs. sub)
const { cellCaption, outputCaptions } = resolveCaptions(cell);
let { cellCaption, outputCaptions } = resolveCaptions(cell);

// https://github.com/quarto-dev/quarto-cli/issues/5413
outputCaptions = outputCaptions.map((caption) =>
caption.trim().replaceAll("\n", " ")
);

// cell_type classes
divMd.push(`.cell `);
Expand Down
21 changes: 21 additions & 0 deletions tests/docs/smoke-all/2024/06/12/5413.qmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
title: issue-5413
_quarto:
tests:
html:
ensureHtmlElements:
- ["figcaption.quarto-float-fig"]
- []
---

```{python}
#| label: fig-1
#| fig-cap: |
#| This is a caption for my figure.
#| It is long, so I put it onto two lines
import numpy as np
import matplotlib.pyplot as plt
plt.plot(np.arange(10))
```

See @fig-1.