alt tex
Web

Enhanced Web Ebooks with Honkit

I love reading books. But I also like to read books on my tablet or my laptop. Using an application like Honkit, you can create great-looking ebooks from markdown files. These ebooks are easy to distribute and can be read using the browser. This article explains how to create ebooks with Honkit.

Project Gutenberg

Project Gutenberg is a great project that provides free ebooks. The ebooks are available in many formats, including epub, pdf and a HTML web version for reading in the browser.

But the layout of the HTML version for browser reading is not very good. The text is not justified and the font is too small. So, I decided to search for a better solution.

Honkit

Honkit is a tool that allows you to create ebooks from markdown files. Honkit is a fork of Gitbook that allows you to create ebooks. Honkit is written in Node.js and uses the markdown syntax for creating ebook websites. You could compare Honkit to a static site generator like Jekyll, but for ebooks.

Using Honkit for Ebooks

In order to use Honkit, you need to initialize a Node project and add the honkit dependency to your project. Then add a book.json file with the book metadata and in there define the folder name where your ebook markdown files are located.

This is how the book.json file looks like in my project:

{
    "root": "./docs",
    "title": "Around the World in Eighty Days"
}

I took the ebook Around the World in Eighty Days by Jules Verne from Project Gutenberg and converted it to markdown files.

These separate markdown files, each for one chapter, are then combined into a single ebook website by Honkit.

The markdown files are located in the docs folder in my case. It is important to also have a file called SUMMARY.md which is the table of contents that links to all the different sections of your book.

I also created a cover image with DALL-E2 and added the file to README.md which is the first file that is shown when you open the ebook website.

Once you start honkit with npm run serve and go to the local URL, you will see the web-based ebook in the browser, like in the following image:

Honkit ebook cover

This is how the ebook looks like for normal text reading in the browser with a different color theme:

Honkit ebook version

This web version of the ebook is much better for reading than the Project Gutenberg version. It has additional options for changing the colors and the font size. It also has a search function and a table of contents.

Furthermore, you can easily navigate between the different sections via the left and right keys on your keyboard. For mobile reading, the web interface is responsive and works well on mobile devices.

Since Honkit is open source, you can modify it or add plugins that enhance its functionality. You can deploy the generated ebook easily and with very little expenses on a static website hosting service like Netlify, Cloudflare or AWS S3.

You can check out the source code of my version of the ebook Around the World in Eighty Days on GitLab. The link is below in the References section.

Conclusion

With some knowledge of Node.js and markdown, you can easily create your own ebooks with Honkit. It is a great tool for creating web-based ebooks that are easy to read and navigate.

References

Jules Verne web ebook: https://jules-verne-80-days-world.netlify.app

Jules Verne web ebook source: https://gitlab.com/tderflinger/jules-verne-honkit

Project Gutenberg: https://www.gutenberg.org

Honkit: https://honkit.netlify.app

Cover image created by DALL-E2.

Published 10 Jan 2023
Thomas Derflinger

Written by Thomas Derflinger

I am a visionary entrepreneur and software developer. In this blog I mainly write about web programming and related topics like IoT.