Convert HTML and documents from Google Docs to Markdown
A few months ago I had to quickly convert some HTML documents and documents from Google Docs to Markdown. In the past I would have used Pandoc on my computer to convert the HTML documents for this. I would have saved the documents from Google Docs as LibreOffice and tried Pandoc again.

But Pandoc simply refused his service. Was it perhaps angry that I hadn’t called it for a long time? However, I needed a solution quickly.
Online tools
Fortunately, there are a few places on the web where you can convert HTML to Markdown. One is the Pandoc website. Here you can also convert back and forth between different plain text formats online. Besides there is also an online converter where you can only convert HTML to Markdown.
Convert from Google Docs to Markdown
After I converted the HTML documents, I had to take care of the documents in Google Docs. There is a script on GitHub called gdocs2md. The procedure is quite simple. First of all, go to GitHub and get the code from there. Copy this code and go to your document on Google Docs.

In the menu you call the tools and then the script editor:

Clean up the file in the script editor first and give it the code from the clipboard and save it under an easy to remember name. For example, as “Export as Markdown”.
Then call the file you want to export from Google Docs again and restart the script via Tools → Script Editor… After that you have to confirm at least twice that you really want to run this script. This is a security query from Google and serves your protection. I trust the script so far, because the author is an employee of Google.
The markdown document and any attachments, such as images, will then be sent to your email address.
I tried this on several documents in the past and it worked very well.
Originally published at steemit.com on September 5, 2018.
