<p>The default renderer uses a <ahref="http://handlebarsjs.com/">handlebars</a> template to render your markdown files in and comes with a default theme
included in the mdBook binary.</p>
<p>But the theme is totally customizable, you can replace every file from the theme by your own by adding a
<code>theme</code> directory in your source folder. Create a new file with the name of the file you want to overwrite
and now that file will be used instead of the default file.</p>
<p>Here are the files you can overwrite:</p>
<ul>
<li><strong><em>index.hbs</em></strong> is the handlebars template.</li>
<li><strong><em>book.css</em></strong> is the style used in the output. If you want to change the design of your book, this is probably the file you want to modify. Sometimes in conjunction with <code>index.hbs</code> when you want to radically change the layout.</li>
<li><strong><em>book.js</em></strong> is mostly used to add client side functionality.</li>
</ul>
<p><strong>Note:</strong></p>
<p>When you overwrite a file, it is possible that you break some functionality. Therefore I recommend to use the file from the default theme as template and only add / modify what you need. In the future you will be able to copy the default theme into your source directory automatically by using <code>mdbook init --theme</code>.</p>
<p>Here is a list of the properties that are exposed:</p>
<ul>
<li>
<p><strong><em>language</em></strong> Language of the book in the form <code>en</code>. To use in <codeclass="language-html"><html lang="{{ language }}"></code> for example.
At the moment it is hardcoded.</p>
</li>
<li>
<p><strong><em>title</em></strong> Title of the book, as specified in <code>book.json</code></p>
</li>
<li>
<p><strong><em>path</em></strong> Relative path to the original markdown file from the source directory</p>
</li>
<li>
<p><strong><em>content</em></strong> This is the rendered markdown.</p>
</li>
<li>
<p><strong><em>path_to_root</em></strong> This is a path containing exclusively <code>../</code>'s that points to the root of the book from the current file.
Since the original directory structure is maintained, it is useful to prepend relative links with this <code>path_to_root</code>.</p>
</li>
<li>
<p><strong><em>chapters</em></strong> Is an array of dictionaries of the form</p>
<pre><codeclass="language-json">{"section": "1.2.1", "name": "name of this chapter", "path": "dir/markdown.md"}
</code></pre>
<p>containing all the chapters of the book. It is used for example to construct the table of contents (sidebar).</p>
</li>
</ul>
<h3>Helpers</h3>
<p>In addition to the properties you can access, there are some handlebars helpers at your disposal.</p>