Help › Multiple files to one eBook

Multiple files to one eBook

Many authors write one file per chapter. MarkdownBooks turns one .md file into a book, so a book in several files has to be joined first, in the right order.

Upload several .md files, or one .zip. Choose all your files at once on the home page, or zip the folder (with your images) and upload the zip. Every file is checked on its own, and each problem names the file and line. If you prefer to join the files yourself first, the free manuscript merger does that in your browser.

Name your files so the order is obvious

Start each file name with a number, then a dash, then a short name:

01-introduction.md
02-getting-started.md
03-the-basics.md
10-appendix.md

Rules:

  • The number comes first, followed by -, _, or .: for example 01-intro.md, 1.introduction.md, or 01. Introduction.md.
  • Files are put in order by the number, so 2-setup.md comes before 10-appendix.md. Zero-padding (01, 02) is recommended because file managers then sort them the same way, but it is not required.
  • Every number must be unique. Two files starting with 01- leave the order unclear.
  • When there is more than one file, every file must have a number (E011), and no two files may share one (E012). A file called notes.md among numbered ones has no place in the order, so rename it or take it out.
  • All the .md files go in one folder (E013). Images can be anywhere.
  • Use lower-case letters, digits and dashes in names. Avoid spaces.

What goes in each file

  • Start each chapter file with a single # heading. Each # heading becomes a chapter and starts on a new page in the PDF.
  • Keep the front matter (title, author, date) in one place only. See Manuscript standards. The merger removes the front matter block from every file, including the first, so you add one block at the top after merging (step 4 below).
  • Each file must follow the same manuscript standards as a single file: close code blocks, keep heading levels in order, no raw HTML.
  • Links between chapters should point to a heading in the merged book, for example [see the setup](#getting-started), not to another file such as [see](02-getting-started.md). File links stop working once everything is one file. The Markdown link checker finds them.

Upload a zip with images

Put your Markdown files and an images/ folder in one folder and zip it. Image paths such as images/diagram.png are found inside the zip; a path that is not there is an error (E010). Capital letters must match exactly. Public https:// image links work too.

mybook.zip
├── 01-introduction.md
├── 02-getting-started.md
└── images/
    └── diagram.png

Merge the files yourself (optional)

  1. Open the manuscript merger. It runs in your browser, so your files are not uploaded.
  2. Choose all your .md files. They are listed in natural order, so 01-, 02-, 10- come out right. Drag them, or use the arrow buttons, to change the order.
  3. If a file starts its chapters at ## but you want them as #, or the other way round, set that file's heading shift.
  4. Copy or download the merged file. Add the front matter block at the very top. The front matter generator writes it for you.
  5. Check the result with the manuscript checker. Fix anything it reports, with line numbers.
  6. Upload the merged file.

Images

In a zip, relative paths such as images/a.png are found in the zip. Public https:// links are downloaded. If you upload .md files without a zip, relative paths cannot be found, so they are replaced by their alt text (W101).

Checklist

  • [ ] Files are named 01-name.md, 02-name.md, and so on, with unique numbers
  • [ ] One front matter block, added at the top after merging
  • [ ] Each chapter starts with one # heading
  • [ ] Links between chapters point to headings, not files
  • [ ] The merged file passes the manuscript checker

Something unclear? Tell us and we will improve this guide.