Scripts for converting the clipboard to and from markdown
Swift
13
25 commits
updated Sep 20, 2026
When you copy text it often carries extra formatting (colors, fonts, sizes). The Normalize Clipboard utility fixes this by limiting it to basic formatting (bold, italic, links) so it matches your destination document.
Many LLMs understand rich text when presented as Markdown, but not directly. The Markdownify Clipboard utility converts rich text to Markdown, ready to paste.
Both work by modifying your clipboard in place. For example, I could copy some colorful text, run "Normalize Clipboard", and paste into an existing document where it would match the style of what I was already working on.
See https://www.jefftk.com/p/clipboard-normalization
macapp/ holds a single native menu bar app that does all three conversions:
It does the conversion itself in Swift, using SwiftSoup to parse HTML and swift-markdown to render it, so it needs no Pandoc and no other setup. It runs in the App Sandbox and is the version intended for the Mac App Store. It also offers a "Launch at Login" toggle, which works for the app on its own rather than needing a trip through System Settings.
To build and install it:
$ make app-install
The apps described below are the original Pandoc-based ones, kept for the command line tools and for people already using them.
If you use Homebrew this is just:
$ brew install pandoc
Otherwise:
Click "Download the latest installer"
Download the file named pandoc-...-arm64-macOS.pkg (for Apple Silicon
Macs) or pandoc-...-x86_64-macOS.pkg (for Intel Macs)
Open the downloaded .pkg file and follow the installation wizard
The easiest way to use these tools is to download the pre-built Mac apps. To install:
Note: If using Chrome, you may see "Suspicious Download Blocked":
Extract the .zip file by double-clicking it
Move to Applications folder:
.app file to your /Applications folderOpen the app for the first time:
Approve the app to run:
Add to startup (optional but recommended):
The apps will appear as icons in your menu bar. Click them to run the clipboard conversion.
Clone or download this repository:
$ git clone https://github.com/jeffkaufman/clipboard-markdown.git
$ cd clipboard-markdown
Build the html-clipboard binary:
$ make
This compiles the Swift source code into the bin/html-clipboard executable.
Without this step, the scripts will not work.
Converts the clipboard from HTML to plain Markdown text.
$ markdownify-clipboard
Example:
markdownify-clipboardReads Markdown from stdin, converts it to HTML, and puts it on the clipboard as rich text (and plain text), ready to paste.
$ markdown-to-clipboard
Example:
$ echo "# Title" | markdown-to-clipboard # Put formatted HTML on clipboard
Normalizes HTML formatting by converting clipboard HTML to Markdown and back to HTML, removing unnecessary formatting.
$ normalize-clipboard
Example:
normalize-clipboardLow-level utility for getting and setting HTML on the clipboard.
$ html-clipboard get # Print HTML from clipboard to stdout
$ html-clipboard set # Read HTML from stdin and put on clipboard
Example:
$ html-clipboard get > saved.html # Get HTML from clipboard
$ echo "<h1>Title</h1>" | html-clipboard set # Put HTML on clipboard
To run these scripts from anywhere, add the bin directory to your PATH. For
example, add to your ~/.bashrc or ~/.zshrc:
$ export PATH="$PATH:/path/to/clipboard-markdown/bin"
The menu bar app's conversions have their own test suite, which does not touch the system clipboard:
$ make app-test
The Pandoc scripts are tested with pytest. Install Python dependencies for running those tests:
$ pip install -r requirements.txt
Run the test suite with pytest:
$ pytest
Note that this will interact with your real system clipboard, so make sure you don't have anything in there you want to keep when running tests!
To build both apps and install to /Applications/:
$ make install
The build process:
bin/html-clipboard)See Makefile and build-apps.sh for the full configuration.
To build, zip, and upload the apps for distribution:
$ make distribute
This creates the zip files referenced in the installation instructions above and uploads them to the server. This target is specific to the maintainer's setup.
make app-store builds a signed installer package for App Store Connect. It
needs, one time:
com.jefftk.ClipboardNormalizer in the developer portal.security find-identity -v lists what you have).Then:
$ SIGN_IDENTITY="Apple Distribution: Your Name (TEAMID)" \
INSTALLER_IDENTITY="3rd Party Mac Developer Installer: Your Name (TEAMID)" \
PROVISIONING_PROFILE=~/Downloads/Clipboard_Markdown.provisionprofile \
BUILD_VERSION=2 \
make app-store
BUILD_VERSION has to increase with every upload. Upload the resulting
ClipboardNormalizer.pkg with Transporter.app or xcrun altool --upload-app.
The App Store also requires the signature to carry application-identifier and
team-identifier entitlements, which Xcode would normally add. build-app.sh
reads them out of the provisioning profile instead, so there is no team ID to
keep in sync by hand, and a profile for the wrong App ID fails the build rather
than the upload.
The listing text lives in app-store-metadata.md.
Note that the Pandoc-based apps cannot go to the App Store: a sandboxed app
cannot run a binary from /opt/homebrew, and Pandoc is GPL-licensed, which is
incompatible with the App Store's terms.
Swift
78.6%
Shell
10.3%
Python
6.6%
Makefile
3.4%
HTML
1.1%
Scripts for converting the clipboard to and from markdown
Swift
13
25 commits
updated Sep 20, 2026
When you copy text it often carries extra formatting (colors, fonts, sizes). The Normalize Clipboard utility fixes this by limiting it to basic formatting (bold, italic, links) so it matches your destination document.
Many LLMs understand rich text when presented as Markdown, but not directly. The Markdownify Clipboard utility converts rich text to Markdown, ready to paste.
Both work by modifying your clipboard in place. For example, I could copy some colorful text, run "Normalize Clipboard", and paste into an existing document where it would match the style of what I was already working on.
See https://www.jefftk.com/p/clipboard-normalization
macapp/ holds a single native menu bar app that does all three conversions:
It does the conversion itself in Swift, using SwiftSoup to parse HTML and swift-markdown to render it, so it needs no Pandoc and no other setup. It runs in the App Sandbox and is the version intended for the Mac App Store. It also offers a "Launch at Login" toggle, which works for the app on its own rather than needing a trip through System Settings.
To build and install it:
$ make app-install
The apps described below are the original Pandoc-based ones, kept for the command line tools and for people already using them.
If you use Homebrew this is just:
$ brew install pandoc
Otherwise:
Click "Download the latest installer"
Download the file named pandoc-...-arm64-macOS.pkg (for Apple Silicon
Macs) or pandoc-...-x86_64-macOS.pkg (for Intel Macs)
Open the downloaded .pkg file and follow the installation wizard
The easiest way to use these tools is to download the pre-built Mac apps. To install:
Note: If using Chrome, you may see "Suspicious Download Blocked":
Extract the .zip file by double-clicking it
Move to Applications folder:
.app file to your /Applications folderOpen the app for the first time:
Approve the app to run:
Add to startup (optional but recommended):
The apps will appear as icons in your menu bar. Click them to run the clipboard conversion.
Clone or download this repository:
$ git clone https://github.com/jeffkaufman/clipboard-markdown.git
$ cd clipboard-markdown
Build the html-clipboard binary:
$ make
This compiles the Swift source code into the bin/html-clipboard executable.
Without this step, the scripts will not work.
Converts the clipboard from HTML to plain Markdown text.
$ markdownify-clipboard
Example:
markdownify-clipboardReads Markdown from stdin, converts it to HTML, and puts it on the clipboard as rich text (and plain text), ready to paste.
$ markdown-to-clipboard
Example:
$ echo "# Title" | markdown-to-clipboard # Put formatted HTML on clipboard
Normalizes HTML formatting by converting clipboard HTML to Markdown and back to HTML, removing unnecessary formatting.
$ normalize-clipboard
Example:
normalize-clipboardLow-level utility for getting and setting HTML on the clipboard.
$ html-clipboard get # Print HTML from clipboard to stdout
$ html-clipboard set # Read HTML from stdin and put on clipboard
Example:
$ html-clipboard get > saved.html # Get HTML from clipboard
$ echo "<h1>Title</h1>" | html-clipboard set # Put HTML on clipboard
To run these scripts from anywhere, add the bin directory to your PATH. For
example, add to your ~/.bashrc or ~/.zshrc:
$ export PATH="$PATH:/path/to/clipboard-markdown/bin"
The menu bar app's conversions have their own test suite, which does not touch the system clipboard:
$ make app-test
The Pandoc scripts are tested with pytest. Install Python dependencies for running those tests:
$ pip install -r requirements.txt
Run the test suite with pytest:
$ pytest
Note that this will interact with your real system clipboard, so make sure you don't have anything in there you want to keep when running tests!
To build both apps and install to /Applications/:
$ make install
The build process:
bin/html-clipboard)See Makefile and build-apps.sh for the full configuration.
To build, zip, and upload the apps for distribution:
$ make distribute
This creates the zip files referenced in the installation instructions above and uploads them to the server. This target is specific to the maintainer's setup.
make app-store builds a signed installer package for App Store Connect. It
needs, one time:
com.jefftk.ClipboardNormalizer in the developer portal.security find-identity -v lists what you have).Then:
$ SIGN_IDENTITY="Apple Distribution: Your Name (TEAMID)" \
INSTALLER_IDENTITY="3rd Party Mac Developer Installer: Your Name (TEAMID)" \
PROVISIONING_PROFILE=~/Downloads/Clipboard_Markdown.provisionprofile \
BUILD_VERSION=2 \
make app-store
BUILD_VERSION has to increase with every upload. Upload the resulting
ClipboardNormalizer.pkg with Transporter.app or xcrun altool --upload-app.
The App Store also requires the signature to carry application-identifier and
team-identifier entitlements, which Xcode would normally add. build-app.sh
reads them out of the provisioning profile instead, so there is no team ID to
keep in sync by hand, and a profile for the wrong App ID fails the build rather
than the upload.
The listing text lives in app-store-metadata.md.
Note that the Pandoc-based apps cannot go to the App Store: a sandboxed app
cannot run a binary from /opt/homebrew, and Pandoc is GPL-licensed, which is
incompatible with the App Store's terms.
Swift
78.6%
Shell
10.3%
Python
6.6%
Makefile
3.4%
HTML
1.1%