https://github.com/thesephist/codeliner
Generate codelines: like silhouette outlines, but for your source code
https://github.com/thesephist/codeliner
image ink-programming-language minimap
Last synced: 3 months ago
JSON representation
Generate codelines: like silhouette outlines, but for your source code
- Host: GitHub
- URL: https://github.com/thesephist/codeliner
- Owner: thesephist
- License: mit
- Created: 2020-03-04T23:17:47.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2020-07-15T19:34:34.000Z (almost 6 years ago)
- Last Synced: 2025-12-30T08:55:25.988Z (6 months ago)
- Topics: image, ink-programming-language, minimap
- Homepage:
- Size: 31.3 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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](https://code.visualstudio.com/docs/getstarted/userinterface#_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`](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](https://github.com/thesephist/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.
```sh
# syntax
./codeliner.ink []
# 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](https://github.com/etcd-io/etcd/blob/master/raft/status.go)

### JavaScript
source: [Preact source snippet](https://github.com/preactjs/preact/blob/master/src/diff/props.js)

### CSS
source: [Blocks.css source](https://github.com/thesephist/blocks.css/blob/master/src/blocks.css)

### Lisp ([Xin](https://github.com/thesephist/xin))
source: [Xin standard library snippet](https://github.com/thesephist/xin/blob/master/lib/std.xin)

### Haskell
source: [Rosetta Code - 99 Bottles solution](https://rosettacode.org/wiki/99_Bottles_of_Beer#Haskell)
