Codeliner is a command-line utility to generate codelines, a bird's eye view image of your source code files. Like an outline, but for your code, hence the name. A codeline looks like a minimap, and is a rough picture of the shape of your source code, once the literal characters are abstracted into lines and shapes. I've also chosen to mark delimiters (() {} []
) with colored blocks, for some extra fun.
As an example, here's the codeline image of src/generate.ink
, the main file of the Codeliner program itself. You can see some patterns in indentation, scoping, and line spacing in this rough view of the source code.
Codeliner is written in Ink, a minimal toy functional programming language I made, and outputs *.bmp
bitmap image files, which can be converted into more efficient formats like PNG with other utilities.
Codeliner is intended to be used as a command line tool, and has one syntax.
# syntax
./codeliner.ink <input file> [<output file>]
# for example
./codeliner.ink input-file.txt output-path.bmp
This will create a codeline image of input-file.txt
and place it at output-path.bmp
as an image file. The output path is optional -- if you omit it, the output defaults to out.bmp
in the current directory, and overwrites any existing file with that name.
Outlines of code revealed by Codeliner can show interesting patterns and differences between languages. To that end, we've compiled a few examples here to complement the Ink program codeline above.
source: etcd source snippet
source: Preact source snippet
source: Blocks.css source
Lisp (Xin)
source: Xin standard library snippet