quarto-dev / quarto

Quarto open-source scientific and technical publishing system
https://quarto.org
GNU Affero General Public License v3.0
280 stars 19 forks source link

Commenting does not stop python block from executing. #347

Closed yuxi-liu-wired closed 5 months ago

yuxi-liu-wired commented 5 months ago
---
title: "Test"
---

<!-- 
\```{python}
assert False
\```
-->

(Sorry but I can't put triple ticks inside triple ticks here)

Gives

> quarto render .\index.qmd

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

An error occurred while executing the following cell:
------------------
assert False
------------------

---------------------------------------------------------------------------
AssertionError                            Traceback (most recent call last)
Cell In[2], line 1
----> 1 assert False

AssertionError:
cderv commented 5 months ago

To stop execution, you need to set eval: false on the cell or globally in your YAML config. https://quarto.org/docs/computations/execution-options.html#output-options

Commenting using HTML syntax is not something that will prevent execution.

Also, when using jupyter engine, commenting the cell around HTML comment is not something that I think would be supported to ignore a code execution. Setting eval: false in the cell should work though.

Out of curiosity, why did you expect this syntax to work ? Have you seen this shown somewhere ?

cscheid commented 5 months ago

I'm going to go ahead and close this one (we can keep the discussion going, but this is clearly not a bug.)