just-the-docs-peter 0.1.0 → 0.1.1
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 +4 -4
- data/CHANGELOG.md +1508 -0
- data/LICENSE.txt +21 -0
- data/README.md +110 -0
- data/Rakefile +1 -0
- data/_includes/components/aux_nav.html +15 -0
- data/_includes/components/breadcrumbs.html +43 -0
- data/_includes/components/children_nav.html +33 -0
- data/_includes/components/footer.html +34 -0
- data/_includes/components/header.html +11 -0
- data/_includes/components/mermaid.html +45 -0
- data/_includes/components/search_footer.html +7 -0
- data/_includes/components/search_header.html +9 -0
- data/_includes/components/sidebar.html +71 -0
- data/_includes/css/callouts.scss.liquid +93 -0
- data/_includes/css/custom.scss.liquid +1 -0
- data/_includes/css/just-the-docs.scss.liquid +12 -0
- data/_includes/fix_linenos.html +65 -0
- data/_includes/footer_custom.html +3 -0
- data/_includes/head.html +42 -0
- data/_includes/head_custom.html +0 -0
- data/_includes/header_custom.html +0 -0
- data/_includes/icons/code_copy.html +15 -0
- data/_includes/icons/document.html +6 -0
- data/_includes/icons/expand.html +6 -0
- data/_includes/icons/external_link.html +5 -0
- data/_includes/icons/icons.html +13 -0
- data/_includes/icons/link.html +6 -0
- data/_includes/icons/menu.html +6 -0
- data/_includes/icons/search.html +6 -0
- data/_includes/js/custom.js +0 -0
- data/_includes/lunr/custom-data.json +0 -0
- data/_includes/lunr/custom-index.js +0 -0
- data/_includes/mermaid_config.js +1 -0
- data/_includes/nav.html +106 -0
- data/_includes/nav_footer_custom.html +0 -0
- data/_includes/search_placeholder_custom.html +1 -0
- data/_includes/sorted_pages.html +95 -0
- data/_includes/title.html +5 -0
- data/_includes/toc_heading_custom.html +1 -0
- data/_includes/vendor/anchor_headings.html +172 -0
- data/_layouts/about.html +5 -0
- data/_layouts/default.html +41 -0
- data/_layouts/home.html +5 -0
- data/_layouts/minimal.html +34 -0
- data/_layouts/page.html +5 -0
- data/_layouts/post.html +5 -0
- data/_layouts/table_wrappers.html +7 -0
- data/_layouts/vendor/compress.html +10 -0
- data/_sass/base.scss +109 -0
- data/_sass/buttons.scss +123 -0
- data/_sass/code.scss +246 -0
- data/_sass/color_schemes/dark.scss +17 -0
- data/_sass/color_schemes/legacy_light.scss +208 -0
- data/_sass/color_schemes/light.scss +15 -0
- data/_sass/color_schemes/light_peter.scss +15 -0
- data/_sass/content.scss +239 -0
- data/_sass/custom/custom.scss +1 -0
- data/_sass/custom/setup.scss +1 -0
- data/_sass/labels.scss +33 -0
- data/_sass/layout.scss +209 -0
- data/_sass/modules.scss +17 -0
- data/_sass/navigation.scss +235 -0
- data/_sass/print.scss +40 -0
- data/_sass/search.scss +311 -0
- data/_sass/skiptomain.scss +30 -0
- data/_sass/support/_variables.scss +116 -0
- data/_sass/support/mixins/_buttons.scss +27 -0
- data/_sass/support/mixins/_layout.scss +33 -0
- data/_sass/support/mixins/_typography.scss +84 -0
- data/_sass/support/mixins/mixins.scss +3 -0
- data/_sass/support/support.scss +2 -0
- data/_sass/tables.scss +54 -0
- data/_sass/typography.scss +63 -0
- data/_sass/utilities/_colors.scss +237 -0
- data/_sass/utilities/_layout.scss +101 -0
- data/_sass/utilities/_lists.scss +15 -0
- data/_sass/utilities/_spacing.scss +162 -0
- data/_sass/utilities/_typography.scss +85 -0
- data/_sass/utilities/utilities.scss +5 -0
- data/_sass/vendor/OneDarkJekyll/LICENSE +21 -0
- data/_sass/vendor/OneDarkJekyll/syntax.scss +202 -0
- data/_sass/vendor/OneLightJekyll/LICENSE +65 -0
- data/_sass/vendor/OneLightJekyll/syntax.scss +208 -0
- data/_sass/vendor/normalize.scss/README.md +7 -0
- data/_sass/vendor/normalize.scss/normalize.scss +351 -0
- data/assets/css/just-the-docs-dark.scss +3 -0
- data/assets/css/just-the-docs-default.scss +8 -0
- data/assets/css/just-the-docs-light.scss +3 -0
- data/assets/js/just-the-docs.js +535 -0
- data/assets/js/vendor/lunr.min.js +61 -0
- data/assets/js/zzzz-search-data.json +74 -0
- data/bin/just-the-docs +16 -0
- data/favicon.ico +0 -0
- data/lib/tasks/search.rake +88 -0
- metadata +152 -11
@@ -0,0 +1,6 @@
|
|
1
|
+
<symbol id="svg-doc" viewBox="0 0 24 24">
|
2
|
+
<title>Document</title>
|
3
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-file">
|
4
|
+
<path d="M13 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V9z"></path><polyline points="13 2 13 9 20 9"></polyline>
|
5
|
+
</svg>
|
6
|
+
</symbol>
|
@@ -0,0 +1,6 @@
|
|
1
|
+
<symbol id="svg-arrow-right" viewBox="0 0 24 24">
|
2
|
+
<title>Expand</title>
|
3
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-chevron-right">
|
4
|
+
<polyline points="9 18 15 12 9 6"></polyline>
|
5
|
+
</svg>
|
6
|
+
</symbol>
|
@@ -0,0 +1,5 @@
|
|
1
|
+
<!-- Feather. MIT License: https://github.com/feathericons/feather/blob/master/LICENSE -->
|
2
|
+
<symbol id="svg-external-link" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-external-link">
|
3
|
+
<title id="svg-external-link-title">(external link)</title>
|
4
|
+
<path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"></path><polyline points="15 3 21 3 21 9"></polyline><line x1="10" y1="14" x2="21" y2="3"></line>
|
5
|
+
</symbol>
|
@@ -0,0 +1,13 @@
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" class="d-none">
|
2
|
+
{% include icons/link.html %}
|
3
|
+
{% include icons/menu.html %}
|
4
|
+
{% include icons/expand.html %}
|
5
|
+
{% include icons/external_link.html %}
|
6
|
+
{% if site.search_enabled != false %}
|
7
|
+
{% include icons/document.html %}
|
8
|
+
{% include icons/search.html %}
|
9
|
+
{% endif %}
|
10
|
+
{% if site.enable_copy_code_button != false %}
|
11
|
+
{% include icons/code_copy.html %}
|
12
|
+
{% endif %}
|
13
|
+
</svg>
|
@@ -0,0 +1,6 @@
|
|
1
|
+
<symbol id="svg-link" viewBox="0 0 24 24">
|
2
|
+
<title>Link</title>
|
3
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-link">
|
4
|
+
<path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path>
|
5
|
+
</svg>
|
6
|
+
</symbol>
|
@@ -0,0 +1,6 @@
|
|
1
|
+
<symbol id="svg-menu" viewBox="0 0 24 24">
|
2
|
+
<title>Menu</title>
|
3
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-menu">
|
4
|
+
<line x1="3" y1="12" x2="21" y2="12"></line><line x1="3" y1="6" x2="21" y2="6"></line><line x1="3" y1="18" x2="21" y2="18"></line>
|
5
|
+
</svg>
|
6
|
+
</symbol>
|
@@ -0,0 +1,6 @@
|
|
1
|
+
<symbol id="svg-search" viewBox="0 0 24 24">
|
2
|
+
<title>Search</title>
|
3
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-search">
|
4
|
+
<circle cx="11" cy="11" r="8"></circle><line x1="21" y1="21" x2="16.65" y2="16.65"></line>
|
5
|
+
</svg>
|
6
|
+
</symbol>
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
{}
|
data/_includes/nav.html
ADDED
@@ -0,0 +1,106 @@
|
|
1
|
+
{%- comment -%}
|
2
|
+
Include as: {%- include nav.html pages = pages key = key -%}
|
3
|
+
Depends on: include.pages, include.key, page, site.
|
4
|
+
Results in: HTML for the navigation panel.
|
5
|
+
Includes:
|
6
|
+
sorted_pages.html
|
7
|
+
Overwrites:
|
8
|
+
nav_pages, first_level_pages, second_level_pages, third_level_pages,
|
9
|
+
node, children_list, child, grand_children_list, grand_child.
|
10
|
+
{%- endcomment -%}
|
11
|
+
|
12
|
+
{%- assign nav_pages = include.pages
|
13
|
+
| where_exp: "item", "item.title != nil"
|
14
|
+
| where_exp: "item", "item.nav_exclude != true" -%}
|
15
|
+
|
16
|
+
{%- include sorted_pages.html pages = nav_pages -%}
|
17
|
+
|
18
|
+
{%- assign first_level_pages = sorted_pages
|
19
|
+
| where_exp: "item", "item.parent == nil" -%}
|
20
|
+
{%- assign second_level_pages = sorted_pages
|
21
|
+
| where_exp: "item", "item.parent != nil"
|
22
|
+
| where_exp: "item", "item.grand_parent == nil" -%}
|
23
|
+
{%- assign third_level_pages = sorted_pages
|
24
|
+
| where_exp: "item", "item.grand_parent != nil" -%}
|
25
|
+
|
26
|
+
{%- comment -%}
|
27
|
+
The order of sibling pages in `sorted_pages` determines the order of display of
|
28
|
+
links to them in lists of navigation links.
|
29
|
+
|
30
|
+
Note that Liquid evaluates conditions from right to left (and it does not allow
|
31
|
+
the use of parentheses). Some conditions are not so easy to express clearly...
|
32
|
+
|
33
|
+
For example, consider the following condition:
|
34
|
+
|
35
|
+
C: page.collection = = include.key and
|
36
|
+
page.url = = node.url or
|
37
|
+
page.grand_parent = = node.title or
|
38
|
+
page.parent = = node.title and
|
39
|
+
page.grand_parent = = nil
|
40
|
+
|
41
|
+
Here, `node` is a first-level page. The last part of the condition
|
42
|
+
-- namely: `page.parent = = node.title and page.grand_parent = = nil` --
|
43
|
+
is evaluated first; it holds if and only if `page` is a child of `node`.
|
44
|
+
|
45
|
+
The condition `page.grand_parent = = node.title or ...` holds when
|
46
|
+
`page` is a grandchild of node, OR `...` holds.
|
47
|
+
|
48
|
+
The condition `page.url = = node.url or ...` holds when
|
49
|
+
`page` is `node`, OR `...` holds.
|
50
|
+
|
51
|
+
The condition C: `page.collection = = include.key and ...` holds when we are
|
52
|
+
generating the nav links for a collection that includes `page`, AND `...` holds.
|
53
|
+
{%- endcomment -%}
|
54
|
+
|
55
|
+
<ul class="nav-list">
|
56
|
+
{%- for node in first_level_pages -%}
|
57
|
+
{%- unless node.nav_exclude -%}
|
58
|
+
<li class="nav-list-item{% if page.collection == include.key and page.url == node.url or page.grand_parent == node.title or page.parent == node.title and page.grand_parent == nil %} active{% endif %}">
|
59
|
+
{%- if node.has_children -%}
|
60
|
+
<button class="nav-list-expander btn-reset" aria-label="toggle items in {{ node.title }} category" aria-pressed="{% if page.collection == include.key and page.url == node.url or page.grand_parent == node.title or page.parent == node.title and page.grand_parent == nil %}true{% else %}false{% endif %}">
|
61
|
+
<svg viewBox="0 0 24 24" aria-hidden="true"><use xlink:href="#svg-arrow-right"></use></svg>
|
62
|
+
</button>
|
63
|
+
{%- endif -%}
|
64
|
+
<a href="{{ node.url | relative_url }}" class="nav-list-link{% if page.url == node.url %} active{% endif %}">{{ node.title }}</a>
|
65
|
+
{%- if node.has_children -%}
|
66
|
+
{%- assign children_list = second_level_pages
|
67
|
+
| where: "parent", node.title -%}
|
68
|
+
{%- if node.child_nav_order == 'desc' or node.child_nav_order == 'reversed' -%}
|
69
|
+
{%- assign children_list = children_list | reverse -%}
|
70
|
+
{%- endif -%}
|
71
|
+
<ul class="nav-list">
|
72
|
+
{%- for child in children_list -%}
|
73
|
+
{%- unless child.nav_exclude -%}
|
74
|
+
<li class="nav-list-item {% if page.url == child.url or page.parent == child.title %} active{% endif %}">
|
75
|
+
{%- if child.has_children -%}
|
76
|
+
<button class="nav-list-expander btn-reset" aria-label="toggle items in {{ child.title }} category" aria-pressed="{% if page.url == child.url or page.parent == child.title %}true{% else %}false{% endif %}">
|
77
|
+
<svg viewBox="0 0 24 24" aria-hidden="true"><use xlink:href="#svg-arrow-right"></use></svg>
|
78
|
+
</button>
|
79
|
+
{%- endif -%}
|
80
|
+
<a href="{{ child.url | relative_url }}" class="nav-list-link{% if page.url == child.url %} active{% endif %}">{{ child.title }}</a>
|
81
|
+
{%- if child.has_children -%}
|
82
|
+
{%- assign grand_children_list = third_level_pages
|
83
|
+
| where: "parent", child.title
|
84
|
+
| where: "grand_parent", node.title -%}
|
85
|
+
{%- if child.child_nav_order == 'desc' or child.child_nav_order == 'reversed' -%}
|
86
|
+
{%- assign grand_children_list = grand_children_list | reverse -%}
|
87
|
+
{%- endif -%}
|
88
|
+
<ul class="nav-list">
|
89
|
+
{%- for grand_child in grand_children_list -%}
|
90
|
+
{%- unless grand_child.nav_exclude -%}
|
91
|
+
<li class="nav-list-item {% if page.url == grand_child.url %} active{% endif %}">
|
92
|
+
<a href="{{ grand_child.url | relative_url }}" class="nav-list-link{% if page.url == grand_child.url %} active{% endif %}">{{ grand_child.title }}</a>
|
93
|
+
</li>
|
94
|
+
{%- endunless -%}
|
95
|
+
{%- endfor -%}
|
96
|
+
</ul>
|
97
|
+
{%- endif -%}
|
98
|
+
</li>
|
99
|
+
{%- endunless -%}
|
100
|
+
{%- endfor -%}
|
101
|
+
</ul>
|
102
|
+
{%- endif -%}
|
103
|
+
</li>
|
104
|
+
{%- endunless -%}
|
105
|
+
{%- endfor -%}
|
106
|
+
</ul>
|
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
Search {{site.title}}
|
@@ -0,0 +1,95 @@
|
|
1
|
+
{%- comment -%}
|
2
|
+
Include as: {%- include sorted_pages.html pages = pages -%}
|
3
|
+
Depends on: include.pages.
|
4
|
+
Assigns to: sorted_pages.
|
5
|
+
Overwrites:
|
6
|
+
nav_order_pages, title_order_pages,
|
7
|
+
nav_number_pages, nav_string_pages, nav_order_groups, group,
|
8
|
+
title_number_pages, title_string_pages, title_order_groups.
|
9
|
+
{%- endcomment -%}
|
10
|
+
|
11
|
+
{%- comment -%}
|
12
|
+
The `nav_order` values of pages affect the order in which they are shown in
|
13
|
+
the navigation panel and in the automatically generated tables of contents.
|
14
|
+
Sibling pages with the same `nav_order` value may be shown in any order.
|
15
|
+
Sibling pages with no `nav_order` value are shown after all pages that have
|
16
|
+
explicit `nav_order` values, ordered by their `title` values.
|
17
|
+
|
18
|
+
The `nav_order` and `title` values can be numbers or strings. To avoid build
|
19
|
+
failures, we sort numbers and strings separately. We sort numbers by their
|
20
|
+
values, and strings lexicographically. The case-sensitivity of string sorting
|
21
|
+
is determined by the configuration setting of `nav_sort`. Pages with no `title`
|
22
|
+
value are excluded from the navigation.
|
23
|
+
|
24
|
+
Note: Numbers used as `title` or `nav_order` values should not be in quotes,
|
25
|
+
unless you intend them to be lexicographically ordered. Numbers are written
|
26
|
+
without spaces or thousands-separators. Negative numbers are preceded by `-`.
|
27
|
+
Floats are written with the integral and fractional parts separated by `.`.
|
28
|
+
(Bounds on the magnitude and precision are presumably the same as in Liquid.)
|
29
|
+
{%- endcomment -%}
|
30
|
+
|
31
|
+
{%- assign nav_order_pages = include.pages
|
32
|
+
| where_exp: "item", "item.nav_order != nil" -%}
|
33
|
+
{%- assign title_order_pages = include.pages
|
34
|
+
| where_exp: "item", "item.nav_order == nil" -%}
|
35
|
+
|
36
|
+
{%- comment -%}
|
37
|
+
Divide the arrays of `nav_order_pages` and `title_order_pages` according to
|
38
|
+
the type of value.
|
39
|
+
|
40
|
+
The first character of the result of `jsonify` is `"` only for strings.
|
41
|
+
Grouping by a single character also ensures the number of groups is small.
|
42
|
+
{%- endcomment -%}
|
43
|
+
|
44
|
+
{%- assign nav_number_pages = "" | split: "" -%}
|
45
|
+
{%- assign nav_string_pages = "" | split: "" -%}
|
46
|
+
{%- assign nav_order_groups = nav_order_pages
|
47
|
+
| group_by_exp: "item", "item.nav_order | jsonify | slice: 0" -%}
|
48
|
+
{%- for group in nav_order_groups -%}
|
49
|
+
{%- if group.name == '"' -%}
|
50
|
+
{%- assign nav_string_pages = group.items -%}
|
51
|
+
{%- else -%}
|
52
|
+
{%- assign nav_number_pages = nav_number_pages | concat: group.items -%}
|
53
|
+
{%- endif -%}
|
54
|
+
{%- endfor -%}
|
55
|
+
|
56
|
+
{%- unless nav_number_pages == empty -%}
|
57
|
+
{%- assign nav_number_pages = nav_number_pages | sort: "nav_order" -%}
|
58
|
+
{%- endunless -%}
|
59
|
+
|
60
|
+
{%- unless nav_string_pages == empty -%}
|
61
|
+
{%- if site.nav_sort == 'case_insensitive' -%}
|
62
|
+
{%- assign nav_string_pages = nav_string_pages | sort_natural: "nav_order" -%}
|
63
|
+
{%- else -%}
|
64
|
+
{%- assign nav_string_pages = nav_string_pages | sort: "nav_order" -%}
|
65
|
+
{%- endif -%}
|
66
|
+
{%- endunless -%}
|
67
|
+
|
68
|
+
{%- assign title_number_pages = "" | split: "" -%}
|
69
|
+
{%- assign title_string_pages = "" | split: "" -%}
|
70
|
+
{%- assign title_order_groups = title_order_pages
|
71
|
+
| group_by_exp: "item", "item.title | jsonify | slice: 0" -%}
|
72
|
+
{%- for group in title_order_groups -%}
|
73
|
+
{%- if group.name == '"' -%}
|
74
|
+
{%- assign title_string_pages = group.items -%}
|
75
|
+
{%- else -%}
|
76
|
+
{%- assign title_number_pages = title_number_pages | concat: group.items -%}
|
77
|
+
{%- endif -%}
|
78
|
+
{%- endfor -%}
|
79
|
+
|
80
|
+
{%- unless title_number_pages == empty -%}
|
81
|
+
{%- assign title_number_pages = title_number_pages | sort: "title" -%}
|
82
|
+
{%- endunless -%}
|
83
|
+
|
84
|
+
{%- unless title_string_pages == empty -%}
|
85
|
+
{%- if site.nav_sort == 'case_insensitive' -%}
|
86
|
+
{%- assign title_string_pages = title_string_pages | sort_natural: "title" -%}
|
87
|
+
{%- else -%}
|
88
|
+
{%- assign title_string_pages = title_string_pages | sort: "title" -%}
|
89
|
+
{%- endif -%}
|
90
|
+
{%- endunless -%}
|
91
|
+
|
92
|
+
{%- assign sorted_pages = nav_number_pages
|
93
|
+
| concat: nav_string_pages
|
94
|
+
| concat: title_number_pages
|
95
|
+
| concat: title_string_pages -%}
|
@@ -0,0 +1 @@
|
|
1
|
+
<h2 class="text-delta">Table of contents</h2>
|
@@ -0,0 +1,172 @@
|
|
1
|
+
{% capture headingsWorkspace %}
|
2
|
+
{% comment %}
|
3
|
+
Copyright (c) 2018 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.0.12
|
28
|
+
https://github.com/allejo/jekyll-anchor-headings
|
29
|
+
|
30
|
+
"Be the pull request you wish to see in the world." ~Ben Balter
|
31
|
+
|
32
|
+
Usage:
|
33
|
+
{% include anchor_headings.html html=content anchorBody="#" %}
|
34
|
+
|
35
|
+
Parameters:
|
36
|
+
* html (string) - the HTML of compiled markdown generated by kramdown in Jekyll
|
37
|
+
|
38
|
+
Optional Parameters:
|
39
|
+
* beforeHeading (bool) : false - Set to true if the anchor should be placed _before_ the heading's content
|
40
|
+
* headerAttrs (string) : '' - Any custom HTML attributes that will be added to the heading tag; you may NOT use `id`;
|
41
|
+
the `%heading%` and `%html_id%` placeholders are available
|
42
|
+
* anchorAttrs (string) : '' - Any custom HTML attributes that will be added to the `<a>` tag; you may NOT use `href`, `class` or `title`;
|
43
|
+
the `%heading%` and `%html_id%` placeholders are available
|
44
|
+
* anchorBody (string) : '' - The content that will be placed inside the anchor; the `%heading%` placeholder is available
|
45
|
+
* anchorClass (string) : '' - The class(es) that will be used for each anchor. Separate multiple classes with a space
|
46
|
+
* anchorTitle (string) : '' - The `title` attribute that will be used for anchors
|
47
|
+
* h_min (int) : 1 - The minimum header level to build an anchor for; any header lower than this value will be ignored
|
48
|
+
* h_max (int) : 6 - The maximum header level to build an anchor for; any header greater than this value will be ignored
|
49
|
+
* bodyPrefix (string) : '' - Anything that should be inserted inside of the heading tag _before_ its anchor and content
|
50
|
+
* bodySuffix (string) : '' - Anything that should be inserted inside of the heading tag _after_ its anchor and content
|
51
|
+
* generateId (true) : false - Set to true if a header without id should generate an id to use.
|
52
|
+
|
53
|
+
Output:
|
54
|
+
The original HTML with the addition of anchors inside of all of the h1-h6 headings.
|
55
|
+
{% endcomment %}
|
56
|
+
|
57
|
+
{% assign minHeader = include.h_min | default: 1 %}
|
58
|
+
{% assign maxHeader = include.h_max | default: 6 %}
|
59
|
+
{% assign beforeHeading = include.beforeHeading %}
|
60
|
+
{% assign headerAttrs = include.headerAttrs %}
|
61
|
+
{% assign nodes = include.html | split: '<h' %}
|
62
|
+
|
63
|
+
{% capture edited_headings %}{% endcapture %}
|
64
|
+
|
65
|
+
{% for _node in nodes %}
|
66
|
+
{% capture node %}{{ _node | strip }}{% endcapture %}
|
67
|
+
|
68
|
+
{% if node == "" %}
|
69
|
+
{% continue %}
|
70
|
+
{% endif %}
|
71
|
+
|
72
|
+
{% assign nextChar = node | replace: '"', '' | strip | slice: 0, 1 %}
|
73
|
+
{% assign headerLevel = nextChar | times: 1 %}
|
74
|
+
|
75
|
+
<!-- If the level is cast to 0, it means it's not a h1-h6 tag, so let's see if we need to fix it -->
|
76
|
+
{% if headerLevel == 0 %}
|
77
|
+
<!-- Split up the node based on closing angle brackets and get the first one. -->
|
78
|
+
{% assign firstChunk = node | split: '>' | first %}
|
79
|
+
|
80
|
+
<!-- If the first chunk does NOT contain a '<', that means we've broken another HTML tag that starts with 'h' -->
|
81
|
+
{% unless firstChunk contains '<' %}
|
82
|
+
{% capture node %}<h{{ node }}{% endcapture %}
|
83
|
+
{% endunless %}
|
84
|
+
|
85
|
+
{% capture edited_headings %}{{ edited_headings }}{{ node }}{% endcapture %}
|
86
|
+
{% continue %}
|
87
|
+
{% endif %}
|
88
|
+
|
89
|
+
{% capture _closingTag %}</h{{ headerLevel }}>{% endcapture %}
|
90
|
+
{% assign _workspace = node | split: _closingTag %}
|
91
|
+
{% capture _hAttrToStrip %}{{ _workspace[0] | split: '>' | first }}>{% endcapture %}
|
92
|
+
{% assign header = _workspace[0] | replace: _hAttrToStrip, '' %}
|
93
|
+
{% assign escaped_header = header | strip_html | strip %}
|
94
|
+
|
95
|
+
{% assign _classWorkspace = _workspace[0] | split: 'class="' %}
|
96
|
+
{% assign _classWorkspace = _classWorkspace[1] | split: '"' %}
|
97
|
+
{% assign _html_class = _classWorkspace[0] %}
|
98
|
+
|
99
|
+
{% if _html_class contains "no_anchor" %}
|
100
|
+
{% assign skip_anchor = true %}
|
101
|
+
{% else %}
|
102
|
+
{% assign skip_anchor = false %}
|
103
|
+
{% endif %}
|
104
|
+
|
105
|
+
{% assign _idWorkspace = _workspace[0] | split: 'id="' %}
|
106
|
+
{% if _idWorkspace[1] %}
|
107
|
+
{% assign _idWorkspace = _idWorkspace[1] | split: '"' %}
|
108
|
+
{% assign html_id = _idWorkspace[0] %}
|
109
|
+
{% elsif include.generateId %}
|
110
|
+
<!-- If the header did not have an id we create one. -->
|
111
|
+
{% assign html_id = escaped_header | slugify %}
|
112
|
+
{% if html_id == "" %}
|
113
|
+
{% assign html_id = false %}
|
114
|
+
{% endif %}
|
115
|
+
{% capture headerAttrs %}{{ headerAttrs }} id="%html_id%"{% endcapture %}
|
116
|
+
{% endif %}
|
117
|
+
|
118
|
+
<!-- Build the anchor to inject for our heading -->
|
119
|
+
{% capture anchor %}{% endcapture %}
|
120
|
+
|
121
|
+
{% if skip_anchor == false and html_id and headerLevel >= minHeader and headerLevel <= maxHeader %}
|
122
|
+
{% if headerAttrs %}
|
123
|
+
{% capture _hAttrToStrip %}{{ _hAttrToStrip | split: '>' | first }} {{ headerAttrs | replace: '%heading%', escaped_header | replace: '%html_id%', html_id }}>{% endcapture %}
|
124
|
+
{% endif %}
|
125
|
+
|
126
|
+
{% capture anchor %}href="#{{ html_id }}"{% endcapture %}
|
127
|
+
|
128
|
+
{% if include.anchorClass %}
|
129
|
+
{% capture anchor %}{{ anchor }} class="{{ include.anchorClass }}"{% endcapture %}
|
130
|
+
{% endif %}
|
131
|
+
|
132
|
+
{% if include.anchorTitle %}
|
133
|
+
{% capture anchor %}{{ anchor }} title="{{ include.anchorTitle | replace: '%heading%', escaped_header }}"{% endcapture %}
|
134
|
+
{% endif %}
|
135
|
+
|
136
|
+
{% if include.anchorAttrs %}
|
137
|
+
{% capture anchor %}{{ anchor }} {{ include.anchorAttrs | replace: '%heading%', escaped_header | replace: '%html_id%', html_id }}{% endcapture %}
|
138
|
+
{% endif %}
|
139
|
+
|
140
|
+
{% capture anchor %}<a {{ anchor }}>{{ include.anchorBody | replace: '%heading%', escaped_header | default: '' }}</a>{% endcapture %}
|
141
|
+
|
142
|
+
<!-- In order to prevent adding extra space after a heading, we'll let the 'anchor' value contain it -->
|
143
|
+
{% if beforeHeading %}
|
144
|
+
{% capture anchor %}{{ anchor }} {% endcapture %}
|
145
|
+
{% else %}
|
146
|
+
{% capture anchor %} {{ anchor }}{% endcapture %}
|
147
|
+
{% endif %}
|
148
|
+
{% endif %}
|
149
|
+
|
150
|
+
{% capture new_heading %}
|
151
|
+
<h{{ _hAttrToStrip }}
|
152
|
+
{{ include.bodyPrefix }}
|
153
|
+
{% if beforeHeading %}
|
154
|
+
{{ anchor }}{{ header }}
|
155
|
+
{% else %}
|
156
|
+
{{ header }}{{ anchor }}
|
157
|
+
{% endif %}
|
158
|
+
{{ include.bodySuffix }}
|
159
|
+
</h{{ headerLevel }}>
|
160
|
+
{% endcapture %}
|
161
|
+
|
162
|
+
<!--
|
163
|
+
If we have content after the `</hX>` tag, then we'll want to append that here so we don't lost any content.
|
164
|
+
-->
|
165
|
+
{% assign chunkCount = _workspace | size %}
|
166
|
+
{% if chunkCount > 1 %}
|
167
|
+
{% capture new_heading %}{{ new_heading }}{{ _workspace | last }}{% endcapture %}
|
168
|
+
{% endif %}
|
169
|
+
|
170
|
+
{% capture edited_headings %}{{ edited_headings }}{{ new_heading }}{% endcapture %}
|
171
|
+
{% endfor %}
|
172
|
+
{% endcapture %}{% assign headingsWorkspace = '' %}{{ edited_headings | strip }}
|
data/_layouts/about.html
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
---
|
2
|
+
layout: table_wrappers
|
3
|
+
---
|
4
|
+
|
5
|
+
<!DOCTYPE html>
|
6
|
+
|
7
|
+
<html lang="{{ site.lang | default: 'en-US' }}">
|
8
|
+
{% include head.html %}
|
9
|
+
<body>
|
10
|
+
<a class="skip-to-main" href="#main-content">Skip to main content</a>
|
11
|
+
{% include icons/icons.html %}
|
12
|
+
{% include components/sidebar.html %}
|
13
|
+
<div class="main" id="top">
|
14
|
+
{% include components/header.html %}
|
15
|
+
<div id="main-content-wrap" class="main-content-wrap">
|
16
|
+
{% include components/breadcrumbs.html %}
|
17
|
+
<div id="main-content" class="main-content">
|
18
|
+
<main>
|
19
|
+
{% if site.heading_anchors != false %}
|
20
|
+
{% include vendor/anchor_headings.html html=content beforeHeading="true" anchorBody="<svg viewBox=\"0 0 16 16\" aria-hidden=\"true\"><use xlink:href=\"#svg-link\"></use></svg>" anchorClass="anchor-heading" anchorAttrs="aria-labelledby=\"%html_id%\"" %}
|
21
|
+
{% else %}
|
22
|
+
{{ content }}
|
23
|
+
{% endif %}
|
24
|
+
|
25
|
+
{% if page.has_children == true and page.has_toc != false %}
|
26
|
+
{% include components/children_nav.html %}
|
27
|
+
{% endif %}
|
28
|
+
</main>
|
29
|
+
{% include components/footer.html %}
|
30
|
+
</div>
|
31
|
+
</div>
|
32
|
+
{% if site.search_enabled != false %}
|
33
|
+
{% include components/search_footer.html %}
|
34
|
+
{% endif %}
|
35
|
+
</div>
|
36
|
+
|
37
|
+
{% if site.mermaid %}
|
38
|
+
{% include components/mermaid.html %}
|
39
|
+
{% endif %}
|
40
|
+
</body>
|
41
|
+
</html>
|
data/_layouts/home.html
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
---
|
2
|
+
layout: table_wrappers
|
3
|
+
---
|
4
|
+
|
5
|
+
<!DOCTYPE html>
|
6
|
+
|
7
|
+
<html lang="{{ site.lang | default: 'en-US' }}">
|
8
|
+
{% include head.html %}
|
9
|
+
<body>
|
10
|
+
<a class="skip-to-main" href="#main-content">Skip to main content</a>
|
11
|
+
{% include icons/icons.html %}
|
12
|
+
<div id="main-content-wrap" class="main-content-wrap" id="top">
|
13
|
+
{% include components/breadcrumbs.html %}
|
14
|
+
<div id="main-content" class="main-content" role="main">
|
15
|
+
{% if site.heading_anchors != false %}
|
16
|
+
{% include vendor/anchor_headings.html html=content beforeHeading="true" anchorBody="<svg viewBox=\"0 0 16 16\" aria-hidden=\"true\"><use xlink:href=\"#svg-link\"></use></svg>" anchorClass="anchor-heading" anchorAttrs="aria-labelledby=\"%html_id%\"" %}
|
17
|
+
{% else %}
|
18
|
+
{{ content }}
|
19
|
+
{% endif %}
|
20
|
+
|
21
|
+
{% if page.has_children == true and page.has_toc != false %}
|
22
|
+
{% include components/children_nav.html %}
|
23
|
+
{% endif %}
|
24
|
+
|
25
|
+
{% include components/footer.html %}
|
26
|
+
|
27
|
+
</div>
|
28
|
+
</div>
|
29
|
+
|
30
|
+
{% if site.mermaid %}
|
31
|
+
{% include components/mermaid.html %}
|
32
|
+
{% endif %}
|
33
|
+
</body>
|
34
|
+
</html>
|
data/_layouts/page.html
ADDED
data/_layouts/post.html
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
---
|
2
|
+
# Jekyll layout that compresses HTML
|
3
|
+
# v3.1.0
|
4
|
+
# http://jch.penibelst.de/
|
5
|
+
# © 2014–2015 Anatol Broder
|
6
|
+
# MIT License
|
7
|
+
---
|
8
|
+
|
9
|
+
{% capture _LINE_FEED %}
|
10
|
+
{% endcapture %}{% if site.compress_html.ignore.envs contains jekyll.environment or site.compress_html.ignore.envs == "all" %}{{ content }}{% else %}{% capture _content %}{{ content }}{% endcapture %}{% assign _profile = site.compress_html.profile %}{% if site.compress_html.endings == "all" %}{% assign _endings = "html head body li dt dd optgroup option colgroup caption thead tbody tfoot tr td th" | split: " " %}{% else %}{% assign _endings = site.compress_html.endings %}{% endif %}{% for _element in _endings %}{% capture _end %}</{{ _element }}>{% endcapture %}{% assign _content = _content | remove: _end %}{% endfor %}{% if _profile and _endings %}{% assign _profile_endings = _content | size | plus: 1 %}{% endif %}{% for _element in site.compress_html.startings %}{% capture _start %}<{{ _element }}>{% endcapture %}{% assign _content = _content | remove: _start %}{% endfor %}{% if _profile and site.compress_html.startings %}{% assign _profile_startings = _content | size | plus: 1 %}{% endif %}{% if site.compress_html.comments == "all" %}{% assign _comments = "<!-- -->" | split: " " %}{% else %}{% assign _comments = site.compress_html.comments %}{% endif %}{% if _comments.size == 2 %}{% capture _comment_befores %}.{{ _content }}{% endcapture %}{% assign _comment_befores = _comment_befores | split: _comments.first %}{% for _comment_before in _comment_befores %}{% if forloop.first %}{% continue %}{% endif %}{% capture _comment_outside %}{% if _carry %}{{ _comments.first }}{% endif %}{{ _comment_before }}{% endcapture %}{% capture _comment %}{% unless _carry %}{{ _comments.first }}{% endunless %}{{ _comment_outside | split: _comments.last | first }}{% if _comment_outside contains _comments.last %}{{ _comments.last }}{% assign _carry = false %}{% else %}{% assign _carry = true %}{% endif %}{% endcapture %}{% assign _content = _content | remove_first: _comment %}{% endfor %}{% if _profile %}{% assign _profile_comments = _content | size | plus: 1 %}{% endif %}{% endif %}{% assign _pre_befores = _content | split: "<pre" %}{% assign _content = "" %}{% for _pre_before in _pre_befores %}{% assign _pres = _pre_before | split: "</pre>" %}{% assign _pres_after = "" %}{% if _pres.size != 0 %}{% if site.compress_html.blanklines %}{% assign _lines = _pres.last | split: _LINE_FEED %}{% capture _pres_after %}{% for _line in _lines %}{% assign _trimmed = _line | split: " " | join: " " %}{% if _trimmed != empty or forloop.last %}{% unless forloop.first %}{{ _LINE_FEED }}{% endunless %}{{ _line }}{% endif %}{% endfor %}{% endcapture %}{% else %}{% assign _pres_after = _pres.last | split: " " | join: " " %}{% endif %}{% endif %}{% capture _content %}{{ _content }}{% if _pre_before contains "</pre>" %}<pre{{ _pres.first }}</pre>{% endif %}{% unless _pre_before contains "</pre>" and _pres.size == 1 %}{{ _pres_after }}{% endunless %}{% endcapture %}{% endfor %}{% if _profile %}{% assign _profile_collapse = _content | size | plus: 1 %}{% endif %}{% if site.compress_html.clippings == "all" %}{% assign _clippings = "html head title base link meta style body article section nav aside h1 h2 h3 h4 h5 h6 hgroup header footer address p hr blockquote ol ul li dl dt dd figure figcaption main div table caption colgroup col tbody thead tfoot tr td th" | split: " " %}{% else %}{% assign _clippings = site.compress_html.clippings %}{% endif %}{% for _element in _clippings %}{% assign _edges = " <e;<e; </e>;</e>;</e> ;</e>" | replace: "e", _element | split: ";" %}{% assign _content = _content | replace: _edges[0], _edges[1] | replace: _edges[2], _edges[3] | replace: _edges[4], _edges[5] %}{% endfor %}{% if _profile and _clippings %}{% assign _profile_clippings = _content | size | plus: 1 %}{% endif %}{{ _content }}{% if _profile %} <table id="compress_html_profile_{{ site.time | date: "%Y%m%d" }}" class="compress_html_profile"> <thead> <tr> <td>Step <td>Bytes <tbody> <tr> <td>raw <td>{{ content | size }}{% if _profile_endings %} <tr> <td>endings <td>{{ _profile_endings }}{% endif %}{% if _profile_startings %} <tr> <td>startings <td>{{ _profile_startings }}{% endif %}{% if _profile_comments %} <tr> <td>comments <td>{{ _profile_comments }}{% endif %}{% if _profile_collapse %} <tr> <td>collapse <td>{{ _profile_collapse }}{% endif %}{% if _profile_clippings %} <tr> <td>clippings <td>{{ _profile_clippings }}{% endif %} </table>{% endif %}{% endif %}
|