Let’s get this out of the way first: Google Docs doesn’t natively support Markdown. However, by using the free and open source Docs to Markdown add-on for Google Docs, you can quickly and easily export a Google Doc to Markdown. (The add-on doesn’t help with importing Markdown into Google Docs.)

This add-on was created by a retired Google technical writer, and it’s currently the best way to export a Google Doc to Markdown. Docs to Markdown is useful for teams that want to use Google Docs for the collaboration features, but ultimately need Markdown-formatted plain text to publish to a website.

Once you install the Docs to Markdown add-on in your Google account, you can open a document in Google Docs and access the add-on from the Add-ons menu. After you select the convert option, the Markdown-formatted version of your document will appear in a sidebar, as shown below. At that point, you can copy and paste the Markdown-formatted text into another application.

Markdown in Google Docs

I recently used Docs to Markdown to convert a 50-page Google Doc to Markdown. I can’t say that my experience was great, but it was better than manually converting the document to Markdown by hand.

One issue is that the add-on has strong opinions when it comes to syntax, and there’s no way to customize how the add-on outputs text to Markdown. For example, the add-on outputs italicized text using underscores instead of asterisks, something that could lead to unexpected errors in the output. I also discovered that the add-on doesn’t correctly handle link conversion. There were numerous stray spaces in my links, leading to broken formatting in the Markdown-formatted text.

No matter what type of document you convert, you should plan on inspecting the output that the Docs to Markdown add-on generates. The add-on still feels like a work-in-progress, and you may find yourself needing to fix broken formatting.

另请参阅

想了解更多 Markdown 技巧?

现在不要停下来!在下面输入你的电子邮件地址,以通过电子邮件接收新的 Markdown 教程。我们不会发送垃圾邮件!