{"repo":"andrewdotn/2md","free":true,"listed":false,"github":"https://github.com/andrewdotn/2md","clone":"git clone https://github.com/andrewdotn/2md.git","description":"convert formatted text to markdown","language":"TypeScript","stars":14,"topics":["markdown","html-to-markdown","typescript-library","cli","clipboard"],"license":"Apache-2.0","category":"cli-tools","readme_excerpt":"2md: convert formatted text to markdown There are lots of packages for turning markdown into html, but this one goes the other way, turning formatted html into markdown. Say you’re reading an [Ars Technica article][] and want to copy something into some markdown notes. Just select some content in your browser, copy it, then run 2md . The heading, list formatting, bold text, and hyperlinks are all preserved. [Ars Technica article]: https://arstechnica.com/gadgets/2019/10/macos-10-15-catalina-the-ars-technica-review/3/#h1 You can try it out online at 2md.ca. A detailed writeup of the internals exists: “Compiling HTML to Markdown with TypeScript: How 2md works” Installation The easiest way to try out 2md from the command line is with [ npx ][], a tool to automatically download, cache, and run programs; it’s been included with Node.js [since 2017][]: [ npx ]: https://www.npmjs.com/package/npx [since 2017]: https://medium.com/@maybekatz/introducing-npx-an-npm-package-runner-55f7d4bd282b npx 2md [--no-quote] [FILE] You can also install to install the 2md command with yarn : yarn [global] add 2md Usage Run npx 2md [--no-quote] [FILE] to get markdown. By default, 2md reads from the clipboard, using osascript , [ xclip ][], or powershell . Otherwise, pass it the name of html file as a command-line argument. [ xclip ]: https://github.com/astrand/xclip For easy inserting of stuff into other documents, --quote is on by default and wraps the markdown in a blockquote: # Foo bar ... API Onl","default_branch":null,"files":null,"tree":[],"storefront":"/r/andrewdotn","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/andrewdotn/2md/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}