Preprocessors
Preprocessors#
All of the following preprocessors are run over the notebooks.
nbconvert.preprocessors.TagRemovePreprocessorThis runs the standard tag-remover and removes any cells with the tag
remove_cell.
- class nbpretty.preprocessors.PageLinks(**kwargs: Any)#
Adds in links from one page to the next. The order is based on the naming of the main pages’ numbers. i.e.
00 Intro.ipynb` will have a next link to ``01 Foo.ipynb.
- class nbpretty.preprocessors.HighlightExercises(**kwargs: Any)#
Any cells with the tag
exercisewill have theexercisecss class attached to them. By default this highlights the output cell in yellow.
- class nbpretty.preprocessors.SetTitle(**kwargs: Any)#
Based on the
course_titleinconfig.yamlthis sets the title at the top of each page and in the HTML header.
- class nbpretty.preprocessors.HideWriteFileMagic(**kwargs: Any)#
This looks for cells which start with
%%writefile,%run,%cdor!and hides that from the output. For%%writefileit removes that line, sets the output prompt to the name of the file and hides the output “Overwriting foo.py”. For%run foo.pyit turns it intopython foo.pyand sets the prompt to$to indicate running in the terminal. For%cdit changes it intocdand for!it just shows the run command.
- class nbpretty.preprocessors.FixLinkExtensions(**kwargs: Any)#
Replaces all
.ipynbwith.htmlso that links continue to work.
- class nbpretty.preprocessors.CustomBlocks(**kwargs: Any)#
Based on the
custom_blockslist inconfig.yamlit sets all cells with a tag matching a custom block name to be collapsible by clicking on the image that goes in the prompt.
- class nbpretty.preprocessors.InsertTOC(**kwargs: Any)#
Replaces all cells with the tag
tocwith the table on contents, based on the file naming.
- class nbpretty.preprocessors.UninlineCss(**kwargs: Any)#
Moves the inlined CSS generated by nbconvert into a separate file which is referenced by all notebooks.
- class nbpretty.preprocessors.AddExtraCss(**kwargs: Any)#
If the extra CSS file is give, add it to the metadata.