Hacker News new | past | comments | ask | show | jobs | submit login
Import and Export Markdown in Google Docs (googleblog.com)
652 points by pentagrama 9 months ago | hide | past | favorite | 135 comments



Hey folks, I'm the engineer who implemented the new feature. Just clearing up some confusion.

A lot of you are noticing the preexisting automatic detection feature from 2022 [1], which I also worked on. That's NOT what this newly announced feature is. The new feature supports full import/export, but it's still rolling out so you're likely not seeing it yet!

Hope you like it once it reaches you :)

[1] https://workspaceupdates.googleblog.com/2022/03/compose-with...


The main effect of slow rollouts on me is that I never use the feature. It goes like this.

1. There's a service I use sporadically or used to use

2. They announce a new feature that might potentially mean I'll start using it again/more

3. I read the post, log in and realise I don't have access yet

4. I completely forget this ever happened.

Surely all the effort that goes into announcing these things is a bit wasted ?

What happened to the a nice "Labs" switch to opt into stuff that's new and a bit raw?


I can't speak to the reasoning for announcing before 100% rollout, but I can say that the slow rollout is for safety. That way if there's a severe bug, then we can catch it while it affects a small number of users, instead of all users.

Labs is more for experimental features that needs more beta testing before rolling out to everyone, rather than being the "first stage" of slow rollout.


That doesn't contradict the parent comment though. Engaged users should have an option somewhere to enable it, barely affecting the overall rollout.


It’s not about gating the new feature behind a flight, but not wanting to push a new build out to the furthest deployment ring before you need to.


I wish we could opt-in to get early access in the slow rollout. That way you get the enthousiastic users to promote the incoming feature and you get some tech savvy people to test it before it reaches out more people.


It is a bit odd how they do it in Docs. In Cloud, announcements happen when the feature has already fully rolled out. Note, this is separate from region expansion, which might be delayed for some heavy-weight features (like new categories of VMs requiring special hardware.)


Not announcing a feature in a collaborative environment would likely cause a fair bit of confusion when only some people see it.


Docs is supposedly a collaborative environment; without collaborative features, you're better off going back to Microsoft Word.


At least it's available to paying customers, that's not always the case.


Such a huge quality of life improvement for technical writers who rely on Gsuite collaboration features while editing Markdown docs. Thank you!


Is it also supported in the Google Drive export API? It's not in the docs yet at least. https://developers.google.com/drive/api/guides/ref-export-fo...


Yes, it will be supported by this API! I actually wasn't aware of this documentation page. I'll make sure it gets updated. Thanks for flagging


Oh that’s great. Does that mean Google drive will have good markdown previews now?


No, this feature doesn't affect the preview. We don't convert a Markdown file to a Doc unless a user initiates it


Should be updated now


You are my hero.

I work at Google in open source so I am constantly converting Google Docs to Markdown to put them on GitHub and vice versa. This will save me a lot of effort.


Is it possible to get this feature in Slides as well?

I often need to prepare technical slides with code in it, and being able to just backtick away into a <code> tag or a <pre> block would be a godsend.


Not sure if you have the patience to use a beta product, but I recently started adding slideshows to Scroll.

This source code: http://hub.scroll.pub/slideshowdemo/index.scroll

Produces this HTML: http://hub.scroll.pub/slideshowdemo/


Not an answer to your question because this isn't integrated with Slides, but Slidev[0] can be used for creating slidedecks in Markdown

[0]: https://github.com/slidevjs/slidev


Will the API support uploading conversion of markdown to "application/vnd.openxmlformats-officedocument.wordprocessingml.document"? I process thousands of documents each month -- often have to parse from HTML to Markdown to Docx then finally upload and convert to Google Doc format.


It will support importing Markdown as a Google Doc.

I won't support directly importing Markdown as DOCX. For that you could convert from Markdown to Docs to DOCX though.


Check out Pandoc.


Can I sync MD files to drive through the osx drive integration? Allowing me to work on a local file in MD, but others can view through web


Question: when coming up with tests (whatever level they might be) before you submit your code, what’s your thought process about what tests to include? What edge cases to handle? What to not test? Is there much disagreement about what to test?


We did indeed write A LOT of tests!

I would say there wasn't much disagreement there. I typically started out by writing tests for the simple cases, then I would identify edge cases through actual usage of the feature locally, and write tests for those as well. Also, whenever bugs were found, I would write "regression test cases" for those when fixing.


I would like to be able to open and edit .md files in Google Docs on desktop and mobile like how Google Docs supports opening .docx files


How does it handle images in the imports and exports?


Import supports links via upload

Export outputs base64 encoded image URLs. We use Markdown reference links to place the large URLs out of the way of reading at the bottom of the file


When I export Markdown, the image reference is placed like `[image-1][base64-reference]`. However, the reference links should be `[image-1](base64-reference)`. The brackets for the reference should be parentheses, not square.

Any hint on why you have used square brackets?


Link _references_ must be enclosed in brackets. Only _inline_ link URLs use parentheses

See https://daringfireball.net/projects/markdown/syntax#link


Thank you for your reply and sorry for my ignorance. I didn't look much about reference links before writing this.


No worries! Glad I could send some new knowledge your way :)


Is this also available from the googlecloud APIs libraries? Would be neat to be able to create a Google Doc from markdown content, it's something we were going to look into for one of the things we are building.


This will be supported by the Drive APIs


Thanks!

Google Colab also supports Markdown input cells as "Text" with a preview.

Does this work with Google Sites?

How to create a Google Sites page from a Markdown doc, with MyST Markdown YAML front matter

NotebookLM can generate Python, LaTeX, and Markdown.

How to Markdown and Git diff on a Chromebook without containers or Inspect Element because [...]

How to auto-grade Jupyter Notebooks with Markdown prose, with OtterGrader

How to build a jupyter-book from .rst, MyST Markdown .md, and .ipynb jupyter/nbformat notebooks containing MyST Markdown


I would have expected this to export CommonMark, but it seems like it's not quite up to that yet. Is that on the board for a future release?

This isn't to say I prefer CM -- because Markdown came into being from Gruber's script. In a literal sense, "Markdown" is defined as whatever `markdown.pl` is, warts and all -- however, contact with the outside world forced things to move in a direction that is (so to speak) more organized that what John originally wrote.


The export part of the feature does support everything that CommonMark does! Curious what gave you the impression that it doesn't?


Admittedly, I didn't spend more than 5-10 minutes looking through the specs ¯\_(ツ)_/¯

The existence of comments about how certain elements were rendered on export made me think that something was missing when compared with CM.


Hi, thanks for this amazing work.

Just curious: Google docs supports a lot more than what Markdown has syntaxes for - how do you deal with this when exporting to markdown?


We export to the closest available thing (e.g. file chips become links, people chips become mailto links, etc.) or drop the content entirely if there's truly nothing it can be converted to (rare case)


I just wanted to say, it took me a while to discover it (it happened by accident), but the preexisting feature from 2022 was a joy to discover! I didn't know you obviously, but I praised the kind anonymous soul out there who did that. I discovered it about 6 months ago, and I use it all the time now. I'm super excited to see it progress!


Duuuuuuuuude, I was just thinking a few days ago: how come markdown isn't yet a thing in word editors?

Well, you solved it. Thanks!


Just for reference, Writage is a Word (Mac and Windows) add-in that exports and imports Markdown.


Any idea how long is this rollout going to be? I still don't have access to it. (not that you're in charge of the rollout pace)


Should be rolled out to everyone by sometime next week

See this heading: https://workspaceupdates.googleblog.com/2024/07/import-and-e...


