-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Description
Problem
For this issue, there are two types of code blocks:
- Read-only ones, defined via
```rust
- Editable ones, defined via
```rust,editable
Read-only code blocks support the usage of #
to hide code from the view that's rendered in the browser:

You can click on the "Eye" toggle to show the hidden lines:

This makes it convenient to break an example across multiple code blocks without repeating content from the previous block (e.g., the definition of UserId
in the example above).
Instructors often need to be able to edit code directly on the slide, but we lose the hiding feature if we mark the block as editable
:

The UserId
definition is shown, even if it was prefixed with #
in the source.
Solution
Modify the theme to introduce a new button, next to the "Copy" one, which allows instructors to switch from "Preview" to "Edit" mode.
In "Preview" mode, code is rendered as if the editable
attribute had not been included.
In "Edit" mode, all hidden code is shown and the instructor is free to edit.
We won't support going back from "Edit" to "Preview" mode.