Google docs is great, but also somewhat annoying in that you can't use your favourite text editor to make changes. Well, not any more.
Google offers GoogleCL to interact with their services on the command line. You could for example use
google docs edit --title "Title of your document" --editor vim
to modify a pure text version of your document with vim. This will lose all your formatting however. You can also modify html with
google docs edit --title "Title of your document" --editor vim --format htm
but this is just horrible to manipulate.
Instead, we can use pandoc to convert from and to just about any format we like.
Now to the gist of it:
sudo apt-get install googlecl pandoc
Then create somewhere in your path
vim-html-markdown with this content:
#!/bin/sh file=$1 markdown=`tempfile --suffix=.mdown` # Convert to markdown with pandocs pandoc "$file" -f html -t markdown -o $markdown # Edit the markdown file vim $markdown # And convert it back to html, which can be uploaded to Google Docs pandoc $markdown -f markdown -t html -o "$file"
google docs edit --title "Title of your document" --editor vim-html-markdown --format htm
The file will automatically be uploaded and have the correct formatting.
If you like emacs better, just replace
emacs, if you prefer
reStructuredText, just replace