Skip to content
jaschadubPublic

About

TUI Markdown Reader

Topics

Resources

Stars

2 stars

Watchers

0 watching

Forks

Repository files navigation

glum

glum

A reading-focused terminal markdown viewer — more like "Reader Mode in your terminal" than a markdown-as-markdown renderer.

Glum optimizes for reading prose, not decorating syntax. Headings become typographic styles, not # prefixes; links show their URL inline so you can see and click them; code blocks are highlighted and cleanly copyable; tables wrap rather than truncate; the file scrolls a page at a time like less.

Install

macOS / Linux — one-liner

curl -fsSL https://raw.githubusercontent.com/jaschadub/glum/main/scripts/install.sh | bash

This downloads the latest signed release archive for your platform, verifies its SHA-256, and installs glum into $HOME/.local/bin. Override the prefix with GLUM_PREFIX=/usr/local, pin a version with GLUM_VERSION=v0.4.1.

Any platform — via cargo

cargo install glum

Debian / Ubuntu (.deb) and Fedora / RHEL (.rpm)

Every release attaches signed .deb and .rpm packages for x86_64 and aarch64. Install directly:

# Debian / Ubuntu (pick the arch for your machine)
curl -LO https://github.com/jaschadub/glum/releases/latest/download/glum_0.4.1-1_amd64.deb
sudo apt install ./glum_0.4.1-1_amd64.deb

# Fedora / RHEL / openSUSE
sudo dnf install https://github.com/jaschadub/glum/releases/latest/download/glum-0.4.1-1.x86_64.rpm

Both packages install the binary to /usr/bin/glum, the man page to /usr/share/man/man1/, and completions under the usual shell-specific XDG directories — no further setup needed.

Homebrew, winget, etc.

Not yet. Use cargo or the install.sh one-liner. On Windows, grab the .zip from the releases page or use cargo install glum.

From source

cargo build --release
./target/release/glum test.md

Verify a release download

Every release archive and checksums.txt is signed with Sigstore cosign via GitHub Actions OIDC (keyless). Verify with:

cosign verify-blob \
  --certificate glum-*.pem \
  --signature glum-*.sig \
  --certificate-identity-regexp="https://github.com/jaschadub/glum" \
  --certificate-oidc-issuer="https://token.actions.githubusercontent.com" \
  glum-*.tar.gz

