Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Convert a Markdown text file into a Google Document using Appscript?

I am trying to migrate a load of documentation which was written in markdown into a Google Doc so it can be used by our marketing department.

Is there a mechanism using appscript/ Google Docs Api that I can import a file and convert it to a Google Doc using a predefined template? Eg H1s will map to Title, etc

like image 638
UKDataGeek Avatar asked Jun 29 '19 19:06

UKDataGeek


2 Answers

One suggestion: use Pandoc to convert Markdown to docx, then import to Google Docs using the Google Drive API.

You can also accomplish this using the Google Drive web interface:

  1. Convert markdown to ODT (or some other intermediate) using pandoc: pandoc MyFile.md -f markdown -t odt -s -o MyFile.odt
  2. Move the ODT file into your Google Drive folder.
  3. Right-click the ODT file (in the web version of Drive) and press "Open With -> Google Docs".
  4. Google Drive will now create a new Google Doc, with contents matching the ODT file, and open it for you.
like image 176
Sam Dutton Avatar answered Nov 04 '22 12:11

Sam Dutton


No add-ons needed

I just stumbled upon a really simple approach that may suit your needs.

In github, I opened a ReadMe.md file, rendered in the browser as rich text. I copied it from the browser and pasted it into a new Google Doc.

Voila: Google Docs preserved the headings, bullets, etc. I can't vouch for what it does with links and other fancier markdown ops, but it was a quick way to get started.

like image 42
fearless_fool Avatar answered Nov 04 '22 13:11

fearless_fool