Skip to content

Commit dac270e

Browse files
committed
Bump dependencies + move them into vendor folders
1 parent dd22d1d commit dac270e

File tree

5 files changed

+50
-17
lines changed

5 files changed

+50
-17
lines changed

_includes/footer/scripts.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
integrity="sha256-BTlTdQO9/fascB1drekrDVkaKd9PkwBymMlHOiG+qLI=" crossorigin="anonymous"
55
></script>
66
<script
7-
src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.1/popper.min.js"
8-
integrity="sha256-O17BxFKtTt1tzzlkcYwgONw4K59H+r1iI8mSQXvSf5k=" crossorigin="anonymous"
7+
src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.1/umd/popper.min.js"
8+
integrity="sha256-/ijcOLwFf26xEYAjW75FizKVo5tnTYiQddPZoLUHHZ8=" crossorigin="anonymous"
99
></script>
1010
<script
1111
src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.4.1/js/bootstrap.min.js"

_includes/toc.html renamed to _includes/jekyll-docs-theme/vendor/toc.html

Lines changed: 32 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{% capture tocWorkspace %}
22
{% comment %}
3-
Version 1.0.6
3+
Version 1.0.11
44
https://github.com/allejo/jekyll-toc
55

66
"...like all things liquid - where there's a will, and ~36 hours to spare, there's usually a/some way" ~jaybe
@@ -21,6 +21,7 @@
2121
* item_class (string) : '' - add custom class(es) for each list item; has support for '%level%' placeholder, which is the current heading level
2222
* baseurl (string) : '' - add a base url to the TOC links for when your TOC is on another page than the actual content
2323
* anchor_class (string) : '' - add custom class(es) for each anchor element
24+
* skipNoIDs (bool) : false - skip headers that do not have an `id` attribute
2425

2526
Output:
2627
An ordered or unordered list representing the table of contents of a markdown block. This snippet will only
@@ -29,6 +30,7 @@
2930

3031
{% capture my_toc %}{% endcapture %}
3132
{% assign orderedList = include.ordered | default: false %}
33+
{% assign skipNoIDs = include.skipNoIDs | default: false %}
3234
{% assign minHeader = include.h_min | default: 1 %}
3335
{% assign maxHeader = include.h_max | default: 6 %}
3436
{% assign nodes = include.html | split: '<h' %}
@@ -41,6 +43,12 @@
4143
{% continue %}
4244
{% endif %}
4345

46+
{% if skipNoIDs == true %}
47+
{% unless node contains "id=" %}
48+
{% continue %}
49+
{% endunless %}
50+
{% endif %}
51+
4452
{% assign headerLevel = node | replace: '"', '' | slice: 0, 1 | times: 1 %}
4553

4654
{% if headerLevel < minHeader or headerLevel > maxHeader %}
@@ -52,13 +60,21 @@
5260
{% assign minHeader = headerLevel %}
5361
{% endif %}
5462

55-
{% assign indentAmount = headerLevel | minus: minHeader | add: 1 %}
63+
{% assign indentAmount = headerLevel | minus: minHeader %}
5664
{% assign _workspace = node | split: '</h' %}
5765

5866
{% assign _idWorkspace = _workspace[0] | split: 'id="' %}
5967
{% assign _idWorkspace = _idWorkspace[1] | split: '"' %}
6068
{% assign html_id = _idWorkspace[0] %}
6169

70+
{% assign _classWorkspace = _workspace[0] | split: 'class="' %}
71+
{% assign _classWorkspace = _classWorkspace[1] | split: '"' %}
72+
{% assign html_class = _classWorkspace[0] %}
73+
74+
{% if html_class contains "no_toc" %}
75+
{% continue %}
76+
{% endif %}
77+
6278
{% capture _hAttrToStrip %}{{ _workspace[0] | split: '>' | first }}>{% endcapture %}
6379
{% assign header = _workspace[0] | replace: _hAttrToStrip, '' %}
6480

@@ -67,15 +83,24 @@
6783
{% assign space = space | prepend: ' ' %}
6884
{% endfor %}
6985

70-
{% unless include.item_class == blank %}
86+
{% if include.item_class and include.item_class != blank %}
7187
{% capture listItemClass %}{:.{{ include.item_class | replace: '%level%', headerLevel }}}{% endcapture %}
72-
{% endunless %}
88+
{% endif %}
89+
90+
{% capture anchor_body %}{% if include.sanitize %}{{ header | strip_html }}{% else %}{{ header }}{% endif %}{% endcapture %}
91+
{% capture anchor_body %}{{ anchor_body | replace: "|", "\|" }}{% endcapture %}
92+
93+
{% if html_id %}
94+
{% capture list_item %}[{{ anchor_body }}]({% if include.baseurl %}{{ include.baseurl }}{% endif %}#{{ html_id }}){% endcapture %}
95+
{% else %}
96+
{% capture list_item %}{{ anchor_body }}{% endcapture %}
97+
{% endif %}
7398

7499
{% capture my_toc %}{{ my_toc }}
75-
{{ space }}{{ listModifier }} {{ listItemClass }} [{% if include.sanitize %}{{ header | strip_html }}{% else %}{{ header }}{% endif %}]({% if include.baseurl %}{{ include.baseurl }}{% endif %}#{{ html_id }}){% if include.anchor_class %}{:.{{ include.anchor_class }}}{% endif %}{% endcapture %}
100+
{{ space }}{{ listModifier }} {{ listItemClass }} {{ list_item }}{% if include.anchor_class %}{:.{{ include.anchor_class }}}{% endif %}{% endcapture %}
76101
{% endfor %}
77102

78-
{% if include.class %}
103+
{% if include.class and include.class != blank %}
79104
{% capture my_toc %}{:.{{ include.class }}}
80105
{{ my_toc | lstrip }}{% endcapture %}
81106
{% endif %}
@@ -84,4 +109,4 @@
84109
{% capture my_toc %}{: #{{ include.id }}}
85110
{{ my_toc | lstrip }}{% endcapture %}
86111
{% endif %}
87-
{% endcapture %}{% assign tocWorkspace = '' %}{{ my_toc | markdownify | strip }}
112+
{% endcapture %}{% assign tocWorkspace = '' %}{{ my_toc | markdownify | strip }}

_layouts/full.html

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,11 @@
55
<div class="container">
66
<main class="layout-full__main scope-markdown">
77
{% unless page.disable_anchors %}
8-
{% include anchor_headings.html html=content anchorBody="#" anchorClass="heading-anchor" %}
8+
{% include jekyll-docs-theme/vendor/anchor_headings.html
9+
html=content
10+
anchorBody="#"
11+
anchorClass="heading-anchor"
12+
%}
913
{% else %}
1014
{{ content }}
1115
{% endunless %}

_layouts/page.html

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ <h2 class="mb-0">Table of Contents</h2>
1919
</button>
2020
</div>
2121

22-
{% include toc.html
22+
{% include jekyll-docs-theme/vendor/toc.html
2323
html=content
2424
class="js-toc.mb-0.mt-2"
2525
id="mobileTOC"
@@ -28,17 +28,21 @@ <h2 class="mb-0">Table of Contents</h2>
2828
</section>
2929

3030
<section class="scope-markdown">
31-
{% include anchor_headings.html
32-
html=content
33-
anchorBody="#"
34-
anchorClass="heading-anchor"
35-
%}
31+
{% unless page.disable_anchors %}
32+
{% include jekyll-docs-theme/vendor/anchor_headings.html
33+
html=content
34+
anchorBody="#"
35+
anchorClass="heading-anchor"
36+
%}
37+
{% else %}
38+
{{ content }}
39+
{% endunless %}
3640
</section>
3741
</main>
3842

3943
<aside class="col-md-3 layout-page__sidebar d-none d-md-block hidden-print">
4044
<nav id="page-toc" class="page-sidebar">
41-
{% include toc.html
45+
{% include jekyll-docs-theme/vendor/toc.html
4246
html=content
4347
class="list-unstyled.pl-0"
4448
anchor_class="nav-link.px-3.py-1"

0 commit comments

Comments
 (0)