Description
[split out from https://github.com//pull/1538]
A common need both when writing documentation and interacting via slack is the ability to run a command and show its results. This is complicated by the need to show hats, cursor state, selection state, etc. We currently resort to some amount of ascii art to do this, which is easy, but suboptimal in a number of ways.
What if we wrote a tool that automated all of this? You'd start with a document like:
# bring air to bat
big art
and trigger the example generator and it would spit out an image like
but maybe less ugly? I manually created that. (it would figure out the content range, look for the header line, run the command in the header line, take screenshots before and after, and stitch them altogether.)
https://github.com/kufii/CodeSnap/ is an extension that lets you take snapshots of code. I'm not sure whether it handles hats, but we could probably adapt the underlying code to do so. (Seems like the core is https://github.com/tsayen/dom-to-image.) You'd have to figure out how to handle the blinking cursor. :/