Book.txt, Sample.txt and Manuscript Files
Your book will consist of a bunch of text files. Typically they have the file extension .txt. You can write them using any program you like; just save the files as plain text.
To illustrate, we’re going to write an epic fantasy novel together. Let’s give it a suitably epic title: The Cliché Chronicles.
This is the content of the file called chapter1.txt:
# Chapter 1: A Stormy Beginning
Lord Char, black cloak flapping around him in the rising storm, rubbed his hands together in anticipation as he strode to the middle of the circle of stones. He had been years in preparation for this, his moment of triumph.
It was time to use the knowledge he had gained through years of patient planning. Now The Unnamed One would pay!
And this is the content of the file called chapter2.txt:
# Chapter 2: You Are Not My Father!
## A Horrible realization
Suddenly, he realized who his father had to have been. No wonder the dark riders had chased him half way across the continent!
## The Horror Grows
With growing horror, he pulled the dark pulsing amulet from his cloak. If The Unnamed One was truly his father, he shuddered, then the amulet must be The Jewel of Rak Crasha!
See those number # signs? They’re an example of what it’s like to write in the formatting style called Markdown. If you want to write a chapter heading, just put a # at the start of the line, instead of hunting for ‘styles’ like you would in Microsoft Word. And if you want a sub-heading, just type two number signs ‘##’. We chose Markdown as our formatting system (even typewriters have a formatting system!) because it was created to make sense and let you focus on writing words instead of overly complex formatting stuff.
Anyways, back to the book we’re writing!
When Leanpub converts this text into a book for you, the # headings will start new chapters and the ## headings will start new sections. So, there are two chapters here - “Chapter 1: A Stormy Beginning” and “Chapter 2: You Are Not My Father!”. Chapter 2 contains two sections: “A Horrible Realization” and “The Horror Grows”.
The Book.txt File
As mentioned above, the content of your book is all tied together by the Book.txt file. This is a list of all the files you want in your book, in the correct order.
The text you’d type in the Book.txt file for The Cliché Chronicles would look like this:
1 chapter1.txt
2 chapter2.txt
Yup, that’s it. It’s just a list of the names of the files in your manuscript folder that you want to appear in your book, in the order you want them to appear. Think of it as your Table of Contents.
Making a Sample Book for Readers to Browse for Free
(Please note that if you are using our in-browser editor with LFM, it’s currently not possible to make a sample book, sorry. It is possible with Markua books.)
If you want prospective customers to read a sample of your book for free, you can make a file called Sample.txt in your manuscript folder. This file works exactly like Book.txt. Just list all of the files that you want to be included in your book sample.
(Please note that a new Sample Book file will be created for you to review every time you make a new preview of your book. However, the Sample Book available to customers will only be updated when you publish a new version of your book.)
OK, let’s let potential readers of The Cliché Chronicles browse the first chapter for free. Once they read that, they’ll be hooked and will rush to buy the book so they can read the rest.
To do this, just type this in the Sample.txt file:
chapter1.txt
Next time you Preview or Publish your book, Leanpub will create a separate sample ebook containing just chapter one, because that’s the only chapter listed in Sample.txt.
Adding Images or Pictures to Your Book
It’s easy to add images or pictures to your book. To do this, you need to:
- Put the images or pictures in your
imagesfolder (it’s in yourmanuscriptfolder). - Tell Leanpub where you want the image to appear in your book. You do this by typing the image name directly into your text, with a little help from Markdown formatting.
So, to add images to your book, first put them in the images folder inside your book’s manuscript folder.
Then, you need to tell Leanpub where to put the images in your book.
Let’s say we want to put an image in our book that we’ve saved as ‘Sword.png’. Just put the ‘Sword.png’ file in your images folder, and then type this in your .txt file, in a line on its own, wherever you’d like the image to appear:

Now, the next time you create a Preview, the image will appear with the caption ‘An awesome sword’. If you don’t want a caption, just leave that part of the instruction empty, like this:

A Note About Character Encoding
Depending on the text editor you are using and its settings, sometimes you may see weird characters appear in your text, and some characters may fail to appear at all. If you are experiencing this issue, you can try forcing the character encoding to be UTF-8.
To edit character encoding, go to Author > Books > your book > Settings > Generation Settings.