--- layout: default --- {%- comment -%} A chapter of the manual. The title comes from the front matter, so the page body starts at `##`. Under the lede, the chapter's own contents (its headings, h2 to h5, from _plugins/manual.rb) when there are enough to be worth it. Below the text, the neighbours in reading order: the letter, then each section's chapters by nav_order, each followed by the pages that name it as their `parent:`. The trail above the title is components/breadcrumbs.html, which the theme's layout places. {%- endcomment -%} {%- assign manual_pages = site.html_pages | where_exp: "item", "item.url contains '/manual/'" | where_exp: "item", "item.title != nil" | where_exp: "item", "item.nav_exclude != true" -%} {%- assign ordered = manual_pages | where_exp: "item", "item.section == nil" | sort: "nav_order" -%} {%- for section in site.manual.sections -%} {%- assign chapters = manual_pages | where: "section", section.key | where_exp: "item", "item.parent == nil" | sort: "nav_order" -%} {%- for chapter in chapters -%} {%- assign ordered = ordered | push: chapter -%} {%- assign chapter_key = chapter.url | split: "/" | last -%} {%- assign children = manual_pages | where: "parent", chapter_key | sort: "nav_order" -%} {%- assign ordered = ordered | concat: children -%} {%- endfor -%} {%- endfor -%} {%- assign prev_page = nil -%} {%- assign next_page = nil -%} {%- for node in ordered -%} {%- if node.url == page.url -%} {%- assign i = forloop.index0 | minus: 1 -%} {%- if forloop.index0 > 0 -%}{%- assign prev_page = ordered[i] -%}{%- endif -%} {%- unless forloop.last -%}{%- assign j = forloop.index0 | plus: 1 -%}{%- assign next_page = ordered[j] -%}{%- endunless -%} {%- endif -%} {%- endfor -%}

{{ page.title }}

{%- comment -%} Fewer than three headings is not a contents. Up to two dozen entries the list is shown open; past that (the CLI chapter) it is a line to unfold, so the text does not start a screen down. Six or more `##` headings flow into two columns on a wide screen. {%- endcomment -%} {%- assign toc_entries = content | headings_of: 2, 5 -%} {%- assign toc_sections = content | headings_of: 2, 2 -%} {%- if toc_entries.size >= 3 %} {%- assign toc_class = "chapter-toc-list" -%} {%- if toc_sections.size >= 6 -%}{%- assign toc_class = "chapter-toc-list chapter-toc-columns" -%}{%- endif %}
In this chapter {{ content | toc_tree: 2, 5, toc_class }}
{%- endif %} {{ content }} {%- if prev_page or next_page %} {%- endif %}