Closed joelostblom closed 1 month ago
Interestingly if I set both edit: false
and echo: false
the code block is hidden as expected
What is the behavior you'd like to see here? Just the output with no source code or webr UI (start over, run code buttons)?
I think the right behaviour here should be:
echo: false
, edit: true
: The code editor is shown, output is suppressed.
echo: false
, edit: false
: The source is shown as a fixed code block, output is suppressed.
echo: true
, edit: true
: (Default): The code editor is shown, output is shown.
echo: true
, edit: false
: The source is shown as a fixed code block, output is shown.
EDIT: I am confused, see below comments.
include: false
: The code is executed in the Wasm engine but with no visual elements are shown on the page. edit
and echo
are ignored.
Happy to see any other thoughts or opinions on this behaviour. Notably, the current implementation does not act as above:
Currently, include: false
visually behaves correctly but does not execute the source in the Wasm engine.
What is the behavior you'd like to see here? Just the output with no source code or webr UI (start over, run code buttons)?
I was expecting echo: false
to suppress the entire input element and only show the output, so no buttons visible (similar to currently setting both edit: false
and echo: false
). To me, this would be the most similar to how echo: false
currently works for regular quarto code blocks, but as long as there is an easy option to execute code in webassembly without showing it, I don't feel too strongly about which of the suggested approaches achieves that.
Happy to see any other thoughts or opinions on this behaviour.
Interesting that you mention that echo
is used to suppress the output rather than the source code. Wouldn't this be what the output
cell option is for?
include: false visually behaves correctly but does not execute the source in the Wasm engine.
Thanks for clarifying this; my expectation was also that these cells should be executed but couldn't figure out why they weren't when I tried it.
Interesting that you mention that
echo
is used to suppress the output rather than the source code. Wouldn't this be what theoutput
cell option is for?
Oh shoot, looks like I had gotten myself quite confused when I wrote that comment! You’re right, output is controlled elsewhere.
Let’s try that again:
echo: true
, edit: true
: (Default): The code editor is shown.
echo: true
, edit: false
: The source is shown as a fixed code block.
echo: false
, edit: false
: No source block or editor is shown.
echo: false
, edit: true
: Does this make sense? Either an error, or possibly echo: false
wins and no source or editor is shown, but this feels strange with edit: true
set.
include: false
: similar to echo: false
, edit: false
, but also suppresses output.
Hopefully that looks more reasonable!
That looks exactly like I would expect! I agree that the last option (echo: false
, edit: true
) doesn't really make sense and think that an error message is probably the clearest behavior in that case (but echo
taking precedence would also be fine I think).
And having include: false
being equivalent echo: false
, edit: false
, output: false
makes sense to me as convenient shortcut (maybe explicitly mentioned in the api ref for clarity). I guess in this sense one could also think of include: false
as a setup code block targeting the global env, so if there was an easy way to do that via setup
, then maybe include
is a redundant option (this is a minor comment though)?
It seems like specifying
echo: false
still includes the source code in the ouput document