Skip to content

Commit 3ee5d60

Browse files
committed
update recipe on remove-input
1 parent d2ee6f5 commit 3ee5d60

File tree

3 files changed

+29
-52
lines changed

3 files changed

+29
-52
lines changed

notebooks/0-00-intro-nb.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ summarize most of our notebook recipes, regarding among others
4848
note that collapsible also applies to admonitions
4949
5050
* exercises
51-
* hide-input artefact (a code cell whose input code is hidden)
51+
* remove-input artefact (a code cell whose input code is hidden)
5252
* miscell usual tricks (link to a downloadable file, iframe with some static html, ...)
5353
* courselevels - mostly deprecated:
5454
* using tags to specifiy a level among basic=green, intermediate=blue, advanced=red

notebooks/1-02-videos-nb.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ IFrame(
3333
)
3434
```
3535

36-
## ditto with `hide-input`
36+
## ditto with `remove-input`
3737

3838
the same with the input area hidden with
3939

notebooks/1-11-hideinput-nb.md

Lines changed: 27 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -13,78 +13,55 @@ language_info:
1313
pygments_lexer: ipython3
1414
---
1515

16-
# hide-input
16+
# remove-in/output
1717

18-
+++
18+
these 2 tags (`remove-input` and `remove-output`) are effective ***on code cells only***
1919

20-
this may require some more checking but IIRC the `jupyterlab-courselevels` may be required for this to work properly
20+
the feature is activated through the code cell's `metadata.tags` that contain `remove-input` or remove-output`
2121

22-
+++
22+
## textual input
2323

24-
## code cells
25-
26-
+++
27-
28-
````{caution}
29-
the next code cells are marked as `metadata.tags` contains `hide-input`
30-
31-
on a historical note: in nbclassic this used to be marked with `metadata.hide_input=true`
32-
````
33-
34-
+++
35-
36-
````{note}
37-
38-
* thanks to (1) the jb HTML output will come as a collapsible
39-
* thanks to the `jupyterlab-courselevels` extension, with (1) the code cell input should be hidden in jupyterlab (and hopefully nb7 as well)
40-
* because of (2) the cell input will not show under nbclassic
41-
this requires the jupyter contrib extensions installed, and the hide-input extension enabled
42-
````
43-
44-
+++
45-
46-
↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓ 2 hide-input cells below
24+
here's the textual input for the first cell below
4725

26+
````text
4827
```{code-cell} ipython3
4928
:tags: [remove-input]
50-
51-
# this text should be hidden
52-
print("should show the output but not the code")
29+
print("with remove-input we show the output but not the code")
5330
```
31+
````
32+
33+
## `remove-input`
34+
35+
↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓ 1 remove-input code cell below
5436

5537
```{code-cell} ipython3
5638
:tags: [remove-input]
57-
58-
# this text should be hidden
59-
print('and another hide-input cell')
39+
print("with remove-input we show the output but not the code")
6040
```
6141

62-
↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑ hide-input cells above
63-
64-
+++
42+
↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑ hide-input cell above
6543

66-
## 2 visible cells, one text and one code
44+
## `remove-output`
6745

68-
+++
69-
70-
with one markdown cell (this very one) and one code cell
46+
↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓ 1 remove-output code cell below
7147

7248
```{code-cell} ipython3
73-
# code (visible)
74-
print("hello")
49+
:tags: [remove-output]
50+
print("this time we see the code and not the output")
7551
```
7652

77-
## same with hide-input
78-
79-
below we repeat these 2 cells, with hide-input set
53+
↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑ remove-output cell above
8054

81-
+++ {"tags": ["remove-input"]}
55+
## `remove-cell`
8256

83-
a (hidden-input) markdown cell wont show up at all
57+
↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓ 1 remove-cell code cell below
8458

8559
```{code-cell} ipython3
86-
:tags: [remove-input]
60+
:tags: [remove-cell]
8761
88-
# code (hidden-input) will just produce an output, but won't show up
89-
print("hello")
62+
# this time we see nothing
63+
print("should show the code but not the output")
9064
```
65+
66+
↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑ remove-cell cell above
67+

0 commit comments

Comments
 (0)