Last active
February 8, 2025 15:34
-
-
Save mitry/59d5d6f12cb787e90175b2de97ff5eec to your computer and use it in GitHub Desktop.
Bookmarklet: save webpage as clean Markdown file.
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
| javascript: | |
| !function(){ | |
| const | |
| base64 = x => btoa(unescape(encodeURIComponent(x))), | |
| onload = x => { | |
| if (!Readability || !TurndownService) return; | |
| const content = new Readability(document.cloneNode(true)).parse().content, | |
| text = new TurndownService().turndown(content) | |
| + `\n\n[original]: ${document.location.href} "${document.title}"\n`, | |
| link = document.createElement('a'); | |
| link.href = `data:text/markdown;base64,${base64(text)}`; | |
| link.download = document.title.replace(/\s+/g,'-') + '.md'; | |
| document.body.appendChild(link).click(); | |
| }, | |
| require = x => document.head.append(Object.assign(document.createElement('script'),{src:x,onload:onload})); | |
| require('//cdn.jsdelivr.net/npm/@mozilla/readability/Readability.min.js'); | |
| require('//cdn.jsdelivr.net/npm/turndown/dist/turndown.min.js'); | |
| }() |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Minified version: