quarto-dev / quarto-dev/quarto-cli

`format: ipynb` as an empty source cell when `echo: false` is used and require `output: asis` which work only in some situation

Open
#12,197 8 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug engines-julia engines-jupyter ipynb-format
Dominant language
JavaScript
Stars
6k
Forks
458
Avg merge
1d 9h
Merged PRs (30d)
41

Description

Bug description

The behavior of the #| output: asis in julia may be broken for figures, or at least is inconsistent with python. Rather than showing a figure, it displays a raw html tag

Steps to reproduce

After some digging, I think the issue might be a bug/inconsistency in the julia vs. python jupyter implementation. The combination of #| echo: false and #| output: asis is exactly what I want. For example in python take the following:

---
title: "Test Output"
jupyter: python3
format: ipynb
---

Below shouldn't display code or an empty cell
```{python}
#| echo: false
#| output: asis
import numpy as np
import matplotlib.pyplot as plt
x = np.linspace(0, 10, 100)
y = np.sin(x)
plt.plot(x, y)
```

which renders (with --to ipynb) as
image

If you rerun that notebook, it doesn't change the figure. On the other hand, if remove the #| output: asis you get an empty code cell as below. If you rerun the notebook it deletes the figure
image

Now with Julia, things are different. If I run the equivalent code to the python above:

---
title: "Test Output"
jupyter: julia-1.11
format: ipynb
---

But I just want to see the figure without any code and not be overwritten
```{julia}
#| echo: false
#| output: asis
using Plots
plot(1:10, 1:10)
```

Then I get raw HTML tags
image

However, the behavior without the asis is consistent with python (i.e., it shows the figure with an empty code cell - which will overwrite the figure if re-run). Below is without the #| output: asis
image

I am showing the vscode ipynb viewer above, but it is the same in jupyterlab.

Actual behavior

See above. It displays raw html

Expected behavior

It should show the figure without an empty code cell.

Your environment

Both windows and macos, vscode must not relevant for issue.

Quarto check output
(base) C:\Users\jesse\Documents\GitHub\ECON526_instructor>quarto check
Quarto 1.6.39
[>] Checking environment information...
      Quarto cache location: C:\Users\jesse\AppData\Local\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.39
      Path: C:\Users\jesse\AppData\Local\Programs\Quarto\bin
      CodePage: 1252

[>] 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.12.7 (Conda)
      Path: C:/Users/jesse/anaconda3/python.exe
      Jupyter: 5.7.2
      Kernels: julia-1.11, python3

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the paired Python and Julia examples with format: ipynb, echo: false, and output: asis, then compare the generated notebook outputs and rerun behavior. Done means the Julia notebook displays the figure rather than raw HTML, contains no unwanted empty code cell, and does not overwrite the figure when rerun.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia, jupyter, python
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.