💾 Archived View for thebird.nl › gn-gemtext-threads › issues › binderlite › ansi2html_terminal_user_… captured on 2023-04-19 at 23:06:39. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2023-01-29)

-=-=-=-=-=-=-

Terminal output to the browser

ansi2html

Drew Devault uses ani2html in builds.sr.ht, the continuous integration system/app that is part of the SourceHut suite. builds.sr.ht generates terminal output using jinja templates and a relatively small python library called ansi2html. It is already packaged by guix upstream as python-ansi2html (It could use an update).

https://github.com/pycontribs/ansi2html

https://pypi.org/project/ansi2html/

Here are two examples of it in action at builds.sr.ht:

https://builds.sr.ht/~sircmpwn/job/610711

https://builds.sr.ht/~sircmpwn/job/611028

And, the relevant places in the builds.sr.ht code base:

https://git.sr.ht/~sircmpwn/builds.sr.ht/tree/master/item/buildsrht/templates/job.html#L117

https://git.sr.ht/~sircmpwn/builds.sr.ht/tree/master/item/buildsrht/blueprints/jobs.py#L333

Here's a diagram showing how it will integrate with binderlite.

binderlite_ansi2html_terminal_diagram.png

ansi2html lets us send terminal output to the browser without depending on javascript libraries. However, the downside is that it cannot "stream" terminal output to the browser as it is generated. The only way to get the latest terminal output is to reload the page.