fmtmd
CLI tool written in Go. Convert Markdown to Slack-compatible HTML format for pasting into Slack, Google
Docs, and other apps that recognize HTML clipboard format.
Installation
From Source
go install github.com/rynf1t/fmtmd@latest
Or build from source:
git clone https://github.com/rynf1t/fmtmd.git
cd fmtmd
go build -o fmtmd
Pre-built Binaries
Download pre-built binaries from GitHub Releases for macOS, Linux, and Windows.
Usage
# Read from stdin
echo "# Hello **world**" | fmtmd
# Read from file
fmtmd input.md
# Read from clipboard
fmtmd -c
# Write to file instead of clipboard
fmtmd input.md -o output.html
# Output to stdout (don't copy to clipboard)
fmtmd input.md -clipboard=false
Features
- Converts Markdown to HTML with proper heading tags (
<h1>, <h2>,
<h3>) for Google Docs
- Converts to Slack format for plain text fallback
- Copies HTML to clipboard in a format recognized by Slack and Google Docs
- Supports all common Markdown features:
- Headings
- Bold and italic text
- Lists (bulleted and numbered)
- Code blocks and inline code
- Links
- Blockquotes
- Strikethrough
Platform Support
- macOS: Full HTML clipboard support using AppleScript
- Linux: Plain text clipboard (HTML clipboard support coming soon)
- Windows: Plain text clipboard (HTML clipboard support coming soon)
How It Works
- Reads Markdown from stdin, file, or clipboard
- Converts directly to HTML (preserving heading structure for Google Docs)
- Also generates Slack-formatted text as a fallback
- Copies HTML to clipboard using platform-specific methods
- When you paste into Slack or Google Docs, the HTML format is recognized and formatting is applied
Examples
# Convert a markdown file and paste into Slack
fmtmd meeting-notes.md
# Convert from clipboard and paste into Google Docs
fmtmd -c
Troubleshooting
- Formatting doesn't work when pasting: Make sure you're pasting into an app that
recognizes HTML clipboard format (Slack, Google Docs, etc.)
- Clipboard errors on macOS: Ensure you've granted Terminal/iTerm accessibility
permissions in System Preferences
- HTML clipboard not working: The tool will fall back to plain text. HTML clipboard
support is currently only available on macOS.
See Also
Web version - Use the tool in your browser
View source code on
GitHub