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


Remove ansi from text


source : str

Source to remove the ansi from


Conver ansi colors to html colors.


text : str

Text containing ansi colors to convert to html


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 ‘’.


Converts ansi formated text to latex version

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