You can give StackEdit a try. It has a nice integration with Google Drive.
Once you import/export a Markdown document from/to Google Drive, you can open it later directly from Google Drive since StackEdit is integrated as a third party editor/viewer application.
You can find StackEdit as a Chrome application as well on the Web Store.
NOTE: I’m the developer of StackEdit.
A Google Docs document encodes everything in ‘elements’ within the Kix editor that it’s all based on (it’s closed source as basically this is the big trade secret, with which anyone else could run their own Docs service – which is a shame imo).
When I came to do this earlier in the year there were dozens of forks of Renato Mangini’s “gdocs2md” repo, but he seemed to have stopped fielding pull requests, and over the period of a few years forks had appeared that were far better than others. I went through many of these in the tree and put the best into a new package, which also generates HTML mixed with the markdown for elements Google Docs supports such as superscript and subscript elements (which markdown has no way of representing). Even incorporating the best of others’ edits, the parsing needed work, and I’m confident that this is the best available for the job at present.
Script available on GitHub with installation instructions: lmmx/gdocs2md-html
I also worked on adding in the most important feature to such a script – user features – providing the markdown in a pop-up within Google Docs rather than saving to file (I think the original was batch saving for entire folders, which is not suitable for my document-drafting needs, or how I use Google Docs at all).
I’d like to suggest it be a single more sophisticated project for interested developers to collaborate on (or at least suggest features for) rather than everyone forking off scripts of various quality, when we’re likely working to the same aims.
As well as reducing duplication of effort, the Google Docs policy for creation of “add-ons” states that to be published (and therefore ‘installable’ rather than needing to be loaded for each document in a slightly awkward manner)
The add-on must be fully functional — it can’t be a “work in progress.”
The script has been tested with multiple active users.
Obviously if you wanted a “pure” markdown then either switch off these features (the code is there to fork) or just don’t use sub/superscripts, etc. It wouldn’t be too difficult to add personalised settings to such a script if it matures as an add-on, if there’s significant interest.
You can convert a Markdown document to HTML, and copy/paste the HTML page (not the source) into a Google Drive document. It will retain most of the formatting including headings, lists, links, bold/italic/underline.
The font, margins, and font sizes will not match the Google Drive defaults, and will look “out of place” compared to standard Google Drive documents. Applying a custom CSS file to the HTML document will solve this, making the document look very similar.
I’m not sure about the other direction, converting Google Drive documents to Markdown. It may be possible to export to HTML and use an HTML to Markdown converter.