{% include internal/meta.html %} {{ site.title | escape }} {% if site.theme-settings.fontawesome.kit %} {% elsif site.theme-settings.fontawesome.local != true %} {% endif %} {% include hooks/head-posthook.html %}
{% comment %} Loop through our chapters and their pages, building one large markdown string suitable for TOC generation. We want this to all be a single string to ensure unique IDs are still generated even if there are headings with duplicate text. Note that we use HTML comments to inject our
and
tags, since the markdown processor will preserve the comments verbatim and we can then strip them away to leave our HTML tags intact in the final output without being erroneously wrapped in

tags. {% endcomment %} {% assign markdown = "" %} {% assign indices = site.documents | where: "collection", site.theme-settings.collection | where_exp: "page", "page.chapnum != null" | where_exp: "page", "page.pagenum == null" | sort: "chapnum" %} {% if page.subsite %} {% assign indices = indices | where: "subsite", page.subsite %} {% endif %} {% for index in indices %} {% assign pages = site.documents | where: "collection", site.theme-settings.collection | where: "chapnum", index.chapnum | where_exp: "page", "page.pagenum != null" | sort: "pagenum" %} {% if page.subsite %} {% assign pages = pages | where: "subsite", page.subsite %} {% endif %} {% capture content %} # Chapter {{ index.chapnum }}: {{ index.chapter | escape }} {% assign description = index.content | strip %}{% if description.size > 0 %}{{ description }}{% endif %} {% for page in pages %} # {{ page.title | escape }} {{ page.content }} {% endfor %} {% endcapture %} {% assign markdown = markdown | append: content %} {% endfor %} {% comment %} Render our generated markdown string and strip away the comment wrappers from our HTML tags. {% endcomment %} {% assign rendered = markdown | markdownify | replace: "", "" %} {% comment %} Output our book cover. {% endcomment %}

{{ site.title | escape }}

{% comment %} Generate our Table of Contents (TOC) using the rendered markdown output and add a CSS class to chapter links. {% endcomment %}

Contents

{% capture toc %}{% include thirdparty/toc.html html=rendered sanitize=true %}{% endcapture %} {{ toc | replace: '
  • {% include hooks/body-posthook.html %}