-
Notifications
You must be signed in to change notification settings - Fork 409
Description
Bug description
A code block with intermediate print statements appears to be splitting the code block into two when rendering html (minor bug) and truncating the code block at the print when rendering ipynb (major bug).
Steps to reproduce
Considering the following qmd file, where the only difference in behavior is if the print("getting all analyses") is kept or commented out.
---
title: Test Notebook
format:
html:
embed-resources: true
ipynb:
default
---
```{r login}
# Stub to get analysis
get_analysis <- function() {
print("getting all analyses") # this line is commented out for notebook_no_print results
analysis <- list(
list(analysis_name = "AvsB", id = 2),
list(analysis_name = "CvsD", id = 3)
)
analysis
}
# Get analysis
analysis <- get_analysis()
# Filter Analysis
analysis <- purrr::keep(
analysis,
\(it) it$analysis_name == "AvsB"
)[[1]] |> as.list()
analysis
```quarto render notebook_print.qmd and quarto notebook_no_print.qmd create the two bug states. Since I am unable to attach the html and ipynb, I will paste screenshots below.
notebook_no_print
html
ipynb
notebook_print
html
ipynb
Actual behavior
Code blocks with print in the middle split the code block in html (and truncate for ipynb). Other formats may also be impacted.
Expected behavior
I think in both cases the code blocks shouldn't be split (and certainly not truncated).
I think the correct behavior would be for the notebook_print case to behave like notebook_no_print case where all output being rendered after the code block. This also ensures the behavior similar to jupyter and also keeps code blocks together.
FWIW, this doesn't seem to be an issue when using {python}. The output looks as expected and the notebook is fine as well:
Your environment
- Shell: zsh 5.9 (arm64-apple-darwin24.0)
- OS: MacOS Sequoia 15.4
Quarto check output
Quarto 1.6.42
[✓] Checking environment information...
Quarto cache location: /Users/hguturu/Library/Caches/quarto
[✓] Checking versions of quarto binary dependencies...
Pandoc version 3.4.0: OK
Dart Sass version 1.70.0: OK
Deno version 1.46.3: OK
Typst version 0.11.0: OK
[✓] Checking versions of quarto dependencies......OK
[✓] Checking Quarto installation......OK
Version: 1.6.42
Path: /Applications/quarto/bin
[✓] Checking tools....................OK
TinyTeX: (not installed)
Chromium: (not installed)
[✓] Checking LaTeX....................OK
Tex: (not detected)
[✓] Checking basic markdown render....OK
[✓] Checking Python 3 installation....OK
Version: 3.11.11
Path: /Users/hguturu/git/pas-ai-notebooks-internal/.venv/bin/python3
Jupyter: 5.7.2
Kernels: python3, ir
[✓] Checking Jupyter engine render....OK
[✓] Checking R installation...........OK
Version: 4.4.3
Path: /Library/Frameworks/R.framework/Resources
LibPaths:
- /Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/library
knitr: 1.50
rmarkdown: 2.29
[✓] Checking Knitr engine render......OK



