-
Notifications
You must be signed in to change notification settings - Fork 365
Description
Discussed in #11685
Originally posted by anandology December 14, 2024
Description
The quarto convert
command when converting from qmd
to ipynb
, drops all the code cells which are empty. This may be fine in most use cases, there are cases where this is undesirable.
It would be nice to have an option to retain empty code cells as well.
Sample Use Case
I teach programming courses and I use quarto convert
to generate ipynb files
from qmd
sources. These notebooks are used by the students of the course. The following is an example where empty cells are needed.
The following code creates a new function `square`.
```{python}
def square(x):
return x*x
```
```{python}
square(4)
````
Can you try creating a new function `cube` to compute cube a of number
in the following cell?
```{python}
```
Check if your `cube` function is working correctly by running the following examples.
```{python}
print(cube(2))
print(cube(3))
print(cube(4))
```
The issue
The third code cell in the above example gets dropped.
The work-around is to make the code cell not empty by adding a comment, but I would prefer to keep it empty.
The Code
The part of the code that drops empty cells is at:
https://github.com/quarto-dev/quarto-cli/blob/main/src/core/jupyter/jupyter.ts#L422