You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/jupyter_contrib_nbextensions/nbextensions/exercise/readme.md
+20-8Lines changed: 20 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,7 +10,7 @@ enabled.
10
10
The example below demonstrates some of the features of the exercise extensions.
11
11
12
12
- First, an solution or "details" cell is created by (a) selecting two cells with the rubberband and (b) clicking on the menu-button [exercise extension]
13
-
- Second, the two next cells are selected using the keyboard shortcut Shift-J and a solution is created using the shortcut Alt-D [exercise2 extension]
13
+
- Second, the two next cells are selected using a keyboard shortcut, and a solution is created using the shortcut Alt-D [exercise2 extension]
14
14
- Third, the two solutions are expanded by clicking on the corresponding widgets
15
15
- Fourth, the solutions are removed by selecting them and clicking on the buttons in the toolbar.
16
16
@@ -23,18 +23,30 @@ The extensions provide
23
23
- a menubar button
24
24
- a cell widget -- A plus/minus button in `exercise` and a sliding checkbox in `exercise2`.
25
25
26
-
The menubar button is devoted to the creation or removing of the solution. The solution consists in several consecutive cells that can be selected either by multicell selection (*Shift-J* (select next) or *Shift-K* (select previous) keyboard shortcuts --
27
-
*Shift-up* and *Shift-down* will probably work in a near future) or using the rubberband extension.
26
+
The menubar button is devoted to the creation or removing of the solution. The solution consists in several consecutive cells that can be selected by the usual notebook multicell selection methods (e.g. *Shift-down* (select next) or *Shift-up* (select previous) keyboard shortcuts, or using the rubberband extension.
27
+
28
+
29
+
### Creating a solution
28
30
29
-
**Creating a solution **
30
31
Several cells being selected, pressing the menubar button adds a `cell widget` and hides the cells excepted the first one which serves as a heading cell. *Do not forget to keep the Shift key pressed down while clicking on the menu button
31
32
(otherwise selected cells will be lost)*. It is also possible to use a keyboard shortcut for creating the solution from selected cells: Alt-S for exercise extension and Alt-D for exercise2.
32
33
33
-
**Removing a solution** If a solution heading (first) cell is selected, then clicking the menu bar button removes this solution and its solutions cells are shown. Using the keyboard shortcut has the same effect.
34
34
35
-
**Showing/hiding solution** At creation of the solution, the solution cells are hidden. Clicking the `cell widget` toggles the hidden/shown state of the solution.
35
+
### Removing a solution
36
+
37
+
If a solution heading (first) cell is selected, then clicking the menu bar button removes this solution and its solutions cells are shown. Using the keyboard shortcut has the same effect.
38
+
39
+
40
+
### Showing/hiding solution
41
+
42
+
At creation of the solution, the solution cells are hidden. Clicking the `cell widget` toggles the hidden/shown state of the solution.
43
+
44
+
45
+
### Persistence
46
+
47
+
The state of solutions, hidden or shown, is preserved and automatically restored at startup and on reload.
36
48
37
-
**Persistence** The state of solutions, hidden or shown, is preserved and automatically restored at startup and on reload.
38
49
39
-
**Internals** exercise and exercise2 add respectively a solution and solution2 metadata to solution cells, with for value the current state hidden/shown of the solution. For exercise, a div with the plus/minus character is prepended to the solution heading cell. For exercise2, a flex-wrap style is added to the solution heading cell and a checkbox widget, with some css styling, is appended to the cell.
50
+
### Internals
40
51
52
+
exercise and exercise2 add respectively a solution and solution2 metadata to solution cells, with for value the current state hidden/shown of the solution. For exercise, a div with the plus/minus character is prepended to the solution heading cell. For exercise2, a flex-wrap style is added to the solution heading cell and a checkbox widget, with some css styling, is appended to the cell. A solution[.2]_first metadada is also added to enable an easy detection of the first cell in an "exercise" and then allow several consecutive exercises.
These are two extensions for Jupyter, for hiding/showing solutions cells.
4
5
They use the same approach and codebase and differ only by the type of
@@ -9,30 +10,43 @@ enabled.
9
10
The example below demonstrates some of the features of the exercise extensions.
10
11
11
12
- First, an solution or "details" cell is created by (a) selecting two cells with the rubberband and (b) clicking on the menu-button [exercise extension]
12
-
- Second, the two next cells are selected using the keyboard shortcut Shift-J and a solution is created using the shortcut Alt-D [exercise2 extension]
13
+
- Second, the two next cells are selected using a keyboard shortcut, and a solution is created using the shortcut Alt-D [exercise2 extension]
13
14
- Third, the two solutions are expanded by clicking on the corresponding widgets
14
15
- Fourth, the solutions are removed by selecting them and clicking on the buttons in the toolbar.
15
16
16
17

17
18
18
19
19
-
## The extensions provide
20
+
The extensions provide
21
+
----------------------
20
22
21
23
- a menubar button
22
24
- a cell widget -- A plus/minus button in `exercise` and a sliding checkbox in `exercise2`.
23
25
24
-
The menubar button is devoted to the creation or removing of the solution. The solution consists in several consecutive cells that can be selected either by multicell selection (*Shift-J* (select next) or *Shift-K* (select previous) keyboard shortcuts --
25
-
*Shift-up* and *Shift-down* will probably work in a near future) or using the rubberband extension.
26
+
The menubar button is devoted to the creation or removing of the solution. The solution consists in several consecutive cells that can be selected by the usual notebook multicell selection methods (e.g. *Shift-down* (select next) or *Shift-up* (select previous) keyboard shortcuts, or using the rubberband extension.
27
+
28
+
29
+
### Creating a solution
26
30
27
-
**Creating a solution **
28
31
Several cells being selected, pressing the menubar button adds a `cell widget` and hides the cells excepted the first one which serves as a heading cell. *Do not forget to keep the Shift key pressed down while clicking on the menu button
29
32
(otherwise selected cells will be lost)*. It is also possible to use a keyboard shortcut for creating the solution from selected cells: Alt-S for exercise extension and Alt-D for exercise2.
30
33
31
-
**Removing a solution** If a solution heading (first) cell is selected, then clicking the menu bar button removes this solution and its solutions cells are shown. Using the keyboard shortcut has the same effect.
32
34
33
-
**Showing/hiding solution** At creation of the solution, the solution cells are hidden. Clicking the `cell widget` toggles the hidden/shown state of the solution.
35
+
### Removing a solution
36
+
37
+
If a solution heading (first) cell is selected, then clicking the menu bar button removes this solution and its solutions cells are shown. Using the keyboard shortcut has the same effect.
38
+
39
+
40
+
### Showing/hiding solution
41
+
42
+
At creation of the solution, the solution cells are hidden. Clicking the `cell widget` toggles the hidden/shown state of the solution.
43
+
44
+
45
+
### Persistence
46
+
47
+
The state of solutions, hidden or shown, is preserved and automatically restored at startup and on reload.
34
48
35
-
**Persistence** The state of solutions, hidden or shown, is preserved and automatically restored at startup and on reload.
36
49
37
-
**Internals** exercise and exercise2 add respectively a solution and solution2 metadata to solution cells, with for value the current state hidden/shown of the solution. For exercise, a div with the plus/minus character is prepended to the solution heading cell. For exercise2, a flex-wrap style is added to the solution heading cell and a checkbox widget, with some css styling, is appended to the cell. A solution[.2]_first metadada is also added to enable an easy detection of the first cell in an "exercise" and then allow several consecutive exercises.
50
+
### Internals
38
51
52
+
exercise and exercise2 add respectively a solution and solution2 metadata to solution cells, with for value the current state hidden/shown of the solution. For exercise, a div with the plus/minus character is prepended to the solution heading cell. For exercise2, a flex-wrap style is added to the solution heading cell and a checkbox widget, with some css styling, is appended to the cell. A solution[.2]_first metadada is also added to enable an easy detection of the first cell in an "exercise" and then allow several consecutive exercises.
0 commit comments