f1lt3r / ansi-to-svg Goto Github PK
View Code? Open in Web Editor NEW๐น convert ANSI Escaped CLI strings to SVGs
License: MIT License
๐น convert ANSI Escaped CLI strings to SVGs
License: MIT License
As you can see my ansi string have some spaces before numbers or fruits names
^[[90mโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโ^[[39m
^[[90mโ^[[39m 1^[[90mโ^[[39m apple^[[90mโ^[[39m $1.2^[[90mโ^[[39m
^[[90mโ^[[39m 12^[[90mโ^[[39m banana^[[90mโ^[[39m $17.76^[[90mโ^[[39m
^[[90mโ^[[39m 145^[[90mโ^[[39m orange^[[90mโ^[[39m $154.23^[[90mโ^[[39m
^[[90mโ^[[39m 1243^[[90mโ^[[39m kiwi^[[90mโ^[[39m $1232.2^[[90mโ^[[39m
^[[90mโโโโโโโโดโโโโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโ^[[39m
the spaces are after the words not before on the svg result
The current version struggles with this terminal output:
but there are two issues preventing this output:
Select Graphic Rendition (SGR) parameters do support "several attributes {...} in the same sequence, separated by semicolons".
e.g.: \x[32;1m
for bold+green. But ansi-to-svg fails to recognize them.
split them into multiple individual ANSI SGR escape sequence:
sed -r 's@(\x1b\[)([[:digit:]]+);([[:digit:]]+)(m)@\1\3\4\1\2\4@g' terminal.txt > sgr-fixed.txt
There are a few issues with the way spaces are handled:
72_UK 78_UK 92_UK 93_UK 76_SA 77_EU
<text>
boxes start at fixed X coordinates, the left-most text still has the leading space spaces left. Somewhat luckily the above bug cancels out this bug and thus it doesn't affect the output much (until one tries the workaround. then it need fixing).
<text x="84.01" y="14.55"> 72_UK
<text x="84.01" y="14.55">72_UK
</text>
blocks:
77_EU </text>
77_EU</text>
One needs to:
\u00A0
) in the SVG output for string of multiple space.<text>
block is already shifted using coordinates).sed command:
sed -r 's@ +(</text)@\1@g;s@> +([[:alnum:]])@>\1@g;s@ @\xC2\xA0\xC2\xA0@g;s@\xC2\xA0 @\xC2\xA0\xC2\xA0@g' terminal.svg > fixedspaces.svg
Hi,
Nice work.
In readme.md link https://github.com/F1LT3R/ansi-to-svg/blob/master/fxitures/base16-flat-dark-f1lt3r-256.itermcolors return 404 error.
Where it's located now?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.