char-slop/ai-dots
ai dotfiles
git clone https://git.t4t.associates/char-slop/ai-dots
1567399
main
visualize-code
renders a slice of a source file as a syntax-highlighted png (catppuccin latte, ioskeley mono)
for the visualize_code tool in extensions/hashline/visualize-code.ts.
visualize-code < out.png> < path> < first-line> < label> ...< source
stdin is the whole file, so highlighting has full context; path is only used to detect the
language. one line is rendered per label, starting at first-line (1-indexed), until the image
would get big enough for providers to downsample it. the number of lines rendered is printed to
stdout.
building
the fonts are embedded but not committed:
curl -sSLO https://github.com/ahatem/IoskeleyMono/releases/latest/download/IoskeleyMono-NL.zipunzip -j IoskeleyMono-NL.zip'Normal/Unhinted/IoskeleyMonoNL-' {Regular,Bold,Italic,BoldItalic}.ttf-d fontscargo build--release cp target/release/visualize-code ../../libexec/
1# visualize-code 2 3renders a slice of a source file as a syntax-highlighted png (catppuccin latte, ioskeley mono) 4for the `visualize_code` tool in `extensions/hashline/visualize-code.ts`. 5 6``` sh 7visualize-code <out.png> <path> <first-line> <label>... < source 8``` 9 10stdin is the whole file, so highlighting has full context; `path` is only used to detect the 11language. one line is rendered per label, starting at `first-line` (1-indexed), until the image 12would get big enough for providers to downsample it. the number of lines rendered is printed to 13stdout. 14 15## building 16 17the fonts are embedded but not committed: 18 19``` sh 20curl -sSLO https://github.com/ahatem/IoskeleyMono/releases/latest/download/IoskeleyMono-NL.zip 21unzip -j IoskeleyMono-NL.zip 'Normal/Unhinted/IoskeleyMonoNL-'{Regular,Bold,Italic,BoldItalic}.ttf -d fonts 22cargo build --release 23cp target/release/visualize-code ../../libexec/ 24```