Created
February 25, 2026 10:30
-
-
Save koke/b2f895adce3bd1847803b6917be831a9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # Copy markdown from stdin as rich text to the macOS clipboard. | |
| # Pasting into Slack, Mail, etc. preserves formatting and clickable links. | |
| # Requires: pandoc (brew install pandoc) | |
| set -euo pipefail | |
| if [ -t 0 ]; then | |
| echo "Usage: echo '**bold** [link](url)' | md2clipboard" >&2 | |
| exit 1 | |
| fi | |
| html=$(pandoc -f markdown -t html) | |
| hex=$(echo -n "$html" | hexdump -ve '1/1 "%.2x"') | |
| printf 'set the clipboard to {text:" ", «class HTML»:«data HTML%s»}' "$hex" | osascript - |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment