Skip to main content
All CollectionsAuthor HelpMarkdown and Markua
Detailed Example of How the Sample Book Directive Works in Markua
Detailed Example of How the Sample Book Directive Works in Markua

Keywords: sample, sample directive, sample book, how

Leanpub Support avatar
Written by Leanpub Support
Updated over 3 months ago
Detailed Example of How the Sample Book Directive Works in Markua

We've set out below an example of how you can include and exclude sections and subsections of a Leanpub book in your sample book.

If you put {sample: true} above a section or subsection header, all the "lower" subsections underneath it will be included in the sample book.

If you put {sample: false} above a section or subsection header, all the "lower" subsections underneath it will be excluded in the sample book.

So, in the following example, all of # Chapter One will be included in the sample book, except for ## Chapter One: Subsection Two.

Also, in the following example, the opening content of # Chapter Two (the "Circumambulate the city..." content) will not be included in the sample book, but the subection ## Chapter Two: Subsection One will be included in the sample book.

{sample: true}
# Chapter One

Call me Ishmael. Some years ago—never mind how long precisely—having little or no money in my purse, and nothing particular to interest me on shore, I thought I would sail about a little and see the watery part of the world. It is a way I have of driving off the spleen and regulating the circulation.

## Chapter One: Subsection One

Whenever I find myself growing grim about the mouth; whenever it is a damp, drizzly November in my soul; whenever I find myself involuntarily pausing before coffin warehouses, and bringing up the rear of every funeral I meet; and especially whenever my hypos get such an upper hand of me, that it requires a strong moral principle to prevent me from deliberately stepping into the street, and methodically knocking people’s hats off—then, I account it high time to get to sea as soon as I can. This is my substitute for pistol and ball.

{sample: false}
## Chapter One: Subsection Two

With a philosophical flourish Cato throws himself upon his sword; I quietly take to the ship. There is nothing surprising in this. If they but knew it, almost all men in their degree, some time or other, cherish very nearly the same feelings towards the ocean with me.

# Chapter Two

Circumambulate the city of a dreamy Sabbath afternoon. Go from Corlears Hook to Coenties Slip, and from thence, by Whitehall, northward. What do you see?—Posted like silent sentinels all around the town, stand thousands upon thousands of mortal men fixed in ocean reveries.

{sample: true}
## Chapter Two: Subsection One

But look! here come more crowds, pacing straight for the water, and seemingly bound for a dive. Strange!

Here's an annotated image of the example above:


If you have any feedback or questions about this article, please email the Leanpub team about it at hello@leanpub.com!

If you have any questions or thoughts on writing and self-publishing with Leanpub, please join our global community of authors in our Authors Forum here!

Are you interested in self-publishing, and creating your first Leanpub book? Here are some quick tutorials for our most popular writing modes: http://help.leanpub.com/en/articles/3088382-quick-walkthroughs-for-getting-started-on-a-leanpub-book

Are you looking for great deals on Leanpub ebooks, ebook bundles, and courses? Sign up for our Weekly and Monthly newsletter sales here!

To learn about amazing new books and authors, subscribe to our YouTube channel here: https://www.youtube.com/leanpub.

You can also follow Leanpub in lots of other places!

Did this answer your question?