Publishing from Quip to Hexo

Which hopefully will lead to more blog posts

Posted by on April 15th, 2018

Over the last few years I’ve been fond of using Quip, a document editor which was recently purchased by Salesforce, for taking notes and managing simple documents. They’ve made a lot of improvements to it over the years, and it has become quite robust.

I’ve also been using Hexo for managing my current blog. I switched away from WordPress awhile ago because I was updating it more often than actually publishing posts. I wanted something that could be a low security risk with little maintenance.

The problem is, I missed having a writing interface I could jump in and quickly post from. I missed being able to just jot down a few thoughts or ideas in an interface intended for writing and pressing a publishing button. Instead, I just ended up not posting often (or at all, if you look at my posting history for the last few years). I contemplated switching to a different blogging system, but I liked Hexo from a hosting perspective, just not a writing one.

Then I thought “Hey, I like writing in Quip, maybe I could just automate pulling a post from Quip into Hexo and deploying.” So this weekend I spent a few hours diving in and trying it out. It took longer than expected, but here is a gist of the working code. I will have used it to publish this very article. The steps it uses are:

  • Get a list of documents from a folder I have in Quip called “Blog”. You can get the folder ID in the web base version up in the URL.
  • Ask which document I would like to post.
  • Download the HTML version of the document.
  • Convert the HTML to Markdown (this part took a lot longer than I expected to get right)
  • Scan for any attached “blobs” (i.e. images) and download them to the correct directory.
  • Update the Markdown to use the correct links.
  • Save the updated Markdown file to my Hexo file.

Then all that is left is for me to double check and fix the formatting (it’s not perfect yet) and then do a “hexo deploy”.

I’m hoping that after using this for awhile I’ll be able to cleanup the code and publish a utility that can be used for any statically generated blog. So far I’m really happy with the setup, especially with images since that was the most annoying part of putting together a blog post for me in the past. Now I can just take screenshots, paste them directly to Quip, and they’ll get imported ready to go into Hexo.

I’m hoping with this new workflow I’ll be able to do more blog posts. I miss blogging. I started 10 years ago in 2008 and grew a decent amount of traffic until 2012 when I started working for Deseret Digital Media. The evidence is pretty clean in my traffic:

So here is to more frequent blog posts! We’ll see if this experiment helps achieve that goal.

– Carmony

About

Justin is a Sr. Director of Engineering at Deseret Digital Media, Previous President of the Utah PHP Usergroup, and frequently works with the Utah Open Source Foundation which organizes the OpenWest Conference. Justin loves just about anything with web technologies from PHP, JavaScript, Node.js, Salt, and managing engineering teams.

Learn More