Skip to content

On HTML Heading Styles: A BookMaker Story

Once or twice now I’ve mentioned the program I wrote to grab my Google Docs novels and cram them into Word templates so I could pretty them up for submission. That was a fairly humble little Python script that I ran on my laptop maybe five or ten times.

When Courtney asked me to help her do the same thing for one of her books, I couldn’t get BookMaker to run on her Mac. It was disappointing, and I had a handful of issues with it that I didn’t know how to fix, so I mostly abandoned the project after that.

A few months later, though, my programming mentor Toby started talking with me about the nearly-universal ePub e-Book format, and I recognized a solution. An ePub is a zipped file packed with specially-formatted HTML files — in other words, it’s a lot like the novel templates I’d made for Word.

So I asked Toby if he’d be interested in checking out my source code for BookMaker and seeing if it was something he could adapt into an ePub builder. He was…and it wasn’t. So instead of adapting my program, he rebuilt it from the ground up.

It’s not like I was cut out of the loop, though. While he was coming up with classes and functions, I was designing best practices and figuring out a workflow.

That’s always the biggest challenge of any automation project: finding a reliable way to consistently format the source material for processing. In this case the “source material” was all my novels, past, present, and future.

And if I were to tell you I needed a way to make sure all my documents of a particular type had standard, consistent formatting…well, by now you should certainly know how that’s done. In fact, when I talked to you about making document templates in Google Docs, one of the templates I shared was the one I developed for Toby’s BookMaker.

Along with the template I came up with some rules for how to use it. Every section needed an H3 heading (because prologues or forwards or teaser text all need something to put in the Table of Contents next to chapters). Novel titles needed to be H1, volumes or parts or “books” within a novel needed to be titled H2, and every chapter needed to have an H3. As long as it was formatted that way, Toby’s program could read Google Docs and spit out a beautiful ePub.

I was trying to design a system flexible enough that it could handle the vagaries of creative writing, so I decided to test it with some books that hadn’t been written in my style, and see how hard it was to adapt (whether that meant cleaning up the source or tweaking the converter). I grabbed a longish novel Becca had shared with me — too big to fit in a single Google Doc — and a chapterless novella Bryce wrote last November. Between those two and my own samples, I had some great test cases.

I also had a digital publishing company. It took me a week or two to realize it, but between my editorial standards and Toby’s conversion utility, I now have a fantastic process to take a rough draft of a novel, perform editorial review and track authorial revision, and then publish the finished manuscript to the leading e-Book format in a stylish and sound design.

How to Make Custom Paragraph Styles in Google Docs

That’s…well, that’s a pretty big payoff for just figuring out how to use my heading styles. Good standards tend to be that way, though — high initial costs, and then huge rewards forever after.

Last week I started you on HTML styles in WordPress, where your theme does much of the heavy lifting for you. To get the same effect in Google Docs, though, you’ve got to learn a little bit about Cascading Style Sheets.

So come back tomorrow for a primer on CSS and customizing heading styles in Google Docs.

Comments are closed.