Other / Markdown / Copy Selection To MD With Turndown
The Copy Selection to Markdown with Turndown bookmarklet converts selected HTML content to Markdown using the Turndown library and copies it to the clipboard. Loads the TurndownService from unpkg.com if not already available, configures it with ATX headings, fenced code blocks, and dash list markers, converts the selected HTML to Markdown format, and displays a green notification on success or an error message on failure. Supports the full range of HTML-to-Markdown conversion provided by Turndown.
Run Copy Selection To MD With Turndown
Test run or drag to
bookmarklets bar to install
javascript:%21function()%7Bfunction%20e(e)%7Bvar%20t%3Dnew%20TurndownService(%7BheadingStyle%3A%22atx%22%2CcodeBlockStyle%3A%22fenced%22%2CbulletListMarker%3A%22-%22%7D).turndown(e)%3Bnavigator.clipboard.writeText(t).then(function()%7Bvar%20e%3Ddocument.createElement(%22div%22)%3Be.textContent%3D%22Markdown%20copied%20to%20clipboard%21%22%2Ce.style.cssText%3D%22position%3Afixed%3Btop%3A20px%3Bright%3A20px%3Bbackground%3A%234CAF50%3Bcolor%3Awhite%3Bpadding%3A10px%2020px%3Bborder-radius%3A5px%3Bz-index%3A10000%3Bfont-family%3Asans-serif%3B%22%2Cdocument.body.appendChild(e)%2CsetTimeout(function()%7Be.remove()%7D%2C2e3)%7D).catch(function(e)%7Balert(%22Failed%20to%20copy%20to%20clipboard%3A%20%22%2Be)%7D)%7Dvar%20t%3Dwindow.getSelection()%3Bif(t.toString())%7Bvar%20n%3Dt.getRangeAt(0)%2Co%3Ddocument.createElement(%22div%22)%3Bo.appendChild(n.cloneContents())%3Bvar%20i%3Do.innerHTML%3Bif(%22undefined%22%3D%3Dtypeof%20TurndownService)%7Bvar%20d%3Ddocument.createElement(%22script%22)%3Bd.src%3D%22https%3A%2F%2Funpkg.com%2Fturndown%2Fdist%2Fturndown.js%22%2Cd.onload%3Dfunction()%7Be(i)%7D%2Cdocument.head.appendChild(d)%7Delse%20e(i)%7Delse%20alert(%22Please%20select%20some%20text%20first%21%22)%7D()%3B
← Back to all bookmarklets