Executable Markdown cheatsheets. Write readable docs, run interactive commands.
go install github.com/cheatmd-dev/cheatmd/cmd/cheatmd@latestcheatmd # 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.mdAny 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"
-->Type to filter across titles, commands, descriptions, and tags. Cheats you run often and recently float to the top.
Variable values come from shell command output - 0 lines gives a text prompt, 1 line pre-fills, 2+ lines give a filterable picker.
Export a variable definition once, import it in any cheat:
<!-- cheat
export docker_container
var container = docker ps --format "{{.Names}}"
-->
Multi-step workflows that advance one step per launch:
/chain release <- search chains in the picker
Cheats are tagged automatically from folder paths, YAML front matter, footer
blocks, inline #hashtags, and heading text - all searchable from the picker.
Embed CheatMD directly into your shell prompt, tmux, or Zellij:
eval "$(cheatmd widget bash)" # Ctrl+G opens the selectorValidate DSL syntax, imports, chains, and undeclared variables:
cheatmd --lint ~/cheatsLanguage-aware: shell builtins like $HOME and PowerShell $true won't
trigger false positives.
Export cheat metadata as JSON or CSV for indexing and tooling:
cheatmd dump ~/cheats --jsonBring 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 ~/cheatsSupported inputs are navi, tldr, and cheat/cheatsheets.
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"- 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.
| 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 |
Full documentation lives in the Wiki:
- Writing Cheats - heading structure, code blocks, metadata
- Variables - prompt, shell, and literal forms
- Selector Options -
--header,--column,--map - Conditionals -
if/fibranching - Modules -
export/import - Chains - multi-step workflows
- Tags - five tag sources
- Configuration -
cheatmd.yamlreference - Shell Integration - widget, tmux, zellij
- Linting - syntax and reference validation
- Dump - metadata export
- Convert - import navi, tldr, and cheat/cheatsheets collections
- Headless Mode - JSON-RPC programmatic interface
- Recipes - copy-pasteable patterns
See CONTRIBUTING.md.
