Skip to content

Jupyter notebook non-adjacent stream outputs rendered as a group #8473

@loneguardian

Description

@loneguardian

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.

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:

  1. stdout print
  2. a table
  3. stdout print

Minimal reproducible example repo is here

Expected behavior

Rendered output should show

  1. stdout print
  2. a table
  3. stdout print

Actual behavior

Currently quarto renders it as

  1. stdout print
  2. stdout print
  3. 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

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingjupyterverify-fixedAlready fixed, awaiting verification from the issue reporter to confirm.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions