Book Publishing from Google Docs
My wife has been writing children’s church curriclum for a number of years which we have been selling as downloadable products on our curriculum store. Recently we tried something different and published her first book on Amazon Kindle Direct Publishing (KDP). It involved some interesting technical challenges which is what I hope to delve into in this series of posts.
Book Editing Software
Historically we used Microsoft Word to generate PDF books, but my wife prefers the simplicity of writing in Google Docs. As a web developer, I have always wanted to better separate content from layout, so I started researching ways to transform Google Docs content to a format that I can render in html however I want.
Technical Challenges
- Learning how to publish books on KDP
- Transforming Google Docs documents to data that can be rendered in a web app
- Paginating web based documents for print
- Converting web based documents to PDFs suitable for publishing
- Publishing to KDP
I’m hoping to get into these topics in more details in subsequent posts.
Publishing Toolchain
As mentioned already, we chose Google Docs to write the book content.
The rest of my publishing toolchain was built on top of a handful of npm
packages.
- googleapis - access Google Docs from nodejs app
- @googleworkspace/google-docs-hast - transforms Google Doc to an
ast
- unified - content transformation using plugins
- rehype-document, rehype-format, rehype-stringify - unified plugins for transforming data to html
- puppeteer - print to PDF using headless browser. This allows better control of page sizes
Conclusion
That’s probably enough of a high level overview of this project. Look for more details in future posts.
If you happen to be looking for a good Bible study workbook for your teenager, you can purchase my wife’s book Identified: Ephesians Bible Study for Youth on Amazon.