343fa4e9c6
Adding `{ "\\.c$", "src2img c 360" }` to the filters of sent, sent will show highlighted code snippets. Trivially modified to work for any language (currently C) and screen size (current resolution 360 dpi).
16 lines
421 B
Bash
Executable File
16 lines
421 B
Bash
Executable File
#!/bin/sh
|
|
|
|
srctype="$1"
|
|
dpi="$2"
|
|
tempsrc="$(mktemp --suffix=".$1")"
|
|
tempsvg="$(mktemp --suffix='.svg')"
|
|
temppng="$(mktemp --suffix='.png')"
|
|
|
|
cat > "$tempsrc"
|
|
highlight -O svg -I "$tempsrc" | grep -v 'rect' > "$tempsvg"
|
|
inkscape --without-gui --export-area-drawing --export-background-opacity=256 --export-dpi="$dpi" --export-png="$temppng" "$tempsvg" > /dev/null
|
|
png2ff < "$temppng"
|
|
|
|
rm "$tempsrc" "$tempsvg" "$temppng"
|
|
|