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
The code block has an eyeball icon (<iclass="fa fa-eye"></i>) which will toggle the visibility of the hidden lines.
32
31
32
+
By default, this only works for code examples that are annotated with `rust`.
33
+
However, you can define custom prefixes for other languages by adding a new line-hiding prefix in your `book.toml` with the language name and prefix character(s):
34
+
35
+
```toml
36
+
[output.html.code.hidelines]
37
+
python = "~"
38
+
```
39
+
40
+
The prefix will hide any lines that begin with the given prefix. With the python prefix shown above, this:
41
+
42
+
```bash
43
+
~hidden()
44
+
nothidden():
45
+
~hidden()
46
+
~hidden()
47
+
nothidden()
48
+
```
49
+
50
+
will render as
51
+
52
+
```python
53
+
~hidden()
54
+
nothidden():
55
+
~ hidden()
56
+
~hidden()
57
+
nothidden()
58
+
```
59
+
60
+
This behavior can be overridden locally with a different prefix. This has the same effect as above:
61
+
62
+
~~~bash
63
+
```python,hidelines=!!!
64
+
!!!hidden()
65
+
nothidden():
66
+
!!!hidden()
67
+
!!!hidden()
68
+
nothidden()
69
+
```
70
+
~~~
71
+
33
72
## Rust Playground
34
73
35
74
Rust language code blocks will automatically get a play button (<iclass="fa fa-play"></i>) which will execute the code and display the output just below the code block.
0 commit comments