Skip to content

thesephist/codeliner

master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
src
 
 
 
 
 
 
 
 
 
 

Codeliner 💻

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.

Codeline of src/generate.ink

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.

Usage

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.

Examples

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.

Go

source: etcd source snippet

Codeline of status.go

JavaScript

source: Preact source snippet

Codeline of props.js

CSS

source: Blocks.css source

Codeline of blocks.css

Lisp (Xin)

source: Xin standard library snippet

Codeline of std.xin

Haskell

source: Rosetta Code - 99 Bottles solution

Codeline of Haskell code

About

Generate codelines: like silhouette outlines, but for your source code

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published