jekyll-theme-amethyst 0.2.0 → 0.4.0

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: ae1f567530a5c557779c453ab8ea18940c3620baa598d0362fe922bd2b6fff2f
4
- data.tar.gz: 1c202be8204ee0d9073f337cff0b5145a3ef7019b8b1c59e835e750fe1353c72
3
+ metadata.gz: 885f5b7a5ae2e9b5997b2fb05ef3cd16d41d836da975e255bd98f28b184e2b5d
4
+ data.tar.gz: a483603a8616df9defba29971850177b4a29697d764af354f04679039f6e8297
5
5
  SHA512:
6
- metadata.gz: f633624fe399ba7a0258b0109c530d3c45155d2b6c350b3bb655895e36beb07b844275f9b479d3b37794bb98b0ac833120c79be16a9a609f5d5e8605849844f8
7
- data.tar.gz: 0102d31b93866380a0018c5529c0c78e018ba10833eb8fa57300fe2463acfc3de746ba4d64894cfe1d4b5bf8e201bab107dbd6e1f677b57f37abb1600df8f26f
6
+ metadata.gz: 69aba6c9b3385f9f11fa03752747f03168481ce74c9e8d9148da623b14fd1292f2db5ed44bf6d1149921ecdecf7974147a74349d506fcc3b0173ed749bdc0d61
7
+ data.tar.gz: 20d6ab32044f7ad93d4e358f32d95921ab2b05df7586412fe98c3b037e3026d22be8241531842eea08c1816046b1ecf8eed633e3defa1fc676281e49f6b1c778
@@ -1,13 +1,13 @@
1
1
  - group: foo
2
- expand: true
2
+ expand: initial
3
+ initial: /api/
3
4
 
4
5
  - group: lorem
5
6
 
6
- - type: list
7
- title: Other
8
- expand: true
9
- list:
10
- - url: /api/deprecated/
11
- title: Deprecated
12
- - url: /api/removed/
13
- title: Removed
7
+ - type: link
8
+ url: /api/deprecated/
9
+ title: Deprecated
10
+
11
+ - type: link
12
+ url: /api/removed/
13
+ title: Removed
data/_data/sitenav.yml CHANGED
@@ -1,10 +1,13 @@
1
1
  - name: Guides
2
- href: /guides/
3
2
  sub:
4
3
  - name: Getting Started
5
4
  href: /intro/
6
5
  - name: Documentation
7
- href: /api/
6
+ sub:
7
+ - name: Foobar
8
+ href: /api/foo/
9
+ - name: Lorem ipsum
10
+ href: /api/lorem/
8
11
  - name: Blog
9
12
  href: /blog/
10
13
  - name: About
@@ -2,15 +2,19 @@
2
2
 
3
3
  Parameters:
4
4
 
5
- * blocks:
5
+ * blocks: [Default: nil]
6
6
  Key in `site.data` corresponding to a `_data/*.yml` file.
7
7
 
8
+ * toc: [Default: false]
9
+ Enable table of contents.
10
+
8
11
  Block data:
9
12
 
10
13
  * type: [Default: "group"]
11
14
  What type of block to add to the sidebar.
12
15
  - "group" to query a list of pages from a page group.
13
16
  - "list" to specify your own custom list.
17
+ - "link" to specify a single link.
14
18
  - "archive" to query a list of chronological pages based on their layout.
15
19
  - "tags" to query a list of alphabetical pages based on their layout.
16
20
 
@@ -29,23 +33,28 @@ Block data:
29
33
  When using a "list" block, an array of objects with "title"
30
34
  and "url" properties.
31
35
 
32
- * expand: [Default: active]
36
+ * expand: [Default: "active"]
33
37
  Whether a block should be expanded.
34
38
  - true: Always expanded.
35
39
  - false: Never expanded.
36
40
  - active: Expand when the current page is in the list.
41
+ - initial: Expand on the home page, and when the current page is in the list.
42
+
43
+ * initial: [Default: "/"]
44
+ Override which address the "initial" expand mode will compare to.
37
45
 
