jjallaire / code-visibility

18 stars 1 forks source link

#| hide_line not working on cell magics #1

Open knuesel opened 2 years ago

knuesel commented 2 years ago

MWE:

---
filters:
  - code-visibility
---

```{python}
%%time #| hide_line
2+2
```

Rendering this with quarto 1.2.203 fails with the following error:

Executing 'b.ipynb'
  Cell 1/1...ERROR: 

An error occurred while executing the following cell:
------------------
%%time #| hide_line
2+2
------------------

UsageError: Can't use statement directly after '%%time'!

Note: my actual use case is to implement a solution for https://github.com/quarto-dev/quarto-cli/issues/135 to run Python and Octave cells in the same document. In this case I hit another problem. For example with

---
filters:
  - code-visibility
---

```{python}
#| echo: false
%reload_ext oct2py.ipython
```

```{python}
%%octave #| hide_line
2+2
```

the rendering succeeds, but the code cell has no output.

jjallaire commented 2 years ago

Since these comments are processed after cell execution, they need to valid code for Jupyter to process (so I don't think this will ever work w/ cell magics)