Skip to content

cheatmd-dev/cheatmd

Repository files navigation

CheatMD

CI Go Report Card License: MIT

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

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

About

Executable Markdown cheatsheets. Write plain .md files that read like normal notes, then run them as interactive commands with variable prompts, pickers, and shell integration for bash/zsh/tmux/zellij.

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Contributors

Languages