Markdowndown lets you easily convert web pages to Markdown
Take a look at the HTML of any web page, and you'll see it's an almost incomprehensible mess. Sure, with some practice you can probably make sense of it, but its hardly intuitive, and it's definitely not a pleasant experience.
In contrast, Markdown is a lightweight markup language that is used to format text. It allows you to create formatted documents using plain text with simple syntax. You can use it to easily create web pages, and in fact, this very website is written using Markdown before being converted to HMTL by Publii - our favorite static site generator. If we had a mind to, we could convert our Markdown file to PDF, Docx, or.... anything really.
Aside from its readability, Markdown has other advantages, too. Web pages can be huge, with massive chunks of unnecessary JavaScript, tracking code, and other such cruft, which can rapidly fill up your storage if you're in the habit of downloading them for later perusal.
A nice, neat Markdown file takes up almost no space at all, while preserving formatting and being easily readable - even without a dedicated Markdown viewer.
Need to convert HTML to Markdown? There's a self-hosed app for that!
If, like us, you regularly save web pages locally for you own archival purposes, you're probably dissatisfied with the way they display, and converting to Markdown by hand is time-consuming and fiddly.
Fortunately, it's simple to spin up Markdowndown, a self-hosted web app, which will convert any page to a clean Markdown file, with the option to download images as well, and have everything packaged neatly as a zip file.
And because, everything seems to come with some kind of AI integration these days, Markdowndown has an option to pass the Markdown to ChatGPT and have it perform useful tasks such as creating a TL;DR summary.
How to install Markdowndown on Linux
Markdowndown is written in JavaScript, so make sure you have Node Package Manager and Node.js installed before you start. Markdowndown requires node.js version 18.17.0 or above to run.
With that out of the way, open a terminal and clone the repository, and use the cd command to move into the new directory:
git clone https://github.com/asadm/markdowndown.git && cd markdowndown
Install Markdowndown with:
npm install
...and start it with
npm run dev
The server will start almost instantly, so open a web browser and navigate to http://localhost:3000.
Use Markdowndown to quickly convert your favourite web pages to Markdown
One of our favourite articles on Linux Impact is a November 2023 piece in which we repurposed a Leapfrog Leapster as a retro gaming handheld. It's awesome, and we want a copy of the article in Markdown for our files.
Simply copy the URL, and paste it into the text box of your local Markdowndown instance, and press convert, to get a handy, beautifully formatted Markdown version of the page, focussing on the content, without any of the related articles, navigation features or anything else you don't want.
If you tick the box to download images locally, you'll need to specify where the images should be stored, and choose to override the base URL in the Markdown, so your viewer or converter doesn't try and fetch them from the web.
The last checkbox is to get ChatGPT involved, and you'll need an OpenAI API key to use this feature. Should you wish to use it, you'll have the option of using ChatGPT 3.5 or 4 to fiddle with your text.
Fetching, formatting, and packaging our Markdown and images took about a second. We rendered it in our favourite Markdown editor, and as you can see in the screenshot, it looks great.