Questions
Objectives
A group of notebook cells can be grouped together into an environment using the multicell functionality. This is done using a keyword, followed by a plus (+
). From that point on in the notebook all cells, including code and raw cells, are part of the multicell environment. The multicell is terminated using : keyword +
, after which cells behave as normal.
Multicell support is still considered experimental, so be wary that there may still be some bugs in the functionality and unexpected behaviour.
To prevent markdown cells from being executed, we will show the syntax using %%markdown
magic. After the example the rendered output is shown.
%%markdown
## Information+: Multicell information 1
Here is some information about multicells
Here is some information about multicells
The multicell is terminated using a colon and the corresponding keyword. (1)
:information+
Here is some information about multicells
The multicell is terminated using a colon and the corresponding keyword. (2)
The above doesn't really show much additional functionality, apart from adding a big indent to the additional cells. The real power of multicells is combining them with code and raw cells
%%markdown
## Information+: Multicell information 2
This is a raw cell
This is a raw cell
This is a simple Python3 code cell
import __hello__
Hello world!
This is the end of the multicell
:information+
This is another raw cell
ROARThis is a different Python3 code cell
import math
print(math.pi)
3.141592653589793
This is the end of the next multicell
It is even possible to nest multicells, given that they are distinct environments. However, we strongly discourage the use of the nesting functionality, and it may be removed in the future.
: keyword +
If the corresponding : keyword +
is missing from the notebook, there is no way to stop NBfancy from consuming all of the remaining cells in that notebook and including them in that multicell. This is very noticable behaviour and is easily corrected by adding the line to original plain notebook.
+
: keyword +
go into the multicell