noamross / redoc

[NOTE: Project in suspended animation for now] Reversible Reproducible Documents
https://noamross.github.io/redoc
Other
514 stars 44 forks source link

Google Docs Support #33

Open noamross opened 5 years ago

noamross commented 5 years ago

Google Docs support would be great for this, but there are a lot of things that need to happen before that's possible. Here I outline these in case people are interested in helping take this on.

redoc relies on two major tools for working with Word documents. Pandoc does two-way conversion between markdown and docx, with support for custom scripting in the conversion. officer is an R package that supports direct manipulation of docx files. There are not yet equivalent tools for Google Docs, but they can be created.

Google recently released an API for Google Docs that includes a JSON representation of the documents themselves and mechanisms for manipulating them. First, someone needs to create custom or Haskell-native readers and writers for Pandoc to translate this JSON structure. This will allow for general markdown-gdoc conversion.

Next, we need some general tooling for the Google Docs API, along similar lines as the googledocs or googlesheets packages.

Next, we will need to figure out the right mechanism for storing the extra data (a copy of the original .Rmd and the YAML file containing code pieces) in or along the google document. Simply storing them elsewhere in the Google Drive is possible, but it would be best if there is a field in the JSON structure of the document where we can stash these to make the "re-gdoc" portable.

Finally, we need to come up with the scheme for annotating code sections to match them against chunks of stored code. For Word, we do this with custom hidden styles. With Google Docs, I think we can use Named Ranges.

bwiernik commented 4 years ago

The Zotero Google Docs plugin might be a good reference for storing data in a document. It also has a good demonstration of working around problems with that can arise when users try to download a Google Doc with embedded data to docx.