Skip to content

How to create ebooks with Markdown

My process for creating ebooks

I currently have 16 free books which I share, free of charge, to anyone that subscribes to my email newsletter.

Some of those books are at their 2nd edition (the ones on JavaScript and React) as tech moves fast and we must keep up.

The first one is from 2018.

In the near future I want to reorganize my free ebooks collection by revisiting a few of them, and maybe even adding new ones.

I had to set up again my book creation workflow on my Mac since I last updated to the wonderful 2021 MacBook Pro 14", so I took the opportunity to write about it.

I use a tool called honkit.

It's a fork of another tool that was called gitbook, which I've been using before but has been deprecated and abandonware for a long time now, and does not work any more.

honkit works great. It is a free utility for creating a book using Markdown, and generate a PDF/ePub/Mobi version of it.

I can update a book and with a single command I can upload it to my website and let CloudFlare distribute it.

As far as I know, this is the simplest tool ever available capable of generating all those book versions.

Some other tools exist but don't have all those capabilities.

Here's how to get started.

Create a folder, and inside it add a book.json file

  "author": "Your name",
  "title": "The book title"

Create a cover.jpg vertical image that's used for the cover. Add a cover_small.jpg if you want to make an ePub / Mobi version too.

Create a file with the ToC:

# Summary

- [Preface](
- [First chapter](content/
- [Second chapter](content/

Now add a file, that's the markdown file for the preface.

Add a content/, that's the markdown file for the first chapter.

And so on.

Now download Calibre and install it (or use Homebrew (brew install --cask calibre on macOS).

Then run:

npx honkit pdf  ./ ./book.pdf
npx honkit epub ./ ./book.epub
npx honkit mobi ./ ./

that's it, the book in PDF, ePub and Mobi (Kindle) will show up in the folder!



You might be interested in those things I do:

  • Learn to code in THE VALLEY OF CODE, your your web development manual
  • Find a ton of Web Development projects to learn modern tech stacks in practice in THE VALLEY OF CODE PRO
  • I wrote 16 books for beginner software developers, DOWNLOAD THEM NOW
  • Every year I organize a hands-on cohort course coding BOOTCAMP to teach you how to build a complex, modern Web Application in practice (next edition February-March-April-May 2024)
  • Learn how to start a solopreneur business on the Internet with SOLO LAB (next edition in 2024)
  • Find me on X

Related posts that talk about tutorial: