jekyll-theme-warpcore 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (121) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE.txt +21 -0
  3. data/README.md +29 -0
  4. data/_data/nav.yml +7 -0
  5. data/_includes/docsearch.html +15 -0
  6. data/_includes/footer-links.html +120 -0
  7. data/_includes/mathjax.html +25 -0
  8. data/_includes/menu.svg +1 -0
  9. data/_includes/scripts.html +15 -0
  10. data/_includes/sidebar.html +44 -0
  11. data/_includes/toc.html +96 -0
  12. data/_layouts/default.html +45 -0
  13. data/_sass/.DS_Store +0 -0
  14. data/_sass/bootstrap/.DS_Store +0 -0
  15. data/_sass/bootstrap/_alert.scss +51 -0
  16. data/_sass/bootstrap/_badge.scss +54 -0
  17. data/_sass/bootstrap/_breadcrumb.scss +44 -0
  18. data/_sass/bootstrap/_button-group.scss +163 -0
  19. data/_sass/bootstrap/_buttons.scss +142 -0
  20. data/_sass/bootstrap/_card.scss +282 -0
  21. data/_sass/bootstrap/_carousel.scss +197 -0
  22. data/_sass/bootstrap/_close.scss +40 -0
  23. data/_sass/bootstrap/_code.scss +48 -0
  24. data/_sass/bootstrap/_custom-forms.scss +522 -0
  25. data/_sass/bootstrap/_dropdown.scss +192 -0
  26. data/_sass/bootstrap/_forms.scss +347 -0
  27. data/_sass/bootstrap/_functions.scss +141 -0
  28. data/_sass/bootstrap/_grid.scss +77 -0
  29. data/_sass/bootstrap/_images.scss +42 -0
  30. data/_sass/bootstrap/_input-group.scss +192 -0
  31. data/_sass/bootstrap/_jumbotron.scss +17 -0
  32. data/_sass/bootstrap/_list-group.scss +154 -0
  33. data/_sass/bootstrap/_media.scss +8 -0
  34. data/_sass/bootstrap/_mixins.scss +47 -0
  35. data/_sass/bootstrap/_modal.scss +241 -0
  36. data/_sass/bootstrap/_nav.scss +121 -0
  37. data/_sass/bootstrap/_navbar.scss +324 -0
  38. data/_sass/bootstrap/_pagination.scss +74 -0
  39. data/_sass/bootstrap/_popover.scss +170 -0
  40. data/_sass/bootstrap/_print.scss +141 -0
  41. data/_sass/bootstrap/_progress.scss +47 -0
  42. data/_sass/bootstrap/_reboot.scss +480 -0
  43. data/_sass/bootstrap/_root.scss +20 -0
  44. data/_sass/bootstrap/_spinners.scss +56 -0
  45. data/_sass/bootstrap/_tables.scss +185 -0
  46. data/_sass/bootstrap/_toasts.scss +44 -0
  47. data/_sass/bootstrap/_tooltip.scss +115 -0
  48. data/_sass/bootstrap/_transitions.scss +20 -0
  49. data/_sass/bootstrap/_type.scss +125 -0
  50. data/_sass/bootstrap/_utilities.scss +18 -0
  51. data/_sass/bootstrap/_variables.scss +1147 -0
  52. data/_sass/bootstrap/bootstrap-grid.scss +29 -0
  53. data/_sass/bootstrap/bootstrap-reboot.scss +12 -0
  54. data/_sass/bootstrap/bootstrap.scss +44 -0
  55. data/_sass/bootstrap/mixins/_alert.scss +13 -0
  56. data/_sass/bootstrap/mixins/_background-variant.scss +23 -0
  57. data/_sass/bootstrap/mixins/_badge.scss +17 -0
  58. data/_sass/bootstrap/mixins/_border-radius.scss +76 -0
  59. data/_sass/bootstrap/mixins/_box-shadow.scss +20 -0
  60. data/_sass/bootstrap/mixins/_breakpoints.scss +123 -0
  61. data/_sass/bootstrap/mixins/_buttons.scss +110 -0
  62. data/_sass/bootstrap/mixins/_caret.scss +62 -0
  63. data/_sass/bootstrap/mixins/_clearfix.scss +7 -0
  64. data/_sass/bootstrap/mixins/_deprecate.scss +10 -0
  65. data/_sass/bootstrap/mixins/_float.scss +14 -0
  66. data/_sass/bootstrap/mixins/_forms.scss +177 -0
  67. data/_sass/bootstrap/mixins/_gradients.scss +45 -0
  68. data/_sass/bootstrap/mixins/_grid-framework.scss +81 -0
  69. data/_sass/bootstrap/mixins/_grid.scss +69 -0
  70. data/_sass/bootstrap/mixins/_hover.scss +37 -0
  71. data/_sass/bootstrap/mixins/_image.scss +36 -0
  72. data/_sass/bootstrap/mixins/_list-group.scss +21 -0
  73. data/_sass/bootstrap/mixins/_lists.scss +7 -0
  74. data/_sass/bootstrap/mixins/_nav-divider.scss +11 -0
  75. data/_sass/bootstrap/mixins/_pagination.scss +22 -0
  76. data/_sass/bootstrap/mixins/_reset-text.scss +17 -0
  77. data/_sass/bootstrap/mixins/_resize.scss +6 -0
  78. data/_sass/bootstrap/mixins/_screen-reader.scss +34 -0
  79. data/_sass/bootstrap/mixins/_size.scss +7 -0
  80. data/_sass/bootstrap/mixins/_table-row.scss +39 -0
  81. data/_sass/bootstrap/mixins/_text-emphasis.scss +17 -0
  82. data/_sass/bootstrap/mixins/_text-hide.scss +11 -0
  83. data/_sass/bootstrap/mixins/_text-truncate.scss +8 -0
  84. data/_sass/bootstrap/mixins/_transition.scss +26 -0
  85. data/_sass/bootstrap/mixins/_visibility.scss +8 -0
  86. data/_sass/bootstrap/utilities/_align.scss +8 -0
  87. data/_sass/bootstrap/utilities/_background.scss +19 -0
  88. data/_sass/bootstrap/utilities/_borders.scss +75 -0
  89. data/_sass/bootstrap/utilities/_clearfix.scss +3 -0
  90. data/_sass/bootstrap/utilities/_display.scss +26 -0
  91. data/_sass/bootstrap/utilities/_embed.scss +39 -0
  92. data/_sass/bootstrap/utilities/_flex.scss +51 -0
  93. data/_sass/bootstrap/utilities/_float.scss +11 -0
  94. data/_sass/bootstrap/utilities/_interactions.scss +5 -0
  95. data/_sass/bootstrap/utilities/_overflow.scss +5 -0
  96. data/_sass/bootstrap/utilities/_position.scss +32 -0
  97. data/_sass/bootstrap/utilities/_screenreaders.scss +11 -0
  98. data/_sass/bootstrap/utilities/_shadows.scss +6 -0
  99. data/_sass/bootstrap/utilities/_sizing.scss +20 -0
  100. data/_sass/bootstrap/utilities/_spacing.scss +73 -0
  101. data/_sass/bootstrap/utilities/_stretched-link.scss +19 -0
  102. data/_sass/bootstrap/utilities/_text.scss +71 -0
  103. data/_sass/bootstrap/utilities/_visibility.scss +13 -0
  104. data/_sass/bootstrap/vendor/_rfs.scss +204 -0
  105. data/_sass/jekyll-theme-warpcore.scss +2 -0
  106. data/_sass/warpcore/_anchor.scss +11 -0
  107. data/_sass/warpcore/_content.scss +166 -0
  108. data/_sass/warpcore/_docsearch.scss +8 -0
  109. data/_sass/warpcore/_footer-links.scss +20 -0
  110. data/_sass/warpcore/_sidebar.scss +126 -0
  111. data/_sass/warpcore/_syntax.scss +72 -0
  112. data/_sass/warpcore/_toc.scss +46 -0
  113. data/_sass/warpcore/warpcore.scss +7 -0
  114. data/assets/.DS_Store +0 -0
  115. data/assets/css/style.scss +4 -0
  116. data/assets/js/.DS_Store +0 -0
  117. data/assets/js/bootstrap.bundle.min.js +7 -0
  118. data/assets/js/bootstrap.bundle.min.js.map +1 -0
  119. data/assets/js/bootstrap.min.js +7 -0
  120. data/assets/js/bootstrap.min.js.map +1 -0
  121. metadata +280 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 1fcfd7b1e983d8229143b4941ca38b123844c369c77ab7600ed642bebad9d73c
4
+ data.tar.gz: '0258d5b3354f43e5797e766d6fdf35ec9be378871fa7e07681d288469603399b'
5
+ SHA512:
6
+ metadata.gz: 6d9d67d0a7d74f60406c8ee571c1b6e1be7b69bc053de8584ecd3cdfdcdad2210cc7912bf7add008a97e50fe07690b1aa8fabb18029d876856602576d21ba798
7
+ data.tar.gz: 0e9776947087f41200a62f394230dc9f8f9994ec60698bb855a949085af8fa867a554d3a61ac237c1b383b2217338f27f8ba4fbfd31165aef42b6ca2b0bfa6b4
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2020 Chris
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,29 @@
1
+ # Warpcore theme
2
+
3
+ _Warpcore_ is a Jekyll theme for Github Pages. You can [preview the theme here](https://linklord.github.io/warpcore/).
4
+
5
+ ## Usage
6
+
7
+ To use the Warpcore theme:
8
+
9
+ Add the following to your site's \_config.yml:
10
+
11
+ ```yml
12
+ remote_theme: linklord/warpcore
13
+ ```
14
+
15
+ Optionally, if you'd like to preview your site on your computer, add the following to your site's Gemfile:
16
+
17
+ ```rb
18
+ gem "github-pages", group: :jekyll_plugins
19
+ ```
20
+
21
+ ## Preview the theme locally
22
+
23
+ If you'd like to preview the theme locally:
24
+
25
+ 1. Clone down the theme's repository (git clone https://github.com/linklord/warpcore)
26
+ 2. `cd` into the theme's directory
27
+ 3. Run `script/bootstrap` to install the necessary dependencies
28
+ 4. Run `bundle exec jekyll serve` to start the preview server
29
+ 5. Visit [localhost:4000](http://localhost:4000) in your browser to preview the theme
data/_data/nav.yml ADDED
@@ -0,0 +1,7 @@
1
+ - title: Formatting
2
+ - title: Installation
3
+ - title: Configuration
4
+ pages:
5
+ - title: Navigation
6
+ - title: Mathjax
7
+ - title: Docsearch
@@ -0,0 +1,15 @@
1
+ <script src="https://cdn.jsdelivr.net/npm/docsearch.js@2/dist/cdn/docsearch.min.js"></script>
2
+ <script>
3
+ docsearch({
4
+ // Your apiKey and indexName will be given to you once
5
+ // we create your config
6
+ apiKey: '{{ site.docsearch.search_only_api_key }}',
7
+ indexName: '{{ site.docsearch.index_name }}',
8
+ appId: '{{ site.docsearch.application_id }}', // Should be only included if you are running DocSearch on your own.
9
+ // Replace inputSelector with a CSS selector
10
+ // matching your search input
11
+ inputSelector: '#search-input',
12
+ // Set debug to true to inspect the dropdown
13
+ debug: false,
14
+ });
15
+ </script>
@@ -0,0 +1,120 @@
1
+ {%- assign prev_page = nil -%}
2
+ {%- assign prev_page_group = nil -%}
3
+ {%- assign next_page = nil -%}
4
+ {%- assign next_page_group = nil -%}
5
+
6
+ {%- assign page_slug = page.url | split: '/' | last -%}
7
+
8
+ {%- for group in site.data.nav -%}
9
+ {%- assign group_first = forloop.first -%}
10
+ {%- assign group_last = forloop.last -%}
11
+ {%- assign group_index = forloop.index0 -%}
12
+ {%- assign group_slug = group.title | slugify -%}
13
+ {%- if page.group == group_slug -%}
14
+ {%- if group.pages == nil -%}
15
+ {%- if group_first == false -%}
16
+ {%- assign prev_group_index = group_index | minus: 1 -%}
17
+ {%- if site.data.nav[prev_group_index].pages != nil -%}
18
+ {%- assign prev_page_item = site.data.nav[prev_group_index].pages | last -%}
19
+ {%- assign prev_page = prev_page_item.title -%}
20
+ {%- assign prev_page_group = site.data.nav[prev_group_index].title -%}
21
+ {%- else -%}
22
+ {%- assign prev_page_group = site.data.nav[prev_group_index].title -%}
23
+ {%- endif -%}
24
+ {%- endif -%}
25
+ {%- if forloop.last != true -%}
26
+ {%- assign next_index = forloop.index0 | plus: 1 -%}
27
+ {%- if site.data.nav[next_index].pages != nil -%}
28
+ {%- assign next_page = site.data.nav[next_index].pages[0].title -%}
29
+ {%- assign next_page_group = site.data.nav[next_index].title -%}
30
+ {%- else -%}
31
+ {%- assign next_page_group = site.data.nav[next_index].title -%}
32
+ {%- endif -%}
33
+ {%- endif -%}
34
+ {%- else -%}
35
+ {%- for doc in group.pages -%}
36
+ {%- assign doc_slug = doc.title | slugify -%}
37
+ {%- if page_slug == doc_slug -%}
38
+ {%- if forloop.first != true -%}
39
+ {%- assign prev_index = forloop.index0 | minus: 1 -%}
40
+ {%- assign prev_page = group.pages[prev_index].title -%}
41
+ {%- assign prev_page_group = group.title -%}
42
+ {%- else -%}
43
+ {%- if group_first == false -%}
44
+ {%- assign prev_group_index = group_index | minus: 1 -%}
45
+ {%- if site.data.nav[prev_group_index].pages != nil -%}
46
+ {%- assign prev_page_item = site.data.nav[prev_group_index].pages | last -%}
47
+ {%- assign prev_page = prev_page_item.title -%}
48
+ {%- assign prev_page_group = site.data.nav[prev_group_index].title -%}
49
+ {%- else -%}
50
+ {%- assign prev_page_group = site.data.nav[prev_group_index].title -%}
51
+ {%- endif -%}
52
+ {%- endif -%}
53
+ {%- endif -%}
54
+ {%- if forloop.last != true -%}
55
+ {%- assign next_index = forloop.index0 | plus: 1 -%}
56
+ {%- assign next_page = group.pages[next_index].title -%}
57
+ {%- assign next_page_group = group.title -%}
58
+ {%- else -%}
59
+ {%- assign next_group_index = group_index | plus: 1 -%}
60
+ {%- if site.data.nav[next_group_index].pages != nil -%}
61
+ {%- assign next_page = site.data.nav[next_group_index].pages[0].title -%}
62
+ {%- assign next_page_group = site.data.nav[next_group_index].title -%}
63
+ {%- else -%}
64
+ {%- assign next_page_group = site.data.nav[next_group_index].title -%}
65
+ {%- endif -%}
66
+ {%- endif -%}
67
+ {%- endif -%}
68
+ {%- endfor -%}
69
+ {%- endif -%}
70
+ {%- endif -%}
71
+ {%- endfor -%}
72
+ <footer class="wc-footer">
73
+ <div class="row">
74
+ <div class="col wc-footer-prev">
75
+ {%- if prev_page_group -%}
76
+ {%- assign group_slug = prev_page_group | slugify -%}
77
+ {%- assign link_slug = prev_page | slugify -%}
78
+ {%- if prev_page -%}
79
+ {%- assign prev_text = prev_page -%}
80
+ {%- else -%}
81
+ {%- assign prev_text = prev_page_group -%}
82
+ {%- endif -%}
83
+
84
+ {%- if prev_page -%}
85
+ <small class="text-muted">{{ prev_page_group }}</small>
86
+ {%- else -%}
87
+ <small class="text-muted">Previous</small>
88
+ {%- endif -%}
89
+
90
+ <p class="lead"><a href="{{ site.baseurl }}/{{ group_slug }}/{{ link_slug }}{% if link_slug %}/{% endif %}">
91
+ &larr; {{ prev_text }}
92
+ </a></p>
93
+
94
+ {%- endif -%}
95
+ </div>
96
+ <div class="col wc-footer-next">
97
+ {%- if next_page_group -%}
98
+ {%- assign group_slug = next_page_group | slugify -%}
99
+ {%- assign link_slug = next_page | slugify -%}
100
+ {%- if next_page -%}
101
+ {%- assign next_text = next_page -%}
102
+ {%- else -%}
103
+ {%- assign next_text = next_page_group -%}
104
+ {%- endif -%}
105
+
106
+ {%- if next_page -%}
107
+ <small class="text-muted">{{ next_page_group }}</small>
108
+ {%- else -%}
109
+ <small class="text-muted">Next</small>
110
+ {%- endif -%}
111
+
112
+ <p class="lead"><a href="{{ site.baseurl }}/{{ group_slug }}/{{ link_slug }}{% if link_slug %}/{% endif %}">
113
+ {{ next_text }} &rarr;
114
+ </a></p>
115
+ {%- endif -%}
116
+ </div>
117
+ </div>
118
+
119
+ </footer>
120
+
@@ -0,0 +1,25 @@
1
+ {% if page.mathjax %}
2
+ <script type="text/x-mathjax-config">
3
+ MathJax.Hub.Config({
4
+ tex2jax: {
5
+ inlineMath: [ ['$','$'], ["\\(","\\)"] ],
6
+ processEscapes: true
7
+ }
8
+ });
9
+ </script>
10
+ <script type="text/javascript" async
11
+ src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.7/MathJax.js?config=TeX-MML-AM_CHTML">
12
+ </script>
13
+ <!-- <script
14
+ type="text/javascript"
15
+ charset="utf-8"
16
+ src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"
17
+ >
18
+ </script> -->
19
+ <!-- <script
20
+ type="text/javascript"
21
+ charset="utf-8"
22
+ src="https://vincenttam.github.io/javascripts/MathJaxLocal.js"
23
+ >
24
+ </script>
25
+ -->{% endif %}
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg"{% if include.width %} width="{{ include.width }}"{% endif %}{% if include.height %} height="{{ include.height }}"{% endif %}{% if include.class %} class="{{ include.class }}"{% endif %} viewBox="0 0 30 30" role="img" focusable="false"><title>Menu</title><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"/></svg>
@@ -0,0 +1,15 @@
1
+ {% if site.google_analytics %}
2
+ <script async src="https://www.googletagmanager.com/gtag/js?id={{ site.google_analytics }}"></script>
3
+ <script>
4
+ window.dataLayer = window.dataLayer || [];
5
+ function gtag(){dataLayer.push(arguments);}
6
+ gtag('js', new Date());
7
+ gtag('config', '{{ site.google_analytics }}');
8
+ </script>
9
+ {% endif %}
10
+
11
+ <script src="https://code.jquery.com/jquery-3.5.1.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script>
12
+ <script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script>
13
+ <script src="{{ 'assets/js/bootstrap.bundle.min.js' | relative_url }}"></script>
14
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/anchor-js/4.1.0/anchor.min.js" integrity="sha256-lZaRhKri35AyJSypXXs4o6OPFTbTmUoltBbDCbdzegg=" crossorigin="anonymous"></script>
15
+ <script>anchors.add('.wc-content > h2, .wc-content > h3, .wc-content > h4, .wc-content > h5')</script>
@@ -0,0 +1,44 @@
1
+ <div class="wc-sidebar-block">
2
+ <a class="wc-brand" href="{{ '/' | relative_url }}">{{ site.title }}</a>
3
+ <button class="btn btn-link wc-search-docs-toggle float-right d-md-none p-0 ml-3" type="button" data-toggle="collapse" data-target="#wc-docs-nav" aria-controls="wc-docs-nav" aria-expanded="false" aria-label="Toggle docs navigation">
4
+ {%- include menu.svg width="30" height="30" -%}
5
+ </button>
6
+ </div>
7
+ {%- if site.docsearch -%}
8
+ <div class="wc-docsearch">
9
+ <form role="search" class="d-flex align-items-center">
10
+ <input type="search" class="form-control" id="search-input" placeholder="Search..." aria-label="Search for..." autocomplete="off">
11
+ </form>
12
+ </div>
13
+ {%- endif -%}
14
+ <nav class="collapse wc-links" id="wc-docs-nav" aria-label="Main navigation">
15
+ {%- assign page_slug = page.url | split: '/' | last -%}
16
+ {%- for group in site.data.nav -%}
17
+ {%- assign link = group.pages | first -%}
18
+ {%- assign link_slug = link.title | slugify -%}
19
+ {%- assign group_slug = group.title | slugify -%}
20
+ {%- assign active = nil -%}
21
+ {%- if page.group == group_slug -%}
22
+ {%- assign active = 'active' -%}
23
+ {%- endif -%}
24
+ <div class="wc-sidebar-item{% unless active == nil %} {{ active }}{% endunless %}">
25
+ <a class="wc-sidebar-link" href="{{ site.baseurl }}/{{ group_slug }}/{{ link_slug }}{% if link_slug %}/{% endif %}">
26
+ {{ group.title }}
27
+ </a>
28
+ <ul class="nav wc-sidenav">
29
+ {%- for doc in group.pages -%}
30
+ {%- assign doc_slug = doc.title | slugify -%}
31
+ {%- assign active = nil -%}
32
+ {%- if page.group == group_slug and page_slug == doc_slug -%}
33
+ {%- assign active = 'active wc-sidenav-active' -%}
34
+ {%- endif -%}
35
+ <li{% unless active == nil %} class="{{ active }}"{% endunless %}>
36
+ <a href="{{ site.baseurl }}/{{ group_slug }}/{{ doc_slug }}/">
37
+ {{ doc.title }}
38
+ </a>
39
+ </li>
40
+ {%- endfor -%}
41
+ </ul>
42
+ </div>
43
+ {%- endfor -%}
44
+ </nav>
@@ -0,0 +1,96 @@
1
+ {% capture tocWorkspace %}
2
+ {% comment %}
3
+ Version 1.0.8
4
+ https://github.com/allejo/jekyll-toc
5
+
6
+ "...like all things liquid - where there's a will, and ~36 hours to spare, there's usually a/some way" ~jaybe
7
+
8
+ Usage:
9
+ {% include toc.html html=content sanitize=true class="inline_toc" id="my_toc" h_min=2 h_max=3 %}
10
+
11
+ Parameters:
12
+ * html (string) - the HTML of compiled markdown generated by kramdown in Jekyll
13
+
14
+ Optional Parameters:
15
+ * sanitize (bool) : false - when set to true, the headers will be stripped of any HTML in the TOC
16
+ * class (string) : '' - a CSS class assigned to the TOC
17
+ * id (string) : '' - an ID to assigned to the TOC
18
+ * h_min (int) : 1 - the minimum TOC header level to use; any header lower than this value will be ignored
19
+ * h_max (int) : 6 - the maximum TOC header level to use; any header greater than this value will be ignored
20
+ * ordered (bool) : false - when set to true, an ordered list will be outputted instead of an unordered list
21
+ * item_class (string) : '' - add custom class(es) for each list item; has support for '%level%' placeholder, which is the current heading level
22
+ * baseurl (string) : '' - add a base url to the TOC links for when your TOC is on another page than the actual content
23
+ * anchor_class (string) : '' - add custom class(es) for each anchor element
24
+
25
+ Output:
26
+ An ordered or unordered list representing the table of contents of a markdown block. This snippet will only
27
+ generate the table of contents and will NOT output the markdown given to it
28
+ {% endcomment %}
29
+
30
+ {% capture my_toc %}{% endcapture %}
31
+ {% assign orderedList = include.ordered | default: false %}
32
+ {% assign minHeader = include.h_min | default: 1 %}
33
+ {% assign maxHeader = include.h_max | default: 6 %}
34
+ {% assign nodes = include.html | split: '<h' %}
35
+ {% assign firstHeader = true %}
36
+
37
+ {% capture listModifier %}{% if orderedList %}1.{% else %}-{% endif %}{% endcapture %}
38
+
39
+ {% for node in nodes %}
40
+ {% if node == "" %}
41
+ {% continue %}
42
+ {% endif %}
43
+
44
+ {% assign headerLevel = node | replace: '"', '' | slice: 0, 1 | times: 1 %}
45
+
46
+ {% if headerLevel < minHeader or headerLevel > maxHeader %}
47
+ {% continue %}
48
+ {% endif %}
49
+
50
+ {% if firstHeader %}
51
+ {% assign firstHeader = false %}
52
+ {% assign minHeader = headerLevel %}
53
+ {% endif %}
54
+
55
+ {% assign indentAmount = headerLevel | minus: minHeader %}
56
+ {% assign _workspace = node | split: '</h' %}
57
+
58
+ {% assign _idWorkspace = _workspace[0] | split: 'id="' %}
59
+ {% assign _idWorkspace = _idWorkspace[1] | split: '"' %}
60
+ {% assign html_id = _idWorkspace[0] %}
61
+
62
+ {% assign _classWorkspace = _workspace[0] | split: 'class="' %}
63
+ {% assign _classWorkspace = _classWorkspace[1] | split: '"' %}
64
+ {% assign html_class = _classWorkspace[0] %}
65
+
66
+ {% if html_class contains "no_toc" %}
67
+ {% continue %}
68
+ {% endif %}
69
+
70
+ {% capture _hAttrToStrip %}{{ _workspace[0] | split: '>' | first }}>{% endcapture %}
71
+ {% assign header = _workspace[0] | replace: _hAttrToStrip, '' %}
72
+
73
+ {% assign space = '' %}
74
+ {% for i in (1..indentAmount) %}
75
+ {% assign space = space | prepend: ' ' %}
76
+ {% endfor %}
77
+
78
+ {% unless include.item_class == blank %}
79
+ {% capture listItemClass %}{:.{{ include.item_class | replace: '%level%', headerLevel }}}{% endcapture %}
80
+ {% endunless %}
81
+
82
+ {% capture heading_body %}{% if include.sanitize %}{{ header | strip_html }}{% else %}{{ header }}{% endif %}{% endcapture %}
83
+ {% capture my_toc %}{{ my_toc }}
84
+ {{ space }}{{ listModifier }} {{ listItemClass }} [{{ heading_body | replace: "|", "\|" }}]({% if include.baseurl %}{{ include.baseurl }}{% endif %}#{{ html_id }}){% if include.anchor_class %}{:.{{ include.anchor_class }}}{% endif %}{% endcapture %}
85
+ {% endfor %}
86
+
87
+ {% if include.class %}
88
+ {% capture my_toc %}{:.{{ include.class }}}
89
+ {{ my_toc | lstrip }}{% endcapture %}
90
+ {% endif %}
91
+
92
+ {% if include.id %}
93
+ {% capture my_toc %}{: #{{ include.id }}}
94
+ {{ my_toc | lstrip }}{% endcapture %}
95
+ {% endif %}
96
+ {% endcapture %}{% assign tocWorkspace = '' %}{{ my_toc | markdownify | strip }}
@@ -0,0 +1,45 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
6
+ {% seo %}
7
+ <link rel="stylesheet" href="{{ '/assets/css/style.css?v=' | append: site.github.build_revision | relative_url }}" media="screen" type="text/css">
8
+ <!--[if lt IE 9]>
9
+ <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
10
+ <![endif]-->
11
+ {%- if site.docsearch -%}
12
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/docsearch.js@2/dist/cdn/docsearch.min.css"/>
13
+ {%- endif -%}
14
+ </head>
15
+ <body {% if page.toc %}class="position-relative" data-spy="scroll" data-target="#wc-toc-nav" data-offset="0"{% endif %}>
16
+ <div class="container-fluid">
17
+ <div class="row flex-xl-nowrap">
18
+ <div class="col-md-3 col-xl-2 wc-sidebar">
19
+ {% include sidebar.html %}
20
+ </div>
21
+
22
+ {% if page.toc or page.toc == nil %}
23
+ <nav id="wc-toc-nav" class="d-none d-xl-block col-xl-2 wc-toc" aria-label="Secondary navigation">
24
+ {% include toc.html html=content class="nav.section-nav" anchor_class="nav-link" item_class="toc-entry.toc-h%level%" h_min=2 h_max=4 %}
25
+ </nav>
26
+ {% endif %}
27
+
28
+ <main class="wc-content col-md-9 col-xl-8 py-md-3 pl-md-5" role="main">
29
+ <h1 class="wc-title">{{ page.title }}</h1>
30
+ <p class="wc-lead">{{ page.description }}</p>
31
+ {{ content }}
32
+ {% unless page.group == nil %}
33
+ {% if page.footer_links or page.footer_links == nil %}
34
+ {% include footer-links.html %}
35
+ {% endif %}
36
+ {% endunless %}
37
+ </main>
38
+ </div>
39
+ </div>
40
+
41
+ {%- if site.docsearch -%}{% include docsearch.html %}{%- endif -%}
42
+ {% include scripts.html %}
43
+ {% include mathjax.html %}
44
+ </body>
45
+ </html>
data/_sass/.DS_Store ADDED
Binary file