-
Notifications
You must be signed in to change notification settings - Fork 383
Description
Bug description
Currently Quarto-rendered Jupyter notebook has their stream outputs grouped up regardless of other output within the same code cell.
Background
I managed to come across the following issue and PR, which I believe is the cause to the behaviour.
- Issue: output is split over several cells #4968
- PR: jupyter fixups: merge streams #5042
- Commit: 5ca37a3
Upon examining the code as of today, I noticed that the stream outputs for a code cells are being merged without checking whether there are anything in between the streams.
Steps to reproduce
Code a cell that outputs:
- stdout print
- a table
- stdout print
Minimal reproducible example repo is here
Expected behavior
Rendered output should show
- stdout print
- a table
- stdout print
Actual behavior
Currently quarto renders it as
- stdout print
- stdout print
- a table
Your environment
- Quarto: 1.4.549
- OS: Windows 10 x64
- IDE: VSCode 1.85.2
Quarto check output
Quarto 1.4.549
[>] Checking versions of quarto binary dependencies...
Pandoc version 3.1.11: OK
Dart Sass version 1.69.5: OK
Deno version 1.37.2: OK
[>] Checking versions of quarto dependencies......OK
[>] Checking Quarto installation......OK
Version: 1.4.549
Path: C:\Program Files\Quarto\bin
CodePage: 1252
[>] Checking tools....................OK
TinyTeX: (not installed)
Chromium: (not installed)
[>] Checking LaTeX....................OK
Using: Installation From Path
Path: [redacted]\texlive\2022\bin\win32
Version: 2022
[>] Checking basic markdown render....OK
[>] Checking Python 3 installation....OK
Version: 3.12.1 (Conda)
Path: [redacted]/python.exe
Jupyter: 5.5.1
Kernels: python3
[>] Checking Jupyter engine render....OK
[>] Checking R installation...........OK
Version: 4.3.1
Path: [redacted]/R/R-43~1.1
LibPaths:
- [redacted]/AppData/Local/R/win-library/4.3
- [redacted]/Program Files/R/R-4.3.1/library
knitr: 1.43
rmarkdown: 2.23
[>] Checking Knitr engine render......OK
Proposed solution
1: Provide an option to turn off the behaviour; OR
2: Fix fixupStreams()
I propose the following pseudocode:
When output.output_type === "stream"
is found, the function should only match with the next output
if it has a similar output_type && name
, until it fails to find one.
I have initiated a pull request for this.
Edit 1: Add minimal reproducible example repo
Edit 2: Add proposed fix pull request