Closed evansd closed 2 months ago
As a very first pass, just stripping the escape codes out would be an improvement.
There's this library, which might be acceptable: https://github.com/pycontribs/ansi2html
I also see that nbconvert
has a standalone module for doing this which we could vendor:
https://github.com/jupyter/nbconvert/blob/e1599627fd1f9e06d983e3974eadb58d2a92c44c/nbconvert/filters/ansi.py
Closed by #673
Various OpenSAFELY images (in particular, but not exclusively
ehrql
) write colourised/formatted output to stderr using ANSI escape codes. For example:If we render this in a naive text viewer we get stuff like:
It would be great if we could render the escape codes into appropriate HTML so it all looks nice. I very much hope there are non-awful libraries which would handle this for us, but I haven't actually looked yet.