HTML to Markdown converter using regex

Estimated reading time of this article: 1 minute 1 second

Do you want to easily convert HTML to Markdown? Simply by copy & paste?

I've a series of HTML blog posts written in HTML with TinyMCE which I want to convert to Markdown Extra. There are several scripts for this task:

Neither really satisfied me. Furthermore, I want to convert my blog posts with saving all of them to a file. I've written a little JavaScript script.

As I'm using regex the conversion is limited. The HTML must be well formed without errors. Simply, <p> <br> <strong> <em> <h1> <h2> <h3> <h4> <h5> <a> <li> are replaced with the Markdown equivalent. Thus, a conversion using this script is not fully automatic. But for my task perfect.

Converter

Source Code

Show JavaScript source code

The JavaScript source file.