Markdown to rich text and back, from a hotkey.
| Hotkey (Windows / macOS) | You have | You get |
|---|---|---|
Win+Alt+V / Cmd+Option+V |
Markdown on the clipboard, e.g. from an AI | It is pasted as rich text into your mail or editor |
Win+Alt+C / Cmd+Option+M |
A mail or web page selected | Its Markdown on the clipboard, images included |
Ask an AI to draft a reply, copy its Markdown, press Win+Alt+V in your mail: headings, lists, tables and bold arrive as formatting, not as **stars**. The other way round, select a mail thread, press Win+Alt+C, paste it into an AI assistant, a ticket or your notes: highlights, code and screenshots come along.
A small tray app for Windows and macOS. On Linux it is a CLI you bind to a shortcut.
- Download the latest release for your OS and run it. An icon appears in the tray (menu bar on macOS).
- Copy some Markdown, click into a compose window, press
Win+Alt+V. - Select part of a mail, press
Win+Alt+C, paste anywhere.
On macOS, allow the app in System Settings > Privacy & Security > Accessibility so it can press Cmd+V / Cmd+C for you (details).
- The HTML is semantic and unstyled, so the mail client applies its own fonts.
- Tables, strikethrough and task lists are supported.
- One sentence per line stays one sentence per line: a single newline is a line break, as in GitHub comments.
- The Markdown stays on the clipboard as plain text, for apps that only take text.
The hotkey copies the selection for you (it sends Ctrl+C), then replaces the clipboard with Markdown and shows a notification. If you already copied, press it anyway: the HTML already on the clipboard is used.
Besides the usual headings, emphasis, links, lists, tables, quotes and code, it understands what mail clients and Word produce:
| In the mail | In the Markdown |
|---|---|
| Yellow highlight | <mark>Reply in yellow</mark> |
| Text in Courier New or Consolas | `CDE.TXT` |
| Word bullet and numbered paragraphs | - and 1. list items, nested by level |
| Line break | A plain newline (<br> inside table cells) |
| Pasted screenshot |  |
| Image from the web |  |
| Image file on your disk (Markdown preview, Obsidian) | , the file itself |
Image the app cannot read (cid:, imap:) |
[image] |
Empty spacer paragraphs and non-breaking spaces are cleaned up. Only text is left on the clipboard.
Every image is linked by an absolute path when it can be read from this machine:
- Embedded in the copy (
data:images, as most mail clients copy pasted screenshots): saved to~/Pictures/clip-md-html. - A file on your disk, whatever the address looks like:
file:///C:/…, VS Code's Markdown preview (https://file+.vscode-resource.vscode-cdn.net/c%3A/…), Obsidian (app://…/C:/…). The image is linked where it is, nothing is copied. Temporary files, such as the ones Outlook and Word create while copying, are copied to~/Pictures/clip-md-htmlinstead, because they disappear. - The path is only used if the file exists and has an image extension (png, jpg, gif, webp, bmp). A page you copy from therefore cannot slip the path of another file, such as a credentials file, into the Markdown for an agent to open. Network paths are never tried, and one conversion handles at most 200 images and saves at most 100 MB.
Local tools (a coding agent, a Markdown editor) open these paths directly. In a web app, drag the file in.
Files in ~/Pictures/clip-md-html are named after the conversion time (UTC); the same image twice in one selection is saved once. Files the app created are deleted after 24 hours, the next time an image is saved. Anything else in the folder is left alone.
- Replace copied Markdown with rich text: copy Markdown, click this entry, then paste with Ctrl+V (Cmd+V on macOS) wherever you want.
- Replace copied rich text with Markdown: copy part of a mail or web page, click this entry, then paste the Markdown.
- Start with Windows / Start at login: opt-in autostart.
- Quit.
The first two do the same conversions as the hotkeys but press no key for you. Use them when the hotkey cannot copy or paste on its own: an app running as administrator, macOS without the Accessibility permission, a hotkey taken by another app, a terminal where Ctrl+C or Ctrl+V means something else, or to paste the result in several places.
Only one instance runs at a time.
~/.config/clip-md-html/config.toml (or $XDG_CONFIG_HOME/clip-md-html/config.toml), created on first run:
hotkey = "Win+Alt+V" # Markdown to rich text, then paste. macOS: "Cmd+Alt+V"
markdown_hotkey = "Win+Alt+C" # copy the selection as Markdown. macOS: "Cmd+Alt+M"Modifiers: Win/Cmd, Alt/Option, Ctrl, Shift. Restart the app after editing. A notification reports an invalid or already-taken hotkey.
Rejected hotkeys, upgrades, log location
Ctrl+Altis rejected on Windows (it is AltGr on AZERTY), andCtrl+Shift+Veverywhere (paste as plain text in most apps).- On Windows the file is
%USERPROFILE%\.config\clip-md-html\config.toml. The Linux CLI reads nothing from it. - Configs from earlier versions without
markdown_hotkeyuse its default. - Upgrading from before 0.3: if the new file does not exist, the old one (
%APPDATA%\clip-md-html\config.tomlon Windows,~/Library/Application Support/clip-md-html/config.tomlon macOS) is copied over at startup and left in place. If both exist, the new one wins and the log says so. - Log:
%LOCALAPPDATA%\clip-md-html\clip-md-html.logon Windows,~/Library/Logs/clip-md-html/clip-md-html.logon macOS, stderr on Linux.
clip-md-html --once # Markdown on the clipboard to rich text, without pasting
clip-md-html --to-markdown # HTML on the clipboard to Markdown, without copyingBoth exit with code 1 when there is nothing to convert.
Releases ship clip-md-html-<version>-windows-x86_64.zip, -macos-universal.tar.gz, -linux-x86_64.tar.gz and -linux-aarch64.tar.gz, with checksums in SHA256SUMS.txt.
From source:
cargo install --path .- Pressing
Cmd+VandCmd+Cfor you requires System Settings > Privacy & Security > Accessibility. Enableclip-md-html(or the terminal launching it) and restart the app. Without it the clipboard is still converted and a notification asks you to paste yourself. - The app has a menu bar icon and no Dock icon.
- Autostart uses
~/Library/LaunchAgents/fr.shaffe.clip-md-html.plist, effective at next login. - The binary is unsigned. After download, run
xattr -d com.apple.quarantine ./clip-md-html.
No tray icon and no built-in hotkey: bind a command to a shortcut in your desktop environment.
clip-md-html --once # Markdown to rich text
clip-md-html --paste # same, then press Ctrl+V
clip-md-html --to-markdown # HTML to Markdown (copy the selection yourself first)Use the absolute path if the binary is not in the desktop's PATH. Super+Alt+V is a good choice; avoid Ctrl+Shift+V.
- GNOME: Settings > Keyboard > Keyboard Shortcuts > Custom Shortcuts, command
clip-md-html --paste. - KDE Plasma: System Settings > Keyboard > Shortcuts > Add New > Command or Script.
- Sway:
bindsym --release $mod+Mod1+v exec clip-md-html --paste - Hyprland:
bindr = SUPER ALT, V, exec, clip-md-html --paste - X11 window managers: the WM's own bindings,
xbindkeysorsxhkd.
Needs glibc 2.35 or newer (Ubuntu 22.04, Debian 12, Fedora 36 and later).
How the clipboard and the paste work on Linux
The Linux clipboard only lives as long as the program that owns it. Each command therefore starts a detached copy of itself that serves the result until another application copies something, then exits; the command itself returns right away. On Wayland it uses the wlr-data-control protocol (sway, Hyprland, other wlroots compositors, recent KDE Plasma). GNOME's Mutter does not implement it, so there the X11 clipboard through XWayland is used, which is untested.
--paste presses Ctrl+V with the first tool that works, picked from XDG_SESSION_TYPE, WAYLAND_DISPLAY and DISPLAY:
| Session | Tools, in order |
|---|---|
| Wayland | wtype, ydotool |
| X11 | xdotool, ydotool |
- A tool that fails (
wtypeon GNOME Wayland, for example) falls through to the next. An error listing every attempt is shown only if all fail, and if none is installed the error says what to install. The clipboard is converted either way. ydotoolneeds itsydotoolddaemon and access to/dev/uinput, which this program does not set up. The 1.x syntax is tried first, then 0.1.x.- Every tool is told to release Super, Alt, Shift and Ctrl before Ctrl+V, but on Wayland the compositor still sees the physical keys as held. Prefer release-triggered bindings (
bindsym --release,bindr). GNOME and KDE have none: if the paste lands as another shortcut, use--onceand press Ctrl+V yourself. - If the background holder fails to start, its stderr is included in the error.
- Running without arguments prints a usage hint and exits with status 2.
What is tested on Linux
CI (Ubuntu 22.04, x86_64 and aarch64) builds, runs clippy and the unit tests, then end-to-end jobs against a real clipboard:
- X11 under Xvfb with
xclip, and Wayland under headless sway withwl-clipboard:--oncereturns promptly,text/htmlis offered with the expected tags and nostyle=, the plain text is still the Markdown, the holder outlives the command and exits when another client takes the clipboard. --pasteunder Xvfb withxdotool: a Tk window receives Ctrl+V and reads thetext/htmlflavor.--pastewith a failing fakewtypeahead of a fakeydotool: it falls through, and reports every attempt when all fail.
--to-markdown is covered by the converter's unit tests only. Not tested: GNOME and KDE on Wayland, wtype and ydotool on a real compositor, pasting into a real application, and the aarch64 build beyond compiling.
Global hotkeys, simulated keys (SendInput / CGEvent) and autostart in an unsigned binary can trigger heuristic false positives. The app registers its two hotkeys with RegisterHotKey, uses no keyboard hook and never reads key state. It writes only to its config, log and images folders and makes no network requests. The Windows exe embeds version metadata and an asInvoker manifest.
Windows binaries are unsigned for now, so SmartScreen may warn; signing through SignPath Foundation is planned. Autostart on Windows uses HKCU\Software\Microsoft\Windows\CurrentVersion\Run. During development you can exclude target/ from scanning.
cargo build --release
cargo clippy --all-targets -- -D warnings
cargo testCI builds and tests on Windows, macOS and Linux, plus the Linux clipboard end-to-end jobs. Pushing a v* tag publishes a release.
Issues and pull requests are welcome; run clippy and the tests first. For vulnerabilities, see SECURITY.md.
MIT