38
46
  {%- endcomment -%}
39
- <section class="sidebar">
47
+ <aside class="sidebar" role="complementary">
40
48
  {%- for block in site.data[include.blocks] -%}
41
49
  {%- assign block_type = block.type | default: "group" -%}
42
50
  {%- assign block_title = block.title -%}
43
51
  {%- assign block_url = block.url -%}
44
52
  {%- assign block_contents = block.list -%}
45
53
  {%- assign block_expand = block.expand -%}
46
- {%- if block_expand != true and block_expand != false -%}
54
+ {%- if block_expand != true and block_expand != false and block_expand != "initial" -%}
47
55
  {%- assign block_expand = "active" -%}
48
56
  {%- endif -%}
57
+ {%- assign block_initial = block.initial | default: "/" -%}
49
58
 
50
59
  {%- if block_type == "group" -%}
51
60
  {%- assign group_page = site.pages | where: "layout", "group" | where: "group", block.group | first -%}
@@ -58,6 +67,18 @@ Block data:
58
67
  {%- assign block_contents = site.pages | where: "layout", "posts-year" | sort_natural: 'date' | reverse -%}
59
68
  {%- elsif block_type == "tags" -%}
60
69
  {%- assign block_contents = site.pages | where: "layout", "posts-tag" | sort_natural: 'title' -%}
70
+ {%- elsif block_type == "link" -%}
71
+ {%- assign block_contents = nil -%}
72
+ {%- assign block_expand = false -%}
73
+ {%- endif -%}
74
+
75
+ {%- if block_expand == "initial" -%}
76
+ {%- assign block_expand = false -%}
77
+ {%- if page.url == block_initial -%}
78
+ {%- assign block_expand = true -%}
79
+ {%- else -%}
80
+ {%- assign block_expand = "active" -%}
81
+ {%- endif -%}
61
82
  {%- endif -%}
62
83
 
63
84
  {%- if block_expand == "active" -%}
@@ -85,5 +106,18 @@ Block data:
85
106
  {%- endfor -%}
86
107
  </ul>
87
108
  {%- endif -%}
