# How to create ebooks with Markdown

> My process for creating ebooks from Markdown using honkit: set up book.json and SUMMARY.md, then generate PDF, ePub, and Mobi versions with help from Calibre.

Author: [Flavio Copes](https://flaviocopes.com/about/) | Published: 2022-05-31 | Topics: [Tutorials](https://flaviocopes.com/tags/tutorial/) | Canonical: https://flaviocopes.com/how-to-create-ebooks-markdown/

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](https://flaviocopes.com/javascript/) and [React](https://flaviocopes.com/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.

If you're planning a book yourself, I built a free [word count goals planner](https://flaviocopes.com/tools/word-count-goals/) that helps you estimate the length and set a writing schedule.

I had to set up again my book creation workflow on my Mac since I last updated to the wonderful [2021 MacBook Pro 14"](https://flaviocopes.com/macbook-pro-2021-review/), so I took the opportunity to write about it.

I use a tool called [`honkit`](https://github.com/honkit/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](https://flaviocopes.com/moved-blog-cloudflare-pages/) 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

```json
{
  "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 `SUMMARY.md` file with the ToC:

```
# Summary

- [Preface](README.md)
- [First chapter](content/1-first.md)
- [Second chapter](content/2-second.md)
```

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

Add a `content/1-first.md`, that's the markdown file for the first chapter.

And so on.

Now download [Calibre](https://calibre-ebook.com/download) and install it (or use [Homebrew](https://flaviocopes.com/homebrew/) (`brew install --cask calibre` on macOS).

Then run:

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

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

While writing the chapters, my free [markdown preview](https://flaviocopes.com/tools/markdown-preview/) is handy to quickly check how the markdown renders.
