Besides all the documentation below, we also have a shiny new help center which contains all our FAQs! So, if you have a specific question, look there first. If you can't find the answer there, you can ask us right from the help center by clicking on the smiling speech bubble or by emailing email@example.com.
This is a short 6-step tutorial to help you get started. It should take between 5 and 15 minutes to complete.
By the end of it, you'll understand how to edit your book in Leanpub and how to generate previews of your book.
If at any point during the tutorial it stops making any sense, then we recommend watching one of our helpful videos at the bottom of this page, emailing us at firstname.lastname@example.org or joining the very helpful Leanpub Google Group.
Step 1: Set-up your Bitbucket Repo
Create a repository on Bitbucket.
The repository can be public or private.
If your repository is private, then add "leanpub" (https://bitbucket.org/leanpub) as a user to your repository so that we can read from it. To do this, when you're viewing your repo on Bitbcuket, click on "Settings" on the left menu and then "Access management", and then type our username leanpub into the box labelled "Users" and then click the "Add" button.
Giving us read-only permission is fine unless you are planning to import from a blog or from HTML, in which case we'll need write access.
The root of your Bitbucket repository should contain a directory called
which will contain all of your book content. In the manuscript directory, you should create a file called Book.txt (we explain what this is used for below). We'll add some content in the next section.
Step 2: Start Writing
To create a new book, we'll create a first chapter now.
manuscript folder is where you write your book. Let's add some content to it. First, make a file called
chapter1.txt. Leanpub books are written in Markdown, so you can use your favourite text editor.
Make the contents of
chapter1.txt be the following:
# Chapter 1 Hello, world!
Save the file.
Next, we're going to tell Leanpub we want this file in the book. To do this, we add the filename of the new file to the
Book.txt file. The
Book.txt file is just a list of the files in your book, in the order you want them included.
Create a new file called
Book.txt, and add a line containing
chapter1.txt to it. It should look like this when you're done:
Finally, commit and push your changes to Bitbucket. We're not going to explain git or Bitbucket in this tutorial.
Step 3: Make a Preview
This is where the magic happens. Click on the Preview tab on the left to create a preview of your book.
When you do this, we create three versions of your book for you:
- PDF (for your computer)
- EPUB (for iPad and other ebook readers and phones)
- MOBI (for Kindle)
It takes a few minutes to generate the preview. Once the preview is done the files can be downloaded from the preview page for your book.
Open your book's Preview page by clicking on the 'preview' tab at the top of the page. To create a new preview of your book, click the button that says "Create Preview".
Don't worry, nobody but you will be able to see your book unless you publish it.
Step 4: Add Another Chapter
Let's add a second chapter. Start by creating a new file called
Let's put some content in it:
# Chapter 2 It was a **bold** and *italic* night! Suddenly, a shot rang out!
Save your new file.
Now add this file to
will just look like this:
chapter1.txtTo add your new chapter, just add
chapter2.txtto the file, like this:
file. Then, go back to the Preview tab and make another Preview of your book.
Step 5: Make a post-commit hook (optional)
You can use the Leanpub API and a Bitbucket post-commit hook to start a preview every time you push to Bitbucket. Here's how you do it:
First, you'll need your Leanpub API key.
Now, set-up your Leanpub webhook.
- Go to your repository's webhooks page on Bitbucket (Click on "Settings" and then "Webhooks").
- Click on the "Add Webhook" button.
- Enter "Leanpub" for the name
- The URL will be "https://leanpub.com/YOUR_BOOK/preview.json?api_key=YOUR_API_KEY" (make sure to edit the api key)
- Keep the trigger as "Repository Push"
- Click on "Save"
Leanpub will now generate a preview every time you push to Bitbucket.
Step 6: Learn a Bit About Markdown
You may have wondered what the
things were in step 4. This is an example of Markdown, which is the way you write your book in Leanpub. This step will teach you enough about Markdown for you to get started.
Paragraphs: You put blank lines between paragraphs.
You make bold text
**by surrounding words with two asterisks like this**.
You make italic text
*by surrounding words with one asterisk like this*.
To start a new chapter, use
followed by the chapter title on a line by itself, like this:
# Chapter Title It was the best of chapters, it was the worst of chapters.
To start a new chapter section, use
followed by the section title on a line by itself, like this:
## Section Title I'm a lowly section.
That's basically all you need to know to start writing in Markdown! If you want to learn more about Markdown, the Leanpub Manual has more than you'll ever need to know.
That's it for this quick tutorial!
If you're stuck, either...
We also have some helpful videos, which show you how to use Leanpub. These cover the 3 common ways Leanpub is used to write a new book: starting from scratch with a brand new book, starting by importing a blog, and starting by converting and importing a Word document. They also include a video showing you how to make a bundle of Leanpub books to sell together.
How to Use Leanpub
This video shows you how to sign up for Leanpub and create, preview and publish your first Leanpub book. We start from scratch, using Markdown to write a brand new book in Leanpub. You can also find these instructions written out on our website here and in book format (for free!) here.
This video shows you how to make a brand new Leanpub book, starting by importing your blog's RSS feed into Leanpub and editing the resulting Markdown files. You can also find these instructions written out on our website here and in book format (for free!) here.
This video shows you how to make a brand new Leanpub book, starting by converting one of your Microsoft Word documents into Markdown. You can also find these instructions written out on our website here and in book format (for free!) here.
This video shows you how to make a bundle of Leanpub books, using either your books entirely or proposing a bundle of your books and another author's related books. You can also find these instructions written out on our website here and in book format (for free!) here.
How to use Markdown to Write a Leanpub Book
All Leanpub books are written using Markdown. This video series explains how to use Markdown to write a Leanpub book, with the focus being on the Markdown syntax not the Leanpub process.