Skip to content

Examples with hidden lines should be editable #2811

@LukeMathWalker

Description

@LukeMathWalker

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:

Image

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

Image

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:

Image

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.

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions