Skip to content

Commit 75876f0

Browse files
authored
Introduce jekyll-toc (#15)
* Add jekyll toc * Update jekyll-toc * Set toc levels limit * Add toc tag * gem 'jekyll-toc', '0.12.0.rc3' * jekyll-toc update * Update style * toc styling * Update rails submodule * Update jekyll-toc
1 parent 443bc26 commit 75876f0

File tree

6 files changed

+45
-7
lines changed

6 files changed

+45
-7
lines changed

Gemfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@ gem 'rake'
44

55
group :jekyll_plugins do
66
gem 'github-pages'
7+
gem 'jekyll-toc'
78
end

Gemfile.lock

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,8 @@ GEM
185185
jekyll-seo-tag (~> 2.0)
186186
jekyll-titles-from-headings (0.5.1)
187187
jekyll (~> 3.3)
188+
jekyll-toc (0.12.1)
189+
nokogiri (~> 1.9)
188190
jekyll-watch (2.1.2)
189191
listen (~> 3.0)
190192
jemoji (0.10.2)
@@ -205,7 +207,7 @@ GEM
205207
jekyll-seo-tag (~> 2.1)
206208
minitest (5.11.3)
207209
multipart-post (2.0.0)
208-
nokogiri (1.10.1)
210+
nokogiri (1.10.2)
209211
mini_portile2 (~> 2.4.0)
210212
octokit (4.13.0)
211213
sawyer (~> 0.8.0, >= 0.5.3)
@@ -244,6 +246,7 @@ PLATFORMS
244246

245247
DEPENDENCIES
246248
github-pages
249+
jekyll-toc
247250
rake
248251

249252
BUNDLED WITH

_config.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,12 @@ plugins:
88
- jekyll-sitemap
99
twitter:
1010
card: summary
11+
toc:
12+
min_level: 2
13+
max_level: 5
1114
defaults:
1215
- scope:
1316
path: ""
1417
values:
1518
image: https://avatars.githubusercontent.com/u/4223
19+
toc: true

rails

Submodule rails updated 154 files

src/_layouts/default.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,11 @@
4141
</div>
4242
</nav>
4343

44-
<!-- <div class="col-12 col-md-3 col-xl-2 bg-light toc-content">
45-
<div>toc-content!</div>
46-
</div> -->
44+
<div class="col-12 col-md-3 col-xl-2 toc-content-sticky">
45+
<div class="toc-content">{% toc %}</div>
46+
</div>
4747

48-
<main role="main" class="col-12 col-md-9 col-xl-10 py-md-3 pl-md-5">
48+
<main role="main" class="col-12 col-md-9 col-xl-8 py-md-3 pl-md-5">
4949
{{ content }}
5050
<footer class="site-footer">
5151
<!-- <span class="site-footer-credits">This page was generated by <a href="https://pages.github.com">GitHub Pages</a>.</span> -->

src/_sass/railsdoc.scss

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,41 @@ code {
4444
}
4545
}
4646

47-
.toc-content {
47+
.toc-content-sticky {
4848
position: sticky;
4949
order: 2;
50+
top: $navbar-height;
51+
height: calc(100vh - #{$navbar-height});
5052
z-index: 100; /* Behind the navbar */
5153
box-shadow: inset -1px 0 0 rgba(0, 0, 0, .1);
54+
55+
.toc-content {
56+
padding-top: 20px;
57+
padding-left: 10px;
58+
padding-right: 10px;
59+
}
60+
}
61+
62+
.section-nav {
63+
padding-left: 1rem;
64+
border-left: 1px solid #eee;
65+
66+
ul {
67+
padding-left: 1rem;
68+
}
69+
70+
a {
71+
color: rgba(0, 0, 0, .8);
72+
73+
&:hover {
74+
color: $dark-red;
75+
text-decoration: none;
76+
}
77+
}
78+
}
79+
80+
.toc-entry {
81+
display: block;
5282
}
5383

5484
.sidebar-content {

0 commit comments

Comments
 (0)