Warning
This documentation is for an old version of IPython. You can find docs for newer versions here.
Module: nbconvert.preprocessors.highlightmagics
¶
This preprocessor detect cells using a different language through
magic extensions such as %%R
or %%octave
. Cell’s metadata is marked
so that the appropriate highlighter can be used in the highlight
filter.
1 Class¶
-
class
IPython.nbconvert.preprocessors.highlightmagics.
HighlightMagicsPreprocessor
(config=None, **kw)¶ Bases:
IPython.nbconvert.preprocessors.base.Preprocessor
Detects and tags code cells that use a different languages than Python.
-
__init__
(config=None, **kw)¶ Public constructor
-
preprocess_cell
(cell, resources, cell_index)¶ Tags cells using a magic extension language
Parameters: cell : NotebookNode cell
Notebook cell being processed
resources : dictionary
Additional resources used in the conversion process. Allows preprocessors to pass variables into the Jinja engine.
cell_index : int
Index of the cell being processed (see base.py)
-
which_magic_language
(source)¶ When a cell uses another language through a magic extension, the other language is returned. If no language magic is detected, this function returns None.
Parameters: source: str
Source code of the cell to highlight
-