Skip to content

Sphinx & Pygments integration for ANSI rendering #852

@kdeldycke

Description

@kdeldycke

Browsing the list of supported extensions by Shibuya, I realized nbsphinx supports ANSI rendering of code cells.

Looking at nbsphinx's code, it seems that this feature rely on the ansi2html directive, but I can't trace it back to its implementation. Is it a Jinja macro? Or a Sphinx specific tag? Or an rST/Latex workaround?

Anyway, just wanted to point out that nbsphinx ANSI support is reminding me of a similar issue I had to solve to render ANSI codes in Sphinx. So I implemented a collection of ANSI-capable lexers for Pygments, and integrated them into Sphinx.

I just wanted to point to my project as maybe it can be somehow reused/integrated/inspiring for nbsphinx to have better support for ANSI.

Note that my Sphinx extensions plays nicely with Sphinx as demonstrated by its native support in Shibuya.

Also of note is @lepture 's Pygments Styles project, that is brindging the gap between Pygments and Sphinx for styles support.

Relates to:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions