Easily convert richly formatted text or HTML to Markdown. Use the clipboard and paste to Markdown with a single keypress.
The conversion is carried out by Turndown (formerly to-markdown), a Markdown converter running in the browser.
http://euangoddard.github.io/clipboard2markdown/
Open the app, copy some rich text and press Ctrl+V (or ⌘+V on Mac)
anywhere on the page.
The converted Markdown is selected, ready to copy with Ctrl+C
(or ⌘+C), or use the Copy button.
One can paste multiple times. A paste replaces the selected text, so pasting straight after a conversion overwrites it; place the cursor in the output first to insert at that point instead.
Typographic punctuation (“curly quotes”, en and em dashes, the
ellipsis) is kept as pasted. Switch on Pandoc ASCII punctuation to
write it the way Pandoc's smart
extension expects
instead (", ', --, ---, ...). The browser remembers the choice.
The app is built with Solid 2 and Vite, and tested with Vitest.
npm install
npm run dev # start a development server
npm test # run the test suite
npm run typecheck # type-check with TypeScript
npm run build # production build in dist/src/converter/holds the HTML to Markdown conversion: Turndown configured with the original Pandoc, GFM and Markdown rules, plus the Pandoc clean-up of line breaks and, optionally, punctuation. The switch's "Pandoc ASCII punctuation" is'ascii'punctuation in the code; off is'typographic'.src/App.tsxis the page: the paste shortcut, the hidden paste target, the punctuation switch, and the output.src/punctuationPreference.tsremembers the punctuation choice inlocalStorage.legacy/is the original implementation, kept unmodified as a test oracle.
The suite checks that the rewrite reproduces the original behaviour. The original always wrote ASCII punctuation, so the parity tests run with it switched on:
test/converter.test.tsspecifies every conversion rule. Each expectation is asserted against both the original converter and the new one.test/parity.test.tscompares the two converters on a corpus and on thousands of seeded random documents. The few intentional differences are listed there; all of them fix whitespace bugs in the original.test/appParity.test.tsxruns the original page and the new app through the same user journeys (shortcut, paste, caret placement, repeated pastes) and compares their state after every step.test/app.test.tsx,test/insertText.test.ts,test/pasteShortcut.test.ts,test/cleanUp.test.tsandtest/punctuationPreference.test.tscover the individual pieces.
clipboard2markdown was created by Euan Goddard. The original version used html2markdown by Kates Gasis and Himanshu Gilani. Vegard Øye ported it to to-markdown by Dom Christie, which has since become Turndown. Version 2 is a rewrite in Solid on Turndown.
Released under the MIT License. See the LICENSE file for details.
