quarto-dev / quarto-dev/quarto-cli

Embedding cells and notebooks with julia engine doesn't work

Open
#9,931 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Bug description

When embedding plots from another qmd file using julia engine, they are not found. Embediing the whole qmd notebook works, but changes the formatting.

Steps to reproduce

Load these two files in VS Code and hit preview in both.

file main.qmd

---
title: "`embed`ing files"
engine: julia
---

Embed whole notebook works, but the references are lost. In addition, the subfigures in the embedded file have lost their captions


{{< embed computations.qmd >}}

Embedding just one cell might fail on the second preview (try with the embedding line above commented)

{{< embed computations.qmd#second-cell  >}}

Embedding a figure doesn't work (uncomment to see)

<!-- {{< embed computations.qmd#fig-plots1  >}} -->

file computation.qmd

---
title: "Computations to embed"
engine: julia
---

Here are the computations we want to embed in another file

```{julia}
#| label: first-cell
1 + 1
```

```{julia}
#| label: second-cell
#| echo: true
2 + 2
```


```{julia}
#| echo: true
using CairoMakie;
CairoMakie.activate!(; type = "png");
```

and a figure @fig-plots1 below. For @fig-plots1-2 to be able to render for larger values of `s` (try with `s=500`), we might want to set `CairoMakie` to output `png` files as shown above


```{julia}
#| label: fig-plots1
#| fig-cap: "Two random arrays"
#| fig-subcap:
#|   - "Small array"
#|   - "Large array"
#| layout-ncol: 2
#| echo: false

s = 20
display(heatmap(rand(10,10), axis = (aspect = DataAspect(),)))
display(heatmap(rand(s,s), axis = (aspect = DataAspect(),)));
```


Expected behavior

Cells from computations.qmd are embedded in the same format as they are rendered independently

Actual behavior

By the first preview of main.qmd the whole notebook is embedded in a different format; the computation cell is embedded as it should. By the second preview, this error message might appear:

NotFound: The system cannot find the file specified. (os error 2): readfile 'D:\Documents\Quarto learning\Quarto and Julia\embed test\computations.embed.ipynb'
Path: D:\Documents\Quarto learning\Quarto and Julia\embed test\computations.embed.ipynb

When trying to embed the plot, this error appears:

ERROR: The cell fig-plots1 does not exist in notebook   

Your environment
  • IDE: VS Code
  • Windows 10
  • julia 1.10
Quarto check output
Quarto 1.5.42
[>] Checking versions of quarto binary dependencies...
      Pandoc version 3.2.0: OK
      Dart Sass version 1.70.0: OK
      Deno version 1.41.0: OK
      Typst version 0.11.0: OK
[>] Checking versions of quarto dependencies......OK
[>] Checking Quarto installation......OK
      Version: 1.5.42
      Path: C:\Users\olegs\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.9.13 (Conda)
      Path: D:/Anaconda3/python.exe
      Jupyter: 5.3.0
      Kernels: aocourse, julia-1.10, julia-1.9, python3

[>] Checking Jupyter engine render....OK

[>] Checking R installation...........(None)     

      Unable to locate an installed version of R.
      Install R from https://cloud.r-project.org/

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

Reproduce the issue in VS Code using main.qmd and computations.qmd, checking whole-notebook, cell, and figure embedding across successive previews. Trace the Julia-engine embedding path from these examples and compare the generated embedded notebook and references. Done means embedded cells and figures render with the same formatting, captions, and references as computations.qmd rendered independently.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
tooling
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.