88
- {%- endfor %}
89
- </section>
109
+ {%- endfor -%}
110
+
111
+ {%- if include.toc -%}
112
+ {%- capture jekyll_toc -%}
113
+ {%- include toc.html html=content sanitize=true h_max=3 ordered=true skip_no_ids=true class="toc" item_class="sidebar-item" -%}
114
+ {%- endcapture -%}
115
+ {%- if jekyll_toc != '' -%}
116
+ {%- if include.blocks -%}
117
+ <hr>
118
+ {%- endif -%}
119
+ <div class="toc-wrapper">
120
+ <h4>Table of contents</h4>{{ jekyll_toc }}</div>
121
+ {%- endif -%}
122
+ {%- endif %}
123
+ </aside>
@@ -0,0 +1,182 @@
1
+ {% capture tocWorkspace %}
2
+ {% comment %}
3
+ Copyright (c) 2017 Vladimir "allejo" Jimenez
4
+
5
+ Permission is hereby granted, free of charge, to any person
6
+ obtaining a copy of this software and associated documentation
7
+ files (the "Software"), to deal in the Software without
8
+ restriction, including without limitation the rights to use,
9
+ copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ copies of the Software, and to permit persons to whom the
11
+ Software is furnished to do so, subject to the following
12
+ conditions:
13
+
14
+ The above copyright notice and this permission notice shall be
15
+ included in all copies or substantial portions of the Software.
16
+
17
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
19
+ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
20
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
21
+ HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
22
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
23
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
24
+ OTHER DEALINGS IN THE SOFTWARE.
25
+ {% endcomment %}
26
+ {% comment %}
27
+ Version 1.1.0
28
+ https://github.com/allejo/jekyll-toc
29
+
30
+ "...like all things liquid - where there's a will, and ~36 hours to spare, there's usually a/some way" ~jaybe
31
+
32
+ Usage:
33
+ {% include toc.html html=content sanitize=true class="inline_toc" id="my_toc" h_min=2 h_max=3 %}
34
+
35
+ Parameters:
36
+ * html (string) - the HTML of compiled markdown generated by kramdown in Jekyll
37
+
38
+ Optional Parameters:
39
+ * sanitize (bool) : false - when set to true, the headers will be stripped of any HTML in the TOC
40
+ * class (string) : '' - a CSS class assigned to the TOC
41
+ * id (string) : '' - an ID to assigned to the TOC
42
+ * h_min (int) : 1 - the minimum TOC header level to use; any header lower than this value will be ignored
43
+ * h_max (int) : 6 - the maximum TOC header level to use; any header greater than this value will be ignored
44
+ * ordered (bool) : false - when set to true, an ordered list will be outputted instead of an unordered list
45
+ * item_class (string) : '' - add custom class(es) for each list item; has support for '%level%' placeholder, which is the current heading level
46
+ * submenu_class (string) : '' - add custom class(es) for each child group of headings; has support for '%level%' placeholder which is the current "submenu" heading level
47
+ * base_url (string) : '' - add a base url to the TOC links for when your TOC is on another page than the actual content
48
+ * anchor_class (string) : '' - add custom class(es) for each anchor element
49
+ * skip_no_ids (bool) : false - skip headers that do not have an `id` attribute
50
+
51
+ Output:
52
+ An ordered or unordered list representing the table of contents of a markdown block. This snippet will only
53
+ generate the table of contents and will NOT output the markdown given to it
54
+ {% endcomment %}
55
+
56
+ {% capture newline %}
57
+ {% endcapture %}
58
+ {% assign newline = newline | rstrip %} <!-- Remove the extra spacing but preserve the newline -->
59
+
60
+ {% capture deprecation_warnings %}{% endcapture %}
61
+
62
+ {% if include.baseurl %}
63
+ {% capture deprecation_warnings %}{{ deprecation_warnings }}<!-- jekyll-toc :: "baseurl" has been deprecated, use "base_url" instead -->{{ newline }}{% endcapture %}
64
+ {% endif %}
65
+
66
+ {% if include.skipNoIDs %}
67
+ {% capture deprecation_warnings %}{{ deprecation_warnings }}<!-- jekyll-toc :: "skipNoIDs" has been deprecated, use "skip_no_ids" instead -->{{ newline }}{% endcapture %}
68
+ {% endif %}
69
+
70
+ {% capture jekyll_toc %}{% endcapture %}
71
+ {% assign orderedList = include.ordered | default: false %}
72
+ {% assign baseURL = include.base_url | default: include.baseurl | default: '' %}
73
+ {% assign skipNoIDs = include.skip_no_ids | default: include.skipNoIDs | default: false %}
74
+ {% assign minHeader = include.h_min | default: 1 %}
75
+ {% assign maxHeader = include.h_max | default: 6 %}
76
+ {% assign nodes = include.html | strip | split: '<h' %}
77
+
78
+ {% assign firstHeader = true %}
79
+ {% assign currLevel = 0 %}
80
+ {% assign lastLevel = 0 %}
81
+
82
+ {% capture listModifier %}{% if orderedList %}ol{% else %}ul{% endif %}{% endcapture %}
83
+
84
+ {% for node in nodes %}
85
+ {% if node == "" %}
86
+ {% continue %}
87
+ {% endif %}
88
+
89
+ {% assign currLevel = node | replace: '"', '' | slice: 0, 1 | times: 1 %}
90
+
91
+ {% if currLevel < minHeader or currLevel > maxHeader %}
92
+ {% continue %}
93
+ {% endif %}
94
+
95
+ {% assign _workspace = node | split: '</h' %}
96
+
97
+ {% assign _idWorkspace = _workspace[0] | split: 'id="' %}
98
+ {% assign _idWorkspace = _idWorkspace[1] | split: '"' %}
99
+ {% assign htmlID = _idWorkspace[0] %}
100
+
101
+ {% assign _classWorkspace = _workspace[0] | split: 'class="' %}
102
+ {% assign _classWorkspace = _classWorkspace[1] | split: '"' %}
103
+ {% assign htmlClass = _classWorkspace[0] %}
104
+
105
+ {% if htmlClass contains "no_toc" %}
106
+ {% continue %}
107
+ {% endif %}
108
+
109
+ {% if firstHeader %}
110
+ {% assign minHeader = currLevel %}
111
+ {% endif %}
112
+
113
+ {% capture _hAttrToStrip %}{{ _workspace[0] | split: '>' | first }}>{% endcapture %}
114
+ {% assign header = _workspace[0] | replace: _hAttrToStrip, '' %}
115
+
116
+ {% if include.item_class and include.item_class != blank %}
117
+ {% capture listItemClass %} class="{{ include.item_class | replace: '%level%', currLevel | split: '.' | join: ' ' }}"{% endcapture %}
118
+ {% endif %}
119
+
120
+ {% if include.submenu_class and include.submenu_class != blank %}
121
+ {% assign subMenuLevel = currLevel | minus: 1 %}
122
+ {% capture subMenuClass %} class="{{ include.submenu_class | replace: '%level%', subMenuLevel | split: '.' | join: ' ' }}"{% endcapture %}
123
+ {% endif %}
124
+
125
+ {% capture anchorBody %}{% if include.sanitize %}{{ header | strip_html }}{% else %}{{ header }}{% endif %}{% endcapture %}
126
+
127
+ {% if htmlID %}
128
+ {% capture anchorAttributes %} href="{% if baseURL %}{{ baseURL }}{% endif %}#{{ htmlID }}"{% endcapture %}
129
+
130
+ {% if include.anchor_class %}
131
+ {% capture anchorAttributes %}{{ anchorAttributes }} class="{{ include.anchor_class | split: '.' | join: ' ' }}"{% endcapture %}
132
+ {% endif %}
133
+
134
+ {% capture listItem %}<a{{ anchorAttributes }}>{{ anchorBody }}</a>{% endcapture %}
135
+ {% elsif skipNoIDs == true %}
136
+ {% continue %}
137
+ {% else %}
138
+ {% capture listItem %}{{ anchorBody }}{% endcapture %}
139
+ {% endif %}
140
+
141
+ {% if currLevel > lastLevel %}
142
+ {% capture jekyll_toc %}{{ jekyll_toc }}<{{ listModifier }}{{ subMenuClass }}>{% endcapture %}
143
+ {% elsif currLevel < lastLevel %}
144
+ {% assign repeatCount = lastLevel | minus: currLevel %}
145
+
146
+ {% for i in (1..repeatCount) %}
147
+ {% capture jekyll_toc %}{{ jekyll_toc }}</li></{{ listModifier }}>{% endcapture %}
148
+ {% endfor %}
149
+
150
+ {% capture jekyll_toc %}{{ jekyll_toc }}</li>{% endcapture %}
151
+ {% else %}
152
+ {% capture jekyll_toc %}{{ jekyll_toc }}</li>{% endcapture %}
153
+ {% endif %}
154
+
155
+ {% capture jekyll_toc %}{{ jekyll_toc }}<li{{ listItemClass }}>{{ listItem }}{% endcapture %}
156
+
157
+ {% assign lastLevel = currLevel %}
158
+ {% assign firstHeader = false %}
159
+ {% endfor %}
160
+
161
+ {% assign repeatCount = minHeader | minus: 1 %}
162
+ {% assign repeatCount = lastLevel | minus: repeatCount %}
163
+ {% for i in (1..repeatCount) %}
164
+ {% capture jekyll_toc %}{{ jekyll_toc }}</li></{{ listModifier }}>{% endcapture %}
165
+ {% endfor %}
166
+
167
+ {% if jekyll_toc != '' %}
168
+ {% assign rootAttributes = '' %}
169
+ {% if include.class and include.class != blank %}
170
+ {% capture rootAttributes %} class="{{ include.class | split: '.' | join: ' ' }}"{% endcapture %}
171
+ {% endif %}
172
+
173
+ {% if include.id and include.id != blank %}
174
+ {% capture rootAttributes %}{{ rootAttributes }} id="{{ include.id }}"{% endcapture %}
175
+ {% endif %}
176
+
177
+ {% if rootAttributes %}
178
+ {% assign nodes = jekyll_toc | split: '>' %}
179
+ {% capture jekyll_toc %}<{{ listModifier }}{{ rootAttributes }}>{{ nodes | shift | join: '>' }}>{% endcapture %}
180
+ {% endif %}
181
+ {% endif %}
182
+ {% endcapture %}{% assign tocWorkspace = '' %}{{ deprecation_warnings }}{{ jekyll_toc -}}
data/_layouts/group.html CHANGED
@@ -1,5 +1,12 @@
1
1
  ---
2
2
  layout: page-api
3
+ amethyst:
4
+ toc: false
5
+
6
+ # Parameters:
7
+ #
8
+ # - group
9
+ #
3
10
  ---
4
11
  {{ content }}
5
12
 
@@ -1,9 +1,15 @@
1
1
  ---
2
2
  layout: wrapper
3
+
4
+ # Parameters:
5
+ #
6
+ # - version_added: semver string (e.g. "1.2.3"). Can be linked by setting `site.amethyst.release_base`.
7
+ # - version_deprecated: semver string
8
+ # - version_removed: semver string
9
+ #
3
10
  ---
4
11
 
5
12
  <div class="main main--columns wrapper">
6
- {% include sidebar.html blocks="sidebar_api" %}
7
13
  <div class="content" role="main">
8
14
  <h1>{{ page.title }}</h1>
9
15
  {%- if page.version_added or page.version_deprecated -%}
@@ -29,4 +35,9 @@ layout: wrapper
29
35
  {%- endif %}
30
36
  {{- content }}
31
37
  </div>
38
+ {%- assign toc = true -%}
39
+ {%- if layout.amethyst.toc == false -%}
40
+ {%- assign toc = false -%}
41
+ {%- endif %}
42
+ {% include sidebar.html blocks="sidebar_api" toc=toc %}
32
43
  </div>
