Helper includes
In order for this theme to work natively with GitHub pages, it can’t use any custom Jekyll plugins. But it can do any logic and data manipulation supported by the template language, Liquid.
So this theme makes extensive use of Liquid templates to act as “helpers”,
by including them in a page and passing them parameters using Jekyll’s standard include
tag.
Chapter links
The chapter-link.html
helper renders a link to the chapter with the specified slug
,
using its current title and chapter number.
See {% include chapter-link.html slug="variables" %}.
…renders as: See Chapter 4. Theme variables.
Parameters:
slug
: Required. Theslug
of the chapter to link to.anchor
: An optional anchor tag to append to the chapter link.
Tables of contents
The chapterbook-toc.html
helper allows you to make a table of contents page,
including chapter abstracts (if any).
Parameters:
show_drafts
: Iftrue
, also show draft chapters. Useful for showing an “outline” view of the book.
See example Table of Contents, rendered with:
{% include chapterbook-toc.html %}
See example draft outline, rendered with:
{% include chapterbook-toc.html show_drafts=true %}
Figures
The figure.html
helper renders images as figures in the book.
Parameters:
url
: The relative URL to the image (appended tosite.baseurl
).caption
: An optional caption to render beneath the figure.class
: an optionalclass
attribute to add to the the HTML<figure>
tag.
For example:
{% include figure.html
caption="C major chord shape."
url="/assets/demo/C-maj.svg"
class="row"
%}
…renders as:
Theme variables
This theme makes a number of variables related to chapters and parts available to markdown files and Liquid templates.
See Chapter 4. Theme variables for details.
This file is located at: _chapters/010-repo-setup/020-helpers.md