Summary User Guide Reference Guide

index.hbs #

index.hbs is the handlebars template that is used to render the book. The markdown files are processed to html and then injected in that template.

If you want to change the layout or style of your book, chances are that you will have to modify this template a little bit. Here is what you need to know.

Data #

A lot of data is exposed to the handlebars template with the “context”. In the handlebars template you can access this information by using

{{name_of_property}}

Here is a list of the properties that are exposed:

Handlebars Helpers #

In addition to the properties you can access, there are some handlebars helpers at your disposal.

1. toc #

The toc helper is used like this

{{#toc}}{{/toc}}

and outputs something that looks like this, depending on the structure of your book

<ul class="chapter">
    <li><a href="link/to/file.html">Some chapter</a></li>
    <li>
        <ul class="section">
            <li><a href="link/to/other_file.html">Some other Chapter</a></li>
        </ul>
    </li>
</ul>

If you would like to make a toc with another structure, you have access to the chapters property containing all the data. The only limitation at the moment is that you would have to do it with JavaScript instead of with a handlebars helper.

<script>
var chapters = {{chapters}};
// Processing here
</script>

2. previous / next #

The previous and next helpers expose a link and title property to the previous and next chapters.

They are used like this

{{#previous}}
    <a href="{{link}}" class="nav-chapters previous">
        <i class="fa fa-angle-left"></i> {{title}}
    </a>
{{/previous}}

The inner html will only be rendered if the previous / next chapter exists. Of course the inner html can be changed to your liking.


If you would like other properties or helpers exposed, please create a new issue

3. resource #

The path to a static file. It implicitly includes path_to_root, and accounts for files that are renamed with a hash in their filename.

<link rel="stylesheet" href="{{ resource "css/chrome.css" }}">