data/_layouts/page.html CHANGED
@@ -1,5 +1,11 @@
1
1
  ---
2
2
  layout: wrapper
3
+
4
+ # Parameters:
5
+ #
6
+ # - amethyst.hero: boolean. Set to false to render page title without hero. Default: true.
7
+ # - amethyst.toc: boolean. Set to true to add sidebar with table of contents. Default: false.
8
+ #
3
9
  ---
4
10
 
5
11
  {%- unless page.amethyst.hero == false %}
@@ -9,9 +15,23 @@ layout: wrapper
9
15
  </div>
10
16
  </section>
11
17
  {% endunless -%}
18
+
19
+ {%- if page.amethyst.toc -%}
20
+ <div class="main main--columns wrapper">
21
+ <div class="content">
22
+ {%- else -%}
12
23
  <div class="main wrapper content">
24
+ {%- endif -%}
25
+
13
26
  {%- if page.amethyst.hero == false -%}
14
- <h1>{{ page.title }}</h1>
27
+ <h1>{{ page.title }}</h1>
15
28
  {%- endif -%}
16
- {{ content }}
29
+ {{ content }}
30
+
31
+ {%- if page.amethyst.toc -%}
32
+ </div>
33
+ {% include sidebar.html toc=true %}
17
34
  </div>
35
+ {%- else -%}
36
+ </div>
37
+ {%- endif -%}
data/_layouts/post.html CHANGED
@@ -3,7 +3,6 @@ layout: wrapper
3
3
  ---
4
4
 
5
5
  <div class="main main--columns wrapper">
6
- {% include sidebar.html blocks="sidebar_blog" %}
7
6
  <div class="content">
8
7
  <article class="content">
9
8
  <header>
@@ -34,4 +33,5 @@ Docs: <https://en.gravatar.com/site/implement/images/>
34
33
  </div>
35
34
  {%- endif -%}
36
35
  </div>
36
+ {% include sidebar.html blocks="sidebar_blog" %}
37
37
  </div>
@@ -3,7 +3,6 @@ layout: wrapper
3
3
  ---
4
4
 
5
5
  <div class="main main--columns wrapper">
6
- {% include sidebar.html blocks="sidebar_blog" %}
7
6
  {%- assign date_format = site.amethyst.date_format | default: "%e %B %Y" -%}
8
7
  {%- assign posts = site.posts -%}
9
8
  <div class="posts content">
@@ -14,4 +13,5 @@ layout: wrapper
14
13
  {%- endfor -%}
15
14
  </ul>
16
15
  </div>
16
+ {% include sidebar.html blocks="sidebar_blog" %}
17
17
  </div>
@@ -3,7 +3,6 @@ layout: wrapper
3
3
  ---
4
4
 
5
5
  <div class="main main--columns wrapper">
6
- {% include sidebar.html blocks="sidebar_blog" %}
7
6
  {%- assign date_format = site.amethyst.date_format | default: "%e %B %Y" -%}
8
7
  {%- assign posts = site.posts | where: 'author', page.author -%}
9
8
  <div class="posts content">
@@ -18,4 +17,5 @@ layout: wrapper
18
17
  </div>
19
18
  {%- endfor -%}
20
19
  </div>
20
+ {% include sidebar.html blocks="sidebar_blog" %}
21
21
  </div>
@@ -3,7 +3,6 @@ layout: wrapper
3
3
  ---
4
4
 
5
5
  <div class="main main--columns wrapper">
6
- {% include sidebar.html blocks="sidebar_blog" %}
7
6
  {%- assign date_format = site.amethyst.date_format | default: "%e %B %Y" -%}
8
7
  {%- assign posts = site.tags[page.tag] -%}
9
8
  <div class="posts content">
@@ -21,4 +20,5 @@ layout: wrapper
21
20
  </div>
22
21
  {%- endfor -%}
23
22
  </div>
23
+ {% include sidebar.html blocks="sidebar_blog" %}
24
24
  </div>
@@ -3,7 +3,6 @@ layout: wrapper
3
3
  ---
4
4
 
5
5
  <div class="main main--columns wrapper">
6
- {% include sidebar.html blocks="sidebar_blog" %}
7
6
  {%- assign date_format = site.amethyst.date_format | default: "%e %B %Y" -%}
8
7
  {%- assign posts = page.posts -%}
9
8
  <div class="posts content">
@@ -21,4 +20,5 @@ layout: wrapper
21
20
  </div>
22
21
  {%- endfor -%}
23
22
  </div>
23
+ {% include sidebar.html blocks="sidebar_blog" %}
24
24
  </div>
data/_layouts/posts.html CHANGED
@@ -3,7 +3,6 @@ layout: wrapper
3
3
  ---
4
4
 
5
5
  <div class="main main--columns wrapper">
6
- {% include sidebar.html blocks="sidebar_blog" %}
7
6
  {%- assign date_format = site.amethyst.date_format | default: "%e %B %Y" -%}
8
7
  {%- assign posts = site.posts | slice: 0, 10 -%}
9
8
  <div class="posts content">
@@ -25,4 +24,5 @@ layout: wrapper
25
24
  <a href="{{ archive_page.url | relative_url }}">Older posts</a>
26
25
  {%- endif -%}
27
26
  </div>
27
+ {% include sidebar.html blocks="sidebar_blog" %}
28
28
  </div>
@@ -21,13 +21,15 @@
21
21
  <nav class="site-nav"><ul class="site-nav-list">
22
22
  {%- for item in site.data.sitenav -%}
23
23
  <li class="site-nav-item{%- if item.sub %} has-sub-list{% endif %}">
24
- <a class="site-nav-link{%- if item.sub %} has-sub-list{% endif %}" href="{{ item.href | relative_url | escape }}">{{ item.name }}</a>
25
24
  {%- if item.sub -%}
25
+ <span class="site-nav-link has-sub-list" tabindex="0">{{ item.name | escape }}</span>
26
26
  <ul class="site-nav-sub-list">
27
27
  {%- for sub in item.sub -%}
28
28
  <li><a class="site-sub-nav-link" href="{{ sub.href | relative_url | escape }}">{{ sub.name | escape }}</a></li>
29
29
  {%- endfor -%}
30
30
  </ul>
31
+ {%- elsif item.href -%}
32
+ <a class="site-nav-link" href="{{ item.href | relative_url | escape }}">{{ item.name | escape }}</a>
31
33
  {%- endif -%}
32
34
  </li>
33
35
  {%- endfor -%}
@@ -104,29 +106,5 @@
104
106
  {%- if site.amethyst.algolia.search_only_api_key -%}
105
107
  {%- include search-js.html -%}
106
108
  {%- endif -%}
107
- <script type="module">
108
- window.addEventListener('DOMContentLoaded', function setupSubNav() {
109
- const siteNav = document.querySelector('.site-nav-list');
110
- const closeSubNav = () => {
111
- const prevSub = siteNav.querySelector('.is-open');
112
- if (prevSub) {
113
- prevSub.classList.remove('is-open');
114
- }
115
- }
116
- siteNav.addEventListener('click', (event) => {
117
- if (event.target.classList.contains('has-sub-list')) {
118
- event.preventDefault();
119
- event.stopPropagation();
120
-
121
- if (event.target.parentNode.classList.contains('is-open')) {
122
- closeSubNav();
123
- } else {
124
- closeSubNav();
125
- event.target.parentNode.classList.add('is-open');
126
- }
127
- }
128
- });
129
- });
130
- </script>
131
109
  </body>
132
110
  </html>
data/_sass/amethyst.scss CHANGED
@@ -160,6 +160,7 @@ iframe {
160
160
  min-width: 0;
161
161
  }
162
162
  .sidebar {
163
+ order: -1;
163
164
  display: block;
164
165
  flex: 0 0 220px;
165
166
  margin-right: 20px;
@@ -367,6 +368,7 @@ table {
367
368
  height: 100%;
368
369
  padding: $size-1;
369
370
  text-decoration: none;
371
+ cursor: pointer; // For non-link <span> with sub list
370
372
 
371
373
  @media (min-width: $screen-m) {
372
374
  color: $color-bright;
@@ -413,7 +415,21 @@ table {
413
415
  }
414
416
  }
415
417
 
416
- .site-nav-item.is-open .site-nav-sub-list {
418
+ // Modern browsers support focus-within.
419
+ // Open menu on clicking the entry link, and stay open until
420
+ // a click outside the menu or a click on a different menu.
421
+ // Specifically, when using accessibility tools to focus links
422
+ // in the submenu (thus not focussing the entry link any more),
423
+ // the menu must stay open.
424
+ .site-nav-item:focus-within .site-nav-sub-list {
425
+ display: block;
426
+ }
427
+ // In older browsers, fall back to opening on click,
428
+ // and trying to stay open so long as the cursor is within the menu.
429
+ // This must be a separate selector block.
430
+ // <https://css-tricks.com/solved-with-css-dropdown-menus/>
431
+ .site-nav-link:focus ~ .site-nav-sub-list,
432
+ .site-nav-sub-list:hover {
417
433
  display: block;
418
434
  }
419
435
 
@@ -694,6 +710,10 @@ table {
694
710
  padding-left: 4px;
695
711
  }
696
712
 
713
+ .sidebar hr {
714
+ margin-bottom: $size-spacing;
715
+ }
716
+
697
717
  .sidebar-list {
698
718
  margin-top: 0;
699
719
  padding: 0;
@@ -724,6 +744,31 @@ table {
724
744
  text-decoration: none;
725
745
  }
726
746
 
747
+ .toc-wrapper {
748
+ position: sticky;
749
+ top: 0;
750
+ }
751
+ .toc,
752
+ .toc ol {
753
+ list-style-type: none;
754
+ margin: 0;
755
+ padding: 0;
756
+ }
757
+ .toc .sidebar-item,
758
+ .toc .sidebar-item a {
759
+ border-left: 0;
760
+ }
761
+
762
+ // .toc,
763
+ // .toc ol {
764
+ // counter-reset: section;
765
+ // }
766
+ // .toc li:before {
767
+ // counter-increment: section;
768
+ // // Combine with any parent section(s), separated by dot
769
+ // // content: counters(section, ".") ". ";
770
+ // }
771
+
727
772
  /* Layout: page */
728
773
 
729
774
  .hero {
data/amethyst.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = "jekyll-theme-amethyst"
3
- spec.version = "0.2.0"
3
+ spec.version = "0.4.0"
4
4
  spec.summary = "https://github.com/qunitjs/jekyll-theme-amethyst"
5
5
  spec.authors = ["Timo Tijhof", "Trent Willis"]
6
6
  spec.files = `git ls-files -z`.split("\x0")
data/api/foo/baz.md CHANGED
@@ -16,11 +16,9 @@ Hello world. This entry has some content and an added version.
16
16
  | `label` (string) | Label for this object. |
17
17
 
18
18
 
19
- ## Description
20
-
21
19
  A long long sequence of words that continues until its end eventually wraps across to the next line on your screen.
22
20
 
23
- ### Changelog
21
+ ## Changelog
24
22
 
25
23
  | [Xample 2.4](https://github.com/qunitjs/qunit/releases/tag/2.4.0) | The `module.only()`, `module.skip()`, and `module.todo()` aliases were introduced.
26
24
  | [Xample 2.0](https://github.com/qunitjs/qunit/releases/tag/2.0.0) | The `before` and `after` options were introduced.
data/docs/config.md CHANGED
@@ -17,6 +17,7 @@ timezone: UTC
17
17
  # Amethyst theme options are documented at:
18
18
  # https://github.com/qunitjs/jekyll-theme-amethyst/blob/main/docs/config.md
19
19
  #
20
+ theme: jekyll-theme-amethyst
20
21
  amethyst:
21
22
  # Default: "/favicon.svg"
22
23
  favicon:
data/intro.md CHANGED
@@ -1,6 +1,8 @@
1
1
  ---
2
2
  layout: page
3
3
  title: Getting Started
4
+ amethyst:
5
+ toc: true
4
6
  ---
5
7
 
6
8
  <p class="lead" markdown="1">The following guide will get you up-and-running in just a few minutes.</p>
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-theme-amethyst
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Timo Tijhof
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2021-09-06 00:00:00.000000000 Z
12
+ date: 2021-09-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: jekyll
@@ -138,6 +138,7 @@ files:
138
138
  - _includes/search-js.html
139
139
  - _includes/search.html
140
140
  - _includes/sidebar.html
141
+ - _includes/toc.html
141
142
  - _includes/version.html
142
143
  - _layouts/group.html
143
144
  - _layouts/home.html
@@ -189,7 +190,6 @@ files:
189
190
  - docs/config.md
190
191
  - docs/getting-started.md
191
192
  - favicon.svg
192
- - guides.md
193
193
  - index.md
194
194
  - intro.md
195
195
  - lib/jekyll-theme-amethyst.rb
data/guides.md DELETED
@@ -1,11 +0,0 @@
1
- ---
2
- layout: page
3
- title: Guides
4
- ---
5
-
6
- <p class="lead">The following guides are here to help you.</p>
7
-
8
- ## [Getting Started](./intro.md)
9
-
10
- A guided introduction. If you've never before, or need a refresher on the basics, this is for you.
11
-