Terminal snippets that preserve formatting

Hello. I would like to include excerpts copied from my terminal on my webpages, such that the ANSI escape code formatting is preserved. I believe the easiest way to do this would be to keep the raw escape codes in my markdown files, as I have an extension for Vim to display those nicely.

How can I go about having Zola process the escape codes into HTML? Is this something the syntax highlighter would be capable of?

Based on the implementation of syntect::highlighting::RangedHighlightIterator, I have determined that there is no way to skip characters from the input based on the syntax highlighter grammar.

I think I would have to modify Zola proper to achieve this. Sadly, the syntax highlighting themes don’t actually include any colors like “green” or “dark blue”. The simplest way forward seems to be hardcoding the colors or class names for them, but I doubt that this will be well-received in an upstream PR.

Is there some relatively standard format for terminal themes that we could pick up?

Would https://github.com/getzola/zola/pull/1242 help there? This way you can override some CSS classes