Blocks Of Text

Paragraphs

Paragraphs are consecutive lines of text. You can separate paragraphs from each other by putting a blank line between them.

You can also separate paragraphs, or blocks of text, by adding two spaces at the end of the paragraph. This is useful when you are going to follow a paragraph with another kind of text block, like a numbered list, or any of the other kinds listed in this section.

1 Paragraphs are consecutive lines of text.
2 
3 You can separate paragraphs from each other by putting a blank line between them.
4 
5 You can also separate paragraphs, or blocks of text, by adding two spaces
6 at the end of the paragraph. This is useful when you are going to follow
7 a paragraph with another kind of text block, like a numbered list.

Centering Paragraphs Or Lines Of Text

You can center paragraphs or lines of text by putting C> (followed by a space) at the start of the line.

Just type this in your .txt file:

1 C> This is a centered sentence on its own.

…and you’ll see this in your Leanpub book:

This is a centered sentence on its own.

You can also group together blocks of centered text. Just type something like this in your .txt file:

1 C> This is a centered sentence.
2 C> Another centered sentence, in the same paragraph as sentence one.
3 C>
4 C> This sentence will be in a new paragraph.

…and you’ll see this in your Leanpub book:

This is a centered sentence. Another centered sentence, which will be in the same paragraph as sentence one.

This sentence will be in a new paragraph.

Numbered/Ordered Lists

Numbered lists are easy to make.

  1. This is the first item in the numbered list.
  2. Each number (plus a period) should be followed by a space.
  3. Once you start a numbered list, it doesn’t matter what number you put at the beginning of the line. This line starts with 1. as it is written, but appears in the ebook as 3.
1 1. This is the first item in the numbered list.
2 2. Each number (plus a period) should be followed by a space.
3 1. Once you start a numbered list, it doesn't matter what number you put at the begi\
4 nning of the line. This line starts with 1. as it is written, but appears in the ebo\
5 ok as 3.

Unordered/Bulleted Lists

To make a list without numbers, where items are separated by bullets, you add an asterisk * followed by a space at the beginning of a line.

  • This is the first item in a bulleted list.
  • This is the second item in a bulleted list.
  • You can also use hyphens - to indicate you are making a bulleted list
1 * This is the first item in a bulleted list.
2 * This is the second item in a bulleted list.
3 - You can also use hyphens - to indicate you are making a bulleted list

Nested Lists

If you want nested lists, then you indent by two spaces:

  • one
  • two
  • three
    • three.one
    • three.two
1 * one
2 * two
3 * three
4   * three.one
5   * three.two

Putting Code Blocks Inside Lists

To put a code block in a list, do something like this:

  • one
    1   #!/usr/bin/env ruby
    2   puts "hiya"
    3   10.times {|n| puts n}
    
  • two
  • three

Some notes:

  1. The code is indented by 8 spaces, not the usual 4.
  2. There must be a blank line before and after the code block
  3. Tilde delimited code blocks do not work.
1 * one
2 
3         #!/usr/bin/env ruby
4         puts "hiya"
5         10.times {|n| puts n}
6 
7 * two
8 * three

Putting Paragraphs Into Lists

If you’d like to add a paragraph in the middle of a list, and have the list numbering continue afterwards, you can indent the paragraph by four spaces.

  1. This is the first one
  2. The second

    A whole lot more info about the above item.

  3. This is the third item
  4. This is the 4th item
1 1. This is the first one
2 1. The second
3 
4     A whole lot more info about the above item.
5 1. This is the third item
6 1. This is the 4th item

Putting Images Into Lists

You can put images in lists, like this:

  1. One thing.
  2. Second thing.
    Leanpub Logo
    Leanpub Logo
  3. Third thing.
  4. Fourth thing.
1 1. One thing
2 2. Second thing.
3 
4    ![Leanpub Logo](images/LeanpubLogo1200x610_300ppi.png)
5 
6 3. Third thing
7 4. Fourth thing.

Definition Lists

Put the thing you want to define on a line by itself. On the next line, or after a blank line, type a colon followed by the definition. For a more detailed example that explains how to nest definitions and have multiple paragraphs in definitions, see http://kramdown.gettalong.org/syntax.html#definition-lists.

