cheatmd

module
v1.0.0-rc.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 30, 2026 License: MIT

README

CheatMD

CI Go Report Card

Executable Markdown cheatsheets. Write readable docs, run interactive commands.

demo

Install

go install github.com/cheatmd-dev/cheatmd/cmd/cheatmd@latest

Quick Start

cheatmd                    # Browse current directory
cheatmd ~/cheats           # Browse specific directory
cheatmd -q "docker"        # Start with search query
cheatmd --history          # Re-run from execution history
cheatmd convert tldr tar.md -o ~/cheats/tar.md # convert a tldr cheat
cheatmd packs list         # List installable cheat packs from the registry
cheatmd packs install      # Pick and install cheat packs (interactive)
First run

The first time you run cheatmd (before a config file exists) on an interactive terminal, it offers to set you up: it writes a config to ~/.config/cheatmd/cheatmd.yaml and lets you pick starter cheat packs to install from the registry into ~/.local/share/cheatmd/cheats. Pick packs from the checklist with space, confirm with enter. Point registry_url at a private/self-hosted registry.yaml to customize the offered packs. Setup is skipped in headless/piped invocations.

You can install packs any time with the packs command — it doesn't depend on the first-run prompt:

cheatmd packs list                 # show available packs (and which are installed)
cheatmd packs install              # interactive picker
cheatmd packs install git docker   # install specific packs by name

Features

Write cheats as Markdown

Any heading with a code block is a cheat. Variables like $container become interactive prompts powered by shell commands:

## Docker: exec into container

```sh title:"Execute shell in container"
docker exec -it $container /bin/sh
```
<!-- cheat
var container = docker ps --format "{{.Names}}" --- --header "Select container"
-->
Fuzzy search with frecency

Type to filter across titles, commands, descriptions, and tags. Cheats you run often and recently float to the top.

Variables from shell output

Variable values come from shell command output - 0 lines gives a text prompt, 1 line pre-fills, 2+ lines give a filterable picker.

Reusable modules

Export a variable definition once, import it in any cheat:

<!-- cheat
export docker_container
var container = docker ps --format "{{.Names}}"
-->
Chains

Multi-step workflows that advance one step per launch:

/chain release     <- search chains in the picker
Tags

Cheats are tagged automatically from folder paths, YAML front matter, footer blocks, inline #hashtags, and heading text - all searchable from the picker.

Shell integration

Embed CheatMD directly into your shell prompt, tmux, or Zellij:

eval "$(cheatmd widget bash)"   # Ctrl+G opens the selector
Linting

Validate DSL syntax, imports, chains, and undeclared variables:

cheatmd --lint ~/cheats

Language-aware: shell builtins like $HOME and PowerShell $true won't trigger false positives.

Dump

Export cheat metadata as JSON or CSV for indexing and tooling:

cheatmd dump ~/cheats --json
Convert existing cheatsheets

Bring existing collections into CheatMD:

cheatmd convert navi ~/navi-cheats -o ~/cheats
cheatmd convert tldr ~/tldr/pages/common/tar.md -o ~/cheats/tar.md
cheatmd convert cheat ~/cheat/cheatsheets -o ~/cheats

Supported inputs are navi, tldr, and cheat/cheatsheets.

Headless Mode

Run CheatMD without a TUI to integrate with other tools (like VS Code or Obsidian) using a JSON-RPC interface over standard I/O:

cheatmd --headless -q "docker exec"

Editor Extensions

  • VS Code - syntax highlighting, lint diagnostics, completion, and CodeLens execution.
  • Neovim - syntax highlighting, async diagnostics, completion, and :CheatMDRun.
  • Obsidian - inline run buttons, lint status, execution results, and variable autocomplete.

TUI Keys

Key Action
Ctrl-H Execution history
Ctrl-T Substitute search (env + shell history)
Ctrl-Y Markdown preview
Ctrl-O Open source file in editor
Tab Path completion / copy selection

Documentation

Full documentation lives in the Wiki:

Contributing

See CONTRIBUTING.md.

License

MIT

Directories

Path Synopsis
cmd
cheatmd command
internal
ui
pkg
history
Package history records and reads the user's cheat execution history.
Package history records and reads the user's cheat execution history.
httputil
Package httputil provides common HTTP client utilities.
Package httputil provides common HTTP client utilities.
installer
Package installer installs cheat packs from the registry onto the local machine.
Package installer installs cheat packs from the registry onto the local machine.
linter
Package linter checks a cheatmd cheats directory for problems.
Package linter checks a cheatmd cheats directory for problems.
packmanifest
Package packmanifest records which cheat packs have been installed into a cheats directory.
Package packmanifest records which cheat packs have been installed into a cheats directory.
registry
Package registry fetches and parses the CheatMD cheat-pack registry: a remote YAML manifest that lists installable cheat repositories ("packs").
Package registry fetches and parses the CheatMD cheat-pack registry: a remote YAML manifest that lists installable cheat repositories ("packs").

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL