Warning

This documentation is for an old version of IPython. You can find docs for newer versions here.

Module: nbconvert.filters.ansi

Filters for processing ANSI colors within Jinja templates.

4 Functions

IPython.nbconvert.filters.ansi.strip_ansi(source)

Remove ansi from text

Parameters:

source : str

Source to remove the ansi from

IPython.nbconvert.filters.ansi.ansi2html(text)

Conver ansi colors to html colors.

Parameters:

text : str

Text containing ansi colors to convert to html

IPython.nbconvert.filters.ansi.single_ansi2latex(code)

Converts single ansi markup to latex format.

Return latex code and number of open brackets.

Accepts codes like ‘’ (bold, red) and the short form ‘’ (red)

Colors are matched to those defined in coloransi, which defines colors using the 0, 1 (bold) and 5 (blinking) styles. Styles 1 and 5 are interpreted as bold. All other styles are mapped to 0. Note that in coloransi, a style of 1 does not just mean bold; for example, Brown is “0;33”, but Yellow is “1;33”. An empty string is returned for unrecognised codes and the “reset” code ‘’.

IPython.nbconvert.filters.ansi.ansi2latex(text)

Converts ansi formated text to latex version

based on https://bitbucket.org/birkenfeld/sphinx-contrib/ansi.py