Skip to content

Include CSS classes for 8-bit ANSI colors #378

@thiippal

Description

@thiippal

Describe the problem

I cannot get ANSI colours to show in Jupyter Notebook cell outputs.

I can see the ANSI colours in the Notebooks, and can render them successfully in HTML using nbsphinx.

The problem is visible in my documentation here.

The output from the first code cell in the section should be rendered in red.

In my conf.py, I've set the option nb_render_text_lexer = "myst-ansi".

If I set `nb_render_text_lexer = "none", I can see the ANSI codes in the cell output, so I assume that the library I use for colouring the output (wasabi) works:

[38;5;1mHello world![0m

Link to your repository or website

https://applied-language-technology.mooc.fi/html/notebooks/part_iii/03_pattern_matching.html#examining-matches-in-context-using-concordances

Steps to reproduce

I build the documentation locally, but my conf.py is available here.

The version of Python you're using

Python 3.9.9

Your operating system

macOS 10.14.6.

Versions of your packages

Jupyter Book      : 0.12.1
External ToC      : 0.2.3
MyST-Parser       : 0.15.2
MyST-NB           : 0.13.1
Sphinx Book Theme : 0.1.7
Jupyter-Cache     : 0.4.3
NbClient          : 0.5.9

Additional context

Here's the configuration of the MyST parser when building the documentation:

myst v0.15.2: MdParserConfig(renderer='sphinx', commonmark_only=False, enable_extensions=['dollarmath'], dmath_allow_labels=True, dmath_allow_space=True, dmath_allow_digits=True, dmath_double_inline=False, update_mathjax=True, mathjax_classes='tex2jax_process|mathjax_process|math|output_area', disable_syntax=[], url_schemes=['http', 'https', 'mailto', 'ftp'], heading_anchors=None, heading_slug_func=None, html_meta=[], footnote_transition=True, substitutions=[], sub_delimiters=['{', '}'], words_per_minute=200)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions