If NBfancy is initialised with the flag --extra_config
it will give the user access to two additional configuration files: keywords.cfg
and box.ipynb
. The file keywords.cfg
is discussed in the previous section. The second file, box.ipynb
, is a notebook which contains two cells, and allows the user to change the template that NBfancy uses for keyword cells when rendering notebooks.
!nbfancy init example2 --extra_conf
!ls example2/config
The first cell give a description of how you can modify the second and read:
You can replace the existing template by modifying the next cell. When the notebook is rendered the following will happen:
default.cfg
.w3-green
will be substitued with the colour in default.cfg
.w3-pale-green
will be substituted with the corresponding pale background colour.{index}
is used internally, don't remove it or you will break things.fa-star
will be substitued with the symbol in default.cfg
.TITLE
will be substituted with the marked up title which follows the colon after the keyword.BODY
will be substituted with the marked up content of the cell after the first line.In the plain notebook, this markdown would generate the next cell:
markdown
## Keyword: TITLE
BODY
Note the spacing may not be exactly the same since the TITLE
and BODY
will have additional HTML tags added when marked up.
The second cell contains the HTML code seen below. You can modify to suit the new style you want to use.
%%HTML
<div class="w3-panel w3-leftbar w3-border-green w3-pale-green w3-padding-small">
<h3 id="{index}"><i class="fa fa-star"></i> TITLE</h3>
BODY
</div>