Why people want a book as Markdown
Markdown keeps the structure of a text without locking it into an application. A book in Markdown can be annotated in a notes app, quoted in a document, searched with a code editor, kept under version control, or turned into a website. For study or research notes, that portability is the point.
Steps
- Open EPUB to Markdown and choose the book.
- Tick Include images if you want them. With it on, you get a ZIP with the
.mdfile and animagesfolder whose links work. With it off, you get a single.mdwhere images are replaced by their alt text. - Press Convert to Markdown and read the preview.
- Download the file.
How elements are mapped
| In the book | In Markdown |
|---|---|
h1 … h6 | # … ###### |
em, i | *italic* |
strong, b | **bold** |
| Ordered and unordered lists, nested | 1. and - items, indented by two spaces per level |
blockquote | Lines beginning with > |
pre, inline code | Fenced block, backticks |
| Links to the web | [text](address) |
| Links inside the book | Plain text (the targets do not exist in a single file) |
| Images |  in the ZIP; [Image: alt] otherwise |
| Tables | Rows with cells separated by |, no alignment row |
Clean-up that is worth doing
- Look at the first chapter. Many books begin with a copyright page and a contents list that you may not want.
- Replace the contents list. The in-book table of contents becomes a list of plain entries. A Markdown editor can generate a real one from the headings.
- Check scene breaks. Books often use a styled empty paragraph or an image as a scene break. These can disappear in conversion; search for your own marker if you need it.
- Tables: if a table matters, rebuild it as a Markdown table by hand.
Right-to-left and mixed-language books
Characters are stored exactly as in the book, in UTF-8. Direction is applied by the program that displays the file. Editors that support bidirectional text show Arabic or Hebrew paragraphs correctly; some code editors need a setting or an extension.
Markdown or plain text?
Choose TXT when the destination does not understand Markdown, for example a text-to-speech tool or a word counter. Choose Markdown when you want headings and emphasis to survive, or when you plan to publish the result.
Post-processing recipes
Add front matter for a static-site generator. Most generators read a small block at the top of the file. Add one by hand after conversion:
---
title: "The Test Book"
author: "Ada Tester"
source: epub
---
Split by chapter. Chapters in the converted file begin with a level-one heading. With a text editor that supports regular expressions, search for lines beginning with # and split there. On the command line, csplit -z book.md '/^# /' '{*}' writes one file per chapter.
Check external links. Links that point to web addresses are kept. Extract them with grep -o "](http[^)]*)" book.md and run them through a link checker if the book is a technical reference that cites online sources.
Make a table of contents. Many Markdown editors and generators build one from headings. Remove the converted “Contents” list from the front of the book so the generated one is not duplicated.
What a long book looks like in Markdown
Expect one file with thousands of lines. Editors that load the whole file may be slow above a few megabytes; splitting by chapter makes it manageable. Version control works well because the text is line-based, though long paragraphs on a single line produce large diffs. If you plan to track changes, wrap lines at a fixed width with your editor before the first commit.
Common surprises
- Odd characters at the start of lines. A leading number or dash in text can be read as a list marker by a Markdown renderer. Escape it with a backslash if it displays as a list.
- Asterisks inside text. A literal
*in the book is not escaped automatically. If emphasis appears in the wrong place, search for stray asterisks. - Images numbered strangely. In the ZIP output, images are named in the order they are met in the book, prefixed with a counter, so the names are stable but not the author’s originals.