jekyll-theme-gitbook 0.0.3 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4e55032d1d46d8f8a1b6c58ab2a53e60d2aad1dd297f16c1bae5b83be0d309e8
4
- data.tar.gz: 4d51893394120d5efeaf0b2284fa48a238fcf35c123fc862274e13edde266afa
3
+ metadata.gz: 0246e434f0a26049173d1b595ba1a0755b9cdcdf13fea1f399959c09c70aa24d
4
+ data.tar.gz: b236e07a84f4af0c16ab9a38c3764913d0afa01f42774464d8f0f4bcf9af2ca9
5
5
  SHA512:
6
- metadata.gz: a4173c81205c974d250d58ac5bfa3cc7bce37f1ceb85296c7fae49ed41f2d19270a6f4047e94c1e0ea328b85ffeba3dfad82c38ffeed9eb2b6be26a29aad0fb0
7
- data.tar.gz: e882279dad7d78c92f928c521c85afe102b6077b143e6a734dcafd3fafc588fb6bd55d30804cdffa683ae84866d1faba4308a41361b5ed74cdbe77ee4d64445d
6
+ metadata.gz: b74e123c0c5edcc54c8d36ec2222ab45adf9ecd7e83ccb220587b41591de4e938e3b629063689fd20a1877e012b0fd683176996214aa8a499b289bcc4a183f4f
7
+ data.tar.gz: 888013d432576776ee3587739ad3977249f1a46b8a282128f8ee6695a52bbcdc8b288e92bf9c0c66824c5ca1817740c779fb92aa495cf766240a450cdde74fee
data/README.md CHANGED
@@ -34,7 +34,7 @@ This theme is designed to be highly configurable, whilst providing sensible defa
34
34
  If you are hosting your site on GitHub Pages then add the following line to your site's `_config.yml` file (as per [the documentation](https://docs.github.com/en/github/working-with-github-pages/adding-a-theme-to-your-github-pages-site-using-jekyll)):
35
35
 
36
36
  ```yaml
37
- remote_theme: "adamrehn/jekyll-theme-gitbook@v0.0.3"
37
+ remote_theme: "adamrehn/jekyll-theme-gitbook@v0.0.4"
38
38
  ```
39
39
 
40
40
  ### Other hosts (e.g. GitLab Pages)
@@ -68,8 +68,17 @@ theme-settings:
68
68
  collection: "categories"
69
69
 
70
70
 
71
- # Specifies whether navigation links should be generated for chapter index files that use the `chapter-index` layout (OPTIONAL, defaults to false)
72
- indices: false
71
+ # Navigation menu settings (OPTIONAL, only needed if you want to override the defaults)
72
+ navigation:
73
+
74
+ # Specifies whether navigation links should be generated for chapter index files that use the `chapter-index` layout (OPTIONAL, defaults to false)
75
+ indices: false
76
+
77
+ # Specifies whether the navigation links for each chapter should be output as collapsible sections using HTML <detail> tags, with chapter headings as <summary> tags (OPTIONAL, defaults to false)
78
+ collapsible: false
79
+
80
+ # When collapsible sections are enabled, specifies whether sections are collapsed by default (OPTIONAL, defaults to false)
81
+ collapsed: false
73
82
 
74
83
 
75
84
  # Copyright settings for the page footer (REQUIRED)
@@ -128,7 +137,12 @@ Each key in this structure serves a specific purpose:
128
137
 