Ruby
A wonderful language.
JavaScript
Lovely little language that really shines when you add CoffeeScript to the mix. This is a longer entry to see what it looks like when it wraps to a second line.
Haskell
Messes with my head.
 1 Ruby
 2 
 3 : A wonderful language.
 4 
 5 JavaScript
 6 
 7 : Lovely little language that really shines when you add CoffeeScript to
 8 the mix. This is a longer entry to see what it looks like when it wraps to
 9 a second line.
10 
11 Haskell
12 : Messes with my head.

Putting Footnotes Into Definition Lists

You can include a footnote text in a list by putting two spaces before the line where you define the footnote. Here’s an example:

item1
some explanation without a footnote
item2
some explanation1.
item3
more
 1 item1
 2 : some explanation without a footnote
 3 
 4 item2
 5 : some explanation[^foot].
 6 
 7   [^foot]:note
 8 
 9 item3
10 : more

Blockquotes

This is a blockquote

A blockquote should be indented.

The second paragraph should be indented as well.

And the third!

You can also have blockquotes inside blockquotes

1 > **This is a blockquote**
2 >
3 > A blockquote should be indented.
4 >
5 > The second paragraph should be indented as well.
6 >
7 > And the third!
8 >
9 > > You can also have blockquotes in blockquotes

Nesting Lists In Blockquotes

You can put lists in blockquotes. To do this, just add two spaces before each list item, and don’t type a > sign:

This is a blockquote

  1. This is a list item.
  2. This is another list item.
  3. This is a third list item.

Now this is regular text in the same blockquote.

1 > **This is a blockquote**
2 >
3 >  1. This is a list item.
4 >  2. This is another list item.
5 >  3. This is a third list item.
6 >
7 > Now this is regular text in the same blockquote.

Asides/Sidebars

The code for the aside is:

1 A> This is an aside.
2 A>
3 A> This is also sometimes known as a sidebar.
4 A>
5 A> To make one of these, put `A>` at the beginning of the lines of
6 A> the aside, similar to the `>` that you use for a blockquote.

This is what the aside will look like:

If you want to title an Aside, you do it like this:

1 A> ## Your title goes here.
2 A>
3 A> This is also sometimes known as a sidebar.

This is what the aside with a title will look like:

If you want to cross-link to your aside, you can name your aside like this:

1 A> ## Your Aside title {#your-aside-title}
2 A>
3 A> This is also sometimes known as a sidebar.

Please note that headers ## that are inside of quotes, asides, etc. are not included in section numbering.

More Text Block Types

In addition to asides, there are warnings (W>), tips (T>), errors (E>), information (I>), questions (Q>), discussions (D>) and exercises (X>). There are also generic text blocks (G>) where you can pick an icon from a large selection. There’s more info below on how to do that.

Please note that these types of text blocks are meant to be short. While asides (defined with A>) carry over multiple pages, warnings and such do not.

Below you’ll find examples of each block type.

Warning!

Here’s the code for a Warning:

1 W> ## This is a Warning
2 W>
3 W> Warnings are generated by using `W>` at the beginning of lines.

And here’s what it looks like:

Tips

Here’s the code for a Tip:

1 T> ## This is a Tip
2 T>
3 T> To make a tip, put `T>` at the beginning of the lines of
4 T> the tip, similar to the `>` that you use for a blockquote.
5 T>
6 T> To make paragraphs in a tip, you need to put lines
7 T> with just `T>` between your paragraphs.

And here’s what it looks like:

Errors

Here’s the code for an Error:

1 E> ## This is an Error
2 E>
3 E> Describe a common Error here.

And here’s what it looks like:

Information

Here’s the code for an Information box:

1 I> ## This is an Information box
2 I>
3 I> Put some special information here.

And here’s what it looks like:

Questions

Here’s the code for a Question box:

1 Q> ## This is a Question box
2 Q>
3 Q> Ask & answer a common question here.

And here’s what it looks like:

Discussions

Here’s the code for a Discussion box:

1 D> ## This is a Discussion box
2 D>
3 D> You can discuss aspects of the main text in a Discussion box.

And here’s what it looks like:

Exercises

Here’s the code for an Exercise:

1 X> ## This is an Exercise
2 X>
3 X> Exercises are generated by using `X>` at the beginning of lines.

And here’s what it looks like:

Generic Boxes

If you want a different icon, you can take a look at the icons available from Font Awesome. Find one you like on that page, and then note the text beside it. For example, the first one has the text fa-automobile. Leaving out the fa-, we do the following to use an automobile icon:

1 {icon=automobile}
2 G> ## Vrooom!
3 G>
4 G> The freedom of the road!