asciinema / discussions

Public open-ended discussions about asciinema
https://github.com/orgs/asciinema/discussions
1 stars 2 forks source link

Add export to SVG animation in CLI #123

Closed brunoborges closed 1 year ago

brunoborges commented 6 years ago

The project termtosvg is interesting, but I believe adding that functionality as an option in the CLI of asciinema would make more sense.

httpsithub.com/nbedos/termtosvg

ku1ik commented 6 years ago

There's also https://github.com/marionebl/svg-term-cli by @marionebl.

I'm not sure if this functionality should be in the recorder itself.

I totally understand it would be convenient, at least for a subset of users though. I see asciinema (cli) as a tool which can record and replay terminal sessions, within terminal. It basically deals with asciicast files, and terminal.

It's also a non-trivial amount of code to maintain, and I prefer to not do that :)

Having said that, I could see a way to integrate the mentioned tools without keeping this functionality in the core: "converters".

Example:

You would put this in asciinema config file:

[converters]
svg = "termtosvg render %1 %2"
gif = "asciicast2gif %1 %2"

Then record to SVG with:

asciinema rec demo.svg

The session would be recorded to tmp asciicast file, then converted automatically by calling one of the defined converter commands (the one which matches the desired file's extension).

You would still need to install the extra tool, but other than that it could be quite smooth experience.

brunoborges commented 6 years ago

Hi @sickill, I like your suggested approach very much and as a user I'd be OK with it. It brings the convenience without the burden of maintenance.

👍

Gowee commented 4 years ago

I have a naive proposal:

Just write a wrapper around the svg-term project so that to deploy it onto a serverless platform such as Vercel, exposing a simple web API that converts an asciicast file into a SVG. Then add an "Export as SVG" button on https://asciinema.org/ to redirect users to that API endpoint (or serve the SVG directly by internally calling the API server-side).

In this way, there is no need for users to install svg-term and Node.js along with tons of modules locally, which is fairly daunting. Also the existing asciinema CLI requires no change and hence no much extra maintainence effort.

ciq-mcarifio commented 3 years ago

Is the [converter] proposal actually implemented? I'm guessing no (since I just tried it).