Features

  • Reader layout — narrow, centered measure (default 72 cols), five themes (T), two typographic layouts (L), three alignments (A). All toggle at runtime and are remembered across runs.
  • Code blocks — syntax highlighting for 12 languages, flush-left and full-width within the document. No borders, added padding, line numbers, or wrap markers. Code stays unwrapped by default; h / l pans long lines, 0 / $ jumps to either end, and W toggles optional wrapping.
  • Copy — y copies the only visible block, or highlights a block to choose with j / k and copy with y / Enter when several are visible. Y picks source lines; R opens a full-width copy view without borders, margins, wrap markers, or default line numbers. In either picker, v starts a line range, j/k extends it, and y copies; [ / ] chooses another code block. Copies come from the source, so no ↪ or … leaks and long commands remain complete. Uses native clipboard (pbcopy / wl-copy / xclip / xsel) when available, OSC 52 otherwise.
  • Tables wrap long cells instead of truncating, keep column separators aligned, and draw ╌ row separators when any row wraps.
  • Links render inline URLs for external and relative paths; anchor links stay clean.
  • Search (/) with live match count and n / N / Tab stepping. Matches are typography-aware (don't finds don’t, -- finds —), continue from the reading position like less, highlight every match on screen, and the prompt accepts pastes. Esc cancels back to where you were.
  • TOC (t) overlay with type-to-filter (/, then Enter to jump); jump to first match of a heading title with -H.
  • Links open (o) — pick a link with j/k and Enter opens it: external URLs via the OS opener, #anchors jump in-document, relative paths open with the default app.
  • Image preview (i, with --images) — local images render full-screen via kitty / sixel / iTerm2 graphics, falling back to half-blocks anywhere else.
  • Tabs — open several files at once; ] / [ switch, each file keeps its own reading position.
  • Orientation — a dim scrollbar with search-match tick marks, and a reading-progress gauge in the footer.
  • Editor handoff — e opens $EDITOR / $VISUAL at the nearest heading's source line, then reloads.
  • Follow mode (-f) re-renders on file change; r reloads manually.
  • Per-file position memory, hashed paths, atomic writes. Opt out with --no-remember.
  • Optional mouse scroll (--mouse) — off by default so the terminal's native text selection keeps working.
  • Smart typography ("..." → “…”, -- → —, ... → …).
  • Terminal-safe panic handler — a crash still restores your shell.
  • Bounded inputs — 64 MiB file cap; 256-char search cap.

Usage

glum [OPTIONS] <PATH>...

  --measure <N>             column width (20..200, default 72)
  --theme <NAME>            light, dark, sepia, night, meadow, aurora, plain
  --layout <NAME>           minimal or vivid
  --align <NAME>            center, left, or right
  -s, --search <QUERY>      open with search pre-populated; jump to first match
  -H, --heading <TITLE>     jump to first heading containing TITLE (case-insensitive)
      --toc                 open with the table of contents overlay visible
      --reset-position      ignore saved position; start at the top
      --wrap-code           soft-wrap long code lines (also toggled with W)
      --no-wrap-code        keep source lines unwrapped; h/l pans (default)
      --truncate-code       compatibility alias for --no-wrap-code
      --no-remember         don't persist reading position / preferences across runs
      --mouse               enable mouse-wheel scrolling (disables native text selection)
      --images              enable `i` image preview (kitty / sixel / iTerm2 / half-block)
  -f, --follow              re-render when the file changes on disk
  --generate-completions <SHELL>  emit a shell completion script to stdout (bash/zsh/fish/elvish/powershell)
  --generate-man                  emit a roff man page to stdout

Shell completions and man page

Every release tarball ships completions and a man page alongside the binary:

share/bash-completion/completions/glum
share/zsh/site-functions/_glum
share/fish/vendor_completions.d/glum.fish
share/man/man1/glum.1

A packager can rsync share/ straight under a prefix (/usr/local/ or similar). Installing by hand from a cargo install build:

glum --generate-completions bash > ~/.local/share/bash-completion/completions/glum
glum --generate-completions zsh  > "${fpath[1]}/_glum"
glum --generate-completions fish > ~/.config/fish/completions/glum.fish
glum --generate-man              > ~/.local/share/man/man1/glum.1

Multiple files open in tabs — switch with ] / [.

If --theme, --layout, or --align is omitted, the last value you used is restored. First-run defaults: minimal / center, plus light or dark based on the terminal's advertised background (via $COLORFGBG, falling back to dark).

Pass - as the path to read from stdin.

Examples:

glum README.md                              # just read
glum -s needle test.md                      # open, search for "needle"
glum -H "Code blocks" test.md               # jump to a specific heading
glum --toc test.md                          # open with TOC visible
glum --theme light --measure 80 foo.md
glum --layout vivid --align left doc.md
glum -f README.md                           # auto-reload on save while editing
cat post.md | glum -                        # read from stdin

Keys

key action
j / ↓ scroll down
k / ↑ scroll up
space / PgDn / Ctrl-f page down
b / PgUp / Ctrl-b page up
d / u (or Ctrl-d/u) half page down / up
Ctrl-e / Ctrl-y scroll one line down / up
g / Home top
G / End bottom (last full page)
t table of contents (j/k move, d/u page, / filter)
/ open search
n / N / Tab / → / ← next / previous search match
c / Esc clear active search
y copy a block; if several are visible, pick with j/k, then y / Enter
Y pick code lines (j/k, v range, y / Enter copy)
R focused code view — h/l pans, y copies
h / l, 0 / $ pan unwrapped code, jump to left / right end
o pick & open a link (j/k, Enter)
i preview nearest image (needs --images)
] / [ next / previous file (tabs)
r reload the current file from disk
e open in $EDITOR at the nearest heading
T cycle theme
L cycle layout (minimal ↔ vivid)
A toggle align (center → left → right)
W toggle code wrapping (off by default)
? toggle help overlay
q quit (Esc closes overlays but never quits)
Ctrl-C force quit from any mode

Copying code and commands

Code blocks are cleanly copyable in the normal document view: they start at the left edge of the terminal without borders, added indentation, line numbers, or wrap arrows. The surrounding document stays visible. Drag to select visible text using your terminal's normal copy shortcut. Use h / l to pan long code lines, or 0 / $ to jump to either end. Press W or use --wrap-code for optional wrapping; a saved wrapping preference is restored unless overridden with --no-wrap-code.

Press R near a code block for the focused copy view. Native selection also works there with --mouse: Glum releases mouse capture while the focused view is open and restores it when you leave.

For an exact copy, including commands longer than the screen and original tabs, press y while reading. If several blocks are on screen, the target is highlighted and the footer shows its number and language. Use j / k (or arrows, Tab / Shift-Tab, ] / [) to choose, then y / Enter to copy the whole block. Esc closes the picker. With one visible block, y copies it immediately; an off-screen block is always previewed first.

For example, with a setup block followed by a YAML CI job, press y, j, Enter to copy the YAML job. The selection stays on that block for repeated copies.

In the focused view (R):

  • j / k or arrows: choose a source line; y / Enter copies it.
  • v, then movement: select a range of lines; y / Enter copies the range. Press v again to return to a single line.
  • Y: copy the entire code block.
  • [ / ]: previous / next code block.
  • h / l: pan long lines; 0 / $: left / right end.
  • PgUp / PgDn: move a page; #: toggle optional line numbers.
  • Esc: return to reading (or the inline picker if you opened R from Y).

Horizontal panning only changes what is visible. Keyboard copies include the complete selected source lines; dragging copies only the visible text. Copy feedback appears at the bottom of the view. The inline picker (Y while reading) supports the same range selection and block navigation.

Position and preference memory

Glum remembers where you were in each file and what theme / layout / align / wrap-mode you were using. State lives at $XDG_STATE_HOME/glum/positions.json (or ~/.local/state/glum/ as fallback). Paths are hashed with SHA-256 before being stored, so the state file does not reveal which files you've read. The file is written atomically with mode 0600. Pass --no-remember to opt out of all persistence, or --reset-position to ignore the saved offset just for the current run.

License

Apache License, Version 2.0. See LICENSE and NOTICE.

Copyright © 2026 Jascha Wanger (https://jascha.me).

About

TUI Markdown Reader

Topics

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Contributors

Languages