The announcement of the new feature (which I don't have just yet) made me realize that the automatic detection feature existed, and I love it. :)


I can't wait.

This will make a huge difference to a lot of my work.


Thank you! This is going to make my life MUCH easier


Thanks for doing this! It’s amazing feature to use docs to compose and paste to my Hugo blog. Very good workflow


Thank you for making that! I was using a plugin to export to markdown but it wasn't ideal.


Super cool. Well done! I've been wanting this for awhile; glad to see it.


Would appreciate support for comments, with CriticMarkup or something.


This is going to save me so much time, thank you for this!


Thank you from Leanpub!


Google keep…


No support for code blocks still:

    ```java
    String x = "xxx";
    ```
No quoting:

    The docs for `libfloof` state:

    > The floof is 4 bytes long, at most.
And when I type `code` with backticks at the start of a line, the word 'code' is formatted as code as expected, but auto-correct automatically capitalises it to 'Code' — which should never be done with code fragments.

So this is basically just headings, italics, bold, and links?

It's really annoying when you need to share technical documentation with lots of code and code-like content with people and they've started doing the spec in Google Drive. Just give me working Markdown.


To add a code block, type @ and scroll down to "Code Block <>". It's still very limited, with syntax highlighting limited to C/C++, Java, JavaSript, Python.


Is that available only in certain paid versions of Google Workspace, or has it not rolled out to everyone?

When I type @ there's no code block option. I get People, Smart Chips, and then in "Building Blocks" I get five items from "Meeting Notes" to "Project Assets". If I click the arrow to expand to the full list of building blocks, it only adds a sixth item "Launch Content Tracker" and the rest is blank space.


It's only available in certain paid versions (https://workspaceupdates.googleblog.com/2022/12/format-displ...)

Which is too bad, it's the one thing keeping me from writing design docs in google docs.


Ah thank you. Too bad.

Funny that they paywalled that feature, while tools like Colab are free.

Generally, Google has made code-related and academia-related tools freely available. Oh well.


Code blocks are a paid feature, but the Markdown import/export feature is not paid. It's just still rolling out


The author of the feature is another top-level comment and said it's still being rolled out over time, so that's probably why.


We just have to iterate in the "markdown support feedback/help" pulldown I guess. because without ```code``` it's not useful.

Looking at you HN... (ok at least we have 2 indents codeblock)


What would ``` add that you can't already do with two indents?

Beyond that, I think support for ```sh type highlighting would be awful, one of the best things about HN is how clean it is, I'd hate to see syntax highlighting or pictures or whatever when scrolling.


> What would ``` add that you can't already do with two indents?

It would let me add those fences before and after the code I’m pasting instead of having to go and add spaces in front of every pasted line. On mobile adding the spaces after pasting is a bit fiddly. Then again, maybe it is a feature because it discourages pasting too many lines of code in many cases.


It would let you paste a lot of existing markdown into google docs


They meant here on HackerNews. The only thing I really miss sometimes is a way to quote without resorting to indented code blocks.

> Just a tiny hint that any paragraph like this starting with a greater-than sign is a quote.


This is supported, but it's probably not rolled out to you yet. And once it is rolled out, you need to turn it on yourself. See the blog the developer linked to in a comment.


Worked for me by typing ```<enter>

It opens a block and you can select Java. (There's only a relatively small number of syntaxes supported, but still.)


Also when I close a single line code with `, the formatting stays as if I'm writing more code. It should reset to whatever formatting was before the opening `


For Google Docs like real time collab on native markdown, I like and use daily:

* https://hackmd.io

and

* https://stash.new


I used Hackmd in the past to share the draft of my book (1) and liked that people don't need to have an account to comment. Google Docs was no option as no markdown support and account required. The process worked well but I found Hackmd too expensive for just getting feedback. Stash looks promising for this use case.

(1) Written fully in Markdown in Obsidian at this point. I moved to Asciidoc since because of formatting. The early draft is still available on Hackmd though. Details in my bio.


We've used HackMD in my OSS project since Google Docs was failing us as far as version control goes. What's great is that you can sync a HackMD document to GitHub or similar, so you can collaborate on a document and then push it to a repo.


W Google docs Writer Competitors


My guess is that this is strongly motivated by the success of LLMs.

The lack of MD support makes manual IO from Docs to your favorite LLM lossy (or very annoying). Cool that it's fixed.


They also already have to support Gemini to Google Docs and vice versa so it makes sense they'd have to support Markdown in some fashion on the backend.


At this point, most major changes could be motivated by LLMs/AI.


i hope they'll eventually support Mermaid (https://github.com/mermaid-js/mermaid) for creating diagrams directly within documents. i've been using it a lot for my markdown files and it works amazingly well with LLMs (e.g. asking LLM to generate the diagram representation of something using Mermaidjs)


+1 mermaid please !!!!


In the past I used the Docs to Markdown add-on that has worked well [1]

Google Docs -> Markdown -> Hugo website was a great workflow: https://github.com/whyboris/utilitarianism.net

[1] https://workspace.google.com/u/0/marketplace/app/docs_to_mar...


If this is implemented properly it’ll be a game changer for collaboration on papers. Means one can write a paper with colleagues in markdown and then easily knit with pandoc/quarto. Cheaper than overleaf etc.


You can already get most of the way there, as Pandoc supports reading the ODT or DOCX export from Google Docs reasonably well.

I have this in my shell history:

  pandoc --from=docx --to=asciidoc --wrap=none --atx-headers --extract-media=img doc.docx > doc.adoc


Stick downdoc on the end of that pipeline and you're done -- unless you prefer working in AsciiDoc, I guess. Not my thing, but you do you...

https://github.com/opendevise/downdoc


Asciidoctor has been much better received by my colleagues, primarily for the built-in support of a few technical writing features — admonitions, non-trivial tables, crossreferences, etc.


Multimarkdown has similar features so far as I know, but it has the same problem as Markdown.pl: written by one person, with a bunch of spot fixes and so isn't really reproducible or extendible by anyone else without running into bugs.


I'll add that writing a paper might be better handled by a more feature-full format like Asciidoc.


I recently used Typst and their own collab solution for a paper we worked on. While some features are still lacking it was a pretty good experience overall.


Why not a markdown doc + git with each colleague using their own text editor/IDE of choice?


Because in my experience, the value of collaboration tools isn't versioning -- going back to an older version rarely happens.

It's the suggested edits combined with comments sidebar right there in the document, where you can have whole back-and-forth asynchronous discussions.

There's no obvious/easy way to have comment threads in markdown or in git.

And while you could, in theory, implement suggested edits as commits on a separate branch waiting to be merged in, the workflow for that would be pretty horrible -- are you going to create a separate branch and commit for every single edit? Since small edits are generally individually accepted, rejected, or further modified.


Because not everyone is interested in setting up a Pandoc/Latex toolchain. Overleaf almost solved this problem but they don't support Pandoc as a frontend and want money unless you self-host.


You don't need pandoc and even less a latex(WTF does it have to do with md???) toolchain to work with markdown documents.


Sorry, I was talking about scientific writing, where you have to be able to produce PDF artefacts.

Writing in markdown and converting to .tex is actually a quite popular way of doing that these days.


This would have been very useful at several companies I worked at as a product manager for release blogs.

I always start editing in gdocs because it's so much easier to collaborate on than any blog platform, but then you always need to copy/paste the content once final into the blog and nearly every time, it copies some elements of formatting into the rich HTML editor I don't want (fonts, font sizes, etc) while I do want some things (headings, bold, italics). It's usually easy to import markdown to blogs or trivial to convert it to stripped-down HTML that can be imported. One of the teams I worked on built a simple gdoc script to do this


Indeed, very useful to unite markdown with the omnipresence of gdocs.

One tip for pasting without formating, at least in Windows, is CTRL+SHIFT+V.


Does this just import Markdowns and convert them to Gdoc and then you export it finally. Or can you collaborate on Markdowns in real time?

Could you build a confluence/wiki like system on top of this?


Whoa, this is a huge, huge deal for me. This is going to make Google Docs incredibly more useful, and will provide some functionality that I've currently been working around using vim block editing and macros (hey now, vim mode is a great next project for google docs :-D). Ability to import/export as markdown will also be a game changer for less technical people who want to contribute to technical documentation. I strongly prefer technical docs to be in markdown and under version control, and that makes it hard for people. This doesn't solve the git learning curve of course, but that part is pretty manageable.

Thank you to the people who made this happen! May you continue your great work for a long time to come!


OT: Has anyone noticed performance improvements since Google migrated Docs away from using DOM, and over to using Canvas?

https://news.ycombinator.com/item?id=27129858


I don't really use Google products, so I find this particularly useful for collaborating with people who do. I can do my shit in Markdown, they can do their shit in Google, and we can easily transfer the content back and forth.


So close. I have always hoped for an edit in markdown (or limited formatting) mode.


This is a cool feature, even if parts of markdown still need to be implemented (for pedants: commonmark).

Meanwhile, Trello is once again threatening to force everyone onto the new rich-text editor and disable the old markdown one.


This is really useful! Hope they continue to add features. I don’t like directly writing markdown and would rather use a text editor like Docs or Word.


You are not alone :) For Microsoft Word you might find Writage plugin useful (https://www.writage.com) - supports all basic Markdown syntax, tables etc. and recently added support for math formulas.


I like to have AI auto-complete assistance from something like GitHub copilot, so I often compose markdown within PyCharm and then paste to Google docs. There seem to be zillions of “AI-writing” tools out there but I’m shocked that nothing has replaced the smooth functionality of GitHub copilot. Google docs with Gemini is not smooth at all. Tried obsidian plugins but they are janky.


Is there an API to export a Google doc as markdown?


Yes, and to import. You mess with the mime types when creating a document or exporting and the conversion operation happens. Standard gdocs APIs cover conversion of formats already with doc files as an example.


I guess most users of Google Docs have no use for this, especially the download as markdown. I wonder why they decided to add this feature for the tech crowd so late in the lifecycle of the product, feels almost like an Summer '24 intern project?


Agreed; given the timing, an intern project seems plausible. (It feels a bit more ambitious than a typical intern project though, and I'm not sure how many of those end up quite so user-facing.)

I can imagine one internal use case.

At Google, we use Google Docs heavily for design docs. After the system has been built, it's not uncommon to link to the design doc as supplementary reading material. But the design doc isn't intended to co-evolve with the system; at some point, we migrate the design details to our internal documentation pages (g3doc [0]), which serves version-controlled markdown files and often has a much lower barrier to entry.

Even though Google Docs is ostensibly collaborative, design docs are often used as a snapshot of an individual's engineering maturity as justification during performance evaluation and promotion, and so it's not typical for them to be updated substantially, years after the initial implementation is complete.

[0] We write about it briefly in a case study about "The Google Wiki" at https://abseil.io/resources/swe-book/html/ch10.html


100%. I do this all the time, this will be very useful internally.


I can confirm it wasn't an intern project (I implemented it and am not an intern haha)


Speaking as someone with experience in enterprise software, I'd say there's a good chance it's because one or more large corporations were ready to migrate from MS Office to Google Workspace but that not having Markdown import/export would be a deal-breaker.

A lot of times when you wonder, "why did they add that feature?", that's why. A single large potential customer absolutely needed it because of whatever critical internal business processes they happen to have.

It's a major difference from software sold to consumers, where the aggregate consumer demand for a feature is generally more obvious/intuitive/explainable.


Great point actually that's really true in many orgs


Collaborative editing of Markdown docs in GitHub / GitLab can be a pain. This is a huge game changer for technical writers. Admittedly not the biggest crowd, but hey...


I would imagine that requests for this feature went way up as ChatGPT has popularized.


Interesting announcement. Feels like some of it is just copy-pasted from a PRD. Not necessarily a bad thing (it's clearer than press release style), just the first time I've noticed it in a "bigtech" announcement.


LibreOffice has an open issue requesting Markdown export support:

https://bugs.documentfoundation.org/show_bug.cgi?id=160734


This is a great feature (and probably related to reliance on markdown from all the LLM services). I do wish they'd add SVG import to slides though, that's been a top feature request for like a decade.


Moved to self hosted bookstack recently due to this feature missing


Great job!

I hope the "new tab experience" is rolled out to non-workspace users too. The tab + markdown export combination would make Google Docs a great blog editor!


This is great, the other day I had to export to HTML from Google Docs and then import the HTML into some kind of Markdown generator. The result was mediocre, but usable.


Finally they realized too many people were copying information from chatgpt and claude and didn't like seeing #####


I don't see any mention of table support. That will be the first thing I try, I hope it works... if not now, eventually.


They are supported (source: beta tested it internally). We use this markdown feature for some internal workflows where github flavor markdown syntax is used. We've tested this works and ourselves rely on it as well as some other markdown extensions.


I thought copy as MD existed years ago and then went to look for it recently and it was gone. Now it's back. Am I losing it?


Maybe you've been using the GD2md-html plugin. I've certainly found it useful over the years, and will likely still use it for some of my workflows. https://workspace.google.com/marketplace/app/docs_to_markdow...


I don't think so... It was part of the download menu for me


There was partial markdown support (and still is) in gDocs today. AFAIK copy as MD was never supported. But this new feature is full round tripping into and out of gDocs as native markdown.


Good ! I use notion and sometimes when i copy a text from notion to docs, i have to format it again. Now i would not do it.


markdown is such an elegant markup implementation, i remember using bbcode on online forums which was ok but markdown i use all the time to keep notes and organise my thoughts. when i do consulting i summarise my work in a github gist.

look forward to trying this.


Is this CommonMark, or a different flavour of Markdown?


So, can we now write a plugin for Obsidian that syncs changes to Google Drive?


when did google become sooo sloooow implementing trivial features, and then not even shipping a complete set of markdown?!


> trivial features

Four features were announced:

1. Convert Markdown to Docs content on paste

2. Copy Docs content as Markdown

3. Export a Doc as Markdown (from File > Download)

4. Import Markdown as a Doc (from File > Open or "Open with Google Docs" from Drive)

Which of these do you see as trivial? These all seem quite complex to me with many edge cases , incompatibilities and ambiguities, especially if there's an expectation that you can round trip losslessly.


All of them. It should have been implemented years ago. Using GDocs after using notion for a few weeks feels like going back in time.


Notion is one of the best things that happened to Google Docs. It creates competition and Google Docs has get better since.

Even though Notion is now better on many fronts as you said, people who have to stick to Google Docs benefit from Notion's existence in that way.




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: