wader / ansisvg Goto Github PK
View Code? Open in Web Editor NEWConvert ANSI to SVG
License: MIT License
Convert ANSI to SVG
License: MIT License
Some ideas:
<g>
group to inherit shared attributesI currently patch ansisvg
's output to fix the rendering of Powerline symbols:
ansisvg -fontname "Ubuntu Mono" -fontsize 16 | sed 's?<style>?<style>@import url("https://cdn.jsdelivr.net/gh/wernight/powerline-web-fonts/PowerlineFonts.css");?g'
(I'm a dilettante at web tech, so not sure if this is the right way - but it works)
Wondering if it makes sense to add some kind of option for external fonts (or external CSS in general) to avoid having to patch the generated files.
One huge benefit of text-based screenshots over PNGs is the ability to select / copy contents and paste them elsewhere.
ansisvg
generates a dedicated <text>
element for each character, and if text is selected / copied from the rendered SVG then the copied selection includes a whitespace after each character.
example: if "WORD" is selected/copied, then the clipboard contents are "W O R D"
ansisvg
could detect consecutive characters that have the same style
attribute and consolidate them into a single <text>
element to facilitate copy/pasting.
This is a brilliant piece of software!
I was going to submit this issue to ask for a few features such as padding and adding a window frame.
However, I just came across this tool which is very similar and has those features: https://crates.io/crates/term-transcript-cli
Life is short, figured I'd give you a head's up!
It struck me that maybe one can use CSS animations to created a animated screen? but to do it probably some more things needs to be in place:
would be nice to have a version number, wouldn't it? ๐
I like "git describe"-based versioning that automatically picks up the latest Git tag plus the number of commits after that so ends up with something like "v1.20" for a tagged version or "v1.20-5" for a untagged version 5 commits after that. But not sure how to do that in golang ๐
If I use color codes like \e[0;32m
in my shell scripts I see the color in the svg.
But the colors from lolcat show up as grey in the svg ansisvg
creates.
I have no idea how lolcat
gets those colors. Have you seen that program? It would be so amazing to be able to pipe lolcat to ansisvg - SO amazing.
I noticed that the jq svg logo https://jqlang.github.io/jq/jq.svg has this selector @media (prefers-color-scheme:dark){g[fill]{filter:invert(1);stroke:none}}
. Could be used to select between dark/light colors.
Today I used ansisvg
generated files for the first time in my blog. It is a simple mkdocs
generated static site.
When loading the page for the first time, Firefox doesn't show the SVG content but only a black box. It will start rendering it correctly when I reload the page.
I observed the same behavior when using ansisvg
files in gitlab issue conversations at work, but I suspected a gitlab bug. Now I see the same in my blog.
It looks a bit like a Firefox issue, since it doesn't reproduce in Chrome or Safari. But OTOH maybe we're doing something out of spec and Chrome/Safari are just robust enough to not stumble over it? Maybe it has to do with the font embedding? (I have to check if the bug reproduces when not using embedded font).
Hello and happy first issue! It's a great sounding project, I hope you enjoy making it!
I'm getting errors trying to build...
โฏ go install github.com/wader/ansisvg@master
can't load package: package github.com/wader/ansisvg@master: can only use path@version syntax with 'go get'
git clone [email protected]:wader/ansisvg.git
cd ansisvg
โฏ go build -o ansisvg main.go
build command-line-arguments: cannot load embed: malformed module path "embed": missing dot in first path element
In case my go env details are helpful in this:
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/alec/.cache/go-build"
GOENV="/home/alec/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/alec/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/lib/go-1.13"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/go-1.13/pkg/tool/linux_amd64"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/alec/code/software_projects/ansisvg/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build483368982=/tmp/go-build -gno-record-gcc-switches"
Thing to test:
Methods:
Noticed that invert is not implement when testing https://github.com/pycontribs/ansi2html/blob/main/tests/ansicolor_eix.txt
Steps to reproduce:
$ cowsay Hello ANSI | lolcat -f -S 1 > ansi-piped.txt
$ cowsay Hello ANSI | lolcat -f -S 1
$ # Copy output from above via kitty copy_ansi_to_clipboard and save it to ansi-copied.txt
$ cat ansi-piped.txt | ansisvg > ansi-piped.svg
$ cat ansi-copied.txt | ansisvg > ansi-copied.svg
Expected:
ansi-piped/copied.svg should look the same
Observed:
ansi-copied.svg misses the coloring and adds some undecoded ESC sequence at the top.
ansi-piped.txt
ansi-copied.txt
Current version generates files incompatible with asciidoctor-pdf:
https://docs.asciidoctor.org/pdf-converter/latest/image-paths-and-formats/#image-formats
Not sure if we can use viewBox
and get rid of width
/height
completely, or if it needs to be a commandline option. viewBox
also probably works in px
only and not in em
/ch
?
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.