129
138
  - `collection`: the theme uses a book metaphor to describe the structure of content. The site is broken down into a series of "chapters", each containing a series of pages. Of course, this naming convention does not make sense for all sites (for some sites, the "chapters" may in fact be referred to as sections or categories) and so the theme does not force you to adopt the name "chapters" in your filesystem structure. Instead, you can specify any [Jekyll collection](https://jekyllrb.com/docs/collections/) to act as your list of chapters, typically using one subdirectory per chapter to group pages. **You must specify the name of the Jekyll collection as a string value for this key.**
130
139
 
131
- - `indices`: by default, the theme only generates navigation links to each of the pages in each chapter, not to the chapter indices themselves. You can set this key to `true` if you would like to trigger the generation of chapter index navigation links, although note that links are only generated for chapters whose `index.html` files use the `chapter-index` layout and not for chapters whose index use the `chapter-redirect` layout. **This key is optional.**
140
+ - `navigation`: this key groups settings for overriding the behaviour of the site's navigation links. **This key and all of its subkeys are optional:**
141
+
142
+ - Subkey `indices`: by default, the theme only generates navigation links to each of the pages in each chapter, not to the chapter indices themselves. You can set this subkey to `true` if you would like to trigger the generation of chapter index navigation links, although note that links are only generated for chapters whose `index.html` files use the `chapter-index` layout and not for chapters whose index use the `chapter-redirect` layout.
143
+
144
+ - Subkeys `collapsible` and `collapsed`: these subkeys allow you to make the sections of the navigation menu for each chapter collapsible, and specify whether they are collapsed or expanded by default, respectively.
145
+
132
146
 
133
147
  - `copyright`: this key groups settings related to the copyright notice that appears in the footer of all pages. **This key and the `author` and `year` subkeys are required,** whilst the `license` subkey is optional.
134
148
 
@@ -247,7 +261,7 @@ The layout you choose will determine the site's behaviour when navigating to the
247
261
 
248
262
  If you choose to provide a chapter description then this will be displayed on the chapter's index page when using the `chapter-index` layout, and will also be displayed under the chapter's name if you generate a list of chapters with the `chapter-list.html` include (which is designed to be used on the front page of a site.)
249
263
 
250
- If you use the `chapter-index` layout for a chapter and the global setting `theme-settings.indices` is set to `true` then a link will be generated for the chapter index in the site's navigation sidebar.
264
+ If you use the `chapter-index` layout for a chapter and the global setting `theme-settings.navigation.indices` is set to `true` then a link will be generated for the chapter index in the site's navigation sidebar.
251
265
 
252
266
  #### Content structure: site root
253
267
 
@@ -9,17 +9,29 @@
9
9
  {% assign pages = documents | where_exp: "page", "page.pagenum != null" | sort: "pagenum" %}
10
10
  {% assign indices = documents | where_exp: "page", "page.pagenum == null" | sort: "chapnum" %}
11
11
 
12
+ {% assign chapter_element = "p" %}
13
+ {% if site.theme-settings.navigation.collapsible == true %}
14
+ {% assign chapter_element = "summary" %}
15
+ {% endif %}
16
+
12
17
  {% for index in indices %}
13
- <p class="chapter">{% if index.icon %}{% assign components = index.url | split: "/" %}<span class="icon icon-{{ components[-2] | escape }} {{ index.icon | escape }}"></span> {% endif %}{{ index.chapter | escape | replace: " ", "&nbsp;" }}</p>
18
+
19
+ {% if site.theme-settings.navigation.collapsible == true %}<details{% unless site.theme-settings.navigation.collapsed == true %} open="true"{% endunless %}>{% endif %}
20
+
21
+ <{{ chapter_element }} class="chapter">{% if index.icon %}{% assign components = index.url | split: "/" %}<span class="icon icon-{{ components[-2] | escape }} {{ index.icon | escape }}"></span> {% endif %}{{ index.chapter | escape }}</{{ chapter_element }}>
22
+
14
23
  <ul>
15
- {% if site.theme-settings.indices == true and index.layout == "chapter-index" %}
24
+ {% if site.theme-settings.navigation.indices == true and index.layout == "chapter-index" %}
16
25
  <li{% if index.url == page.url %} class="selected"{% endif %}><a href="{{ index.url | replace: "/index", "" | relative_url | uri_escape }}">Index</a></li>
17
26
  {% endif %}
18
27
  {% assign chapter_pages = pages | where: "chapter", index.chapter %}
19
28
  {% for p in chapter_pages %}
20
- <li{% if p.url == page.url %} class="selected"{% endif %}><a href="{{ p.url | relative_url | uri_escape }}">{{ p.title | escape | replace: " ", "&nbsp;" }}</a></li>
29
+ <li{% if p.url == page.url %} class="selected"{% endif %}><a href="{{ p.url | relative_url | uri_escape }}">{{ p.title | escape }}</a></li>
21
30
  {% endfor %}
22
31
  </ul>
32
+
33
+ {% if site.theme-settings.navigation.collapsible == true %}</details>{% endif %}
34
+
23
35
  {% endfor %}
24
36
 
25
37
  {% include hooks/navbar-posthook.html %}
data/_sass/_content.scss CHANGED
@@ -96,6 +96,10 @@ nav .chapter, .contents .heading, article .chapter, .prev-next a .label, .prev-n
96
96
  margin: 0;
97
97
  }
98
98
 
99
+ nav .chapter, nav ul li {
100
+ max-width: 100%;
101
+ }
102
+
99
103
  nav ul + .chapter {
100
104
  margin-top: 2rem;
101
105
  }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-theme-gitbook
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Rehn
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-10-17 00:00:00.000000000 Z
11
+ date: 2022-12-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll
@@ -126,7 +126,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
126
126
  - !ruby/object:Gem::Version
127
127
  version: '0'
128
128
  requirements: []
129
- rubygems_version: 3.3.23
129
+ rubygems_version: 3.3.26
130
130
  signing_key:
131
131
  specification_version: 4
132
132
  summary: Gem-based Jekyll theme for documentation sites, inspired by GitBook's visual