Skip to content

Introduce jekyll-toc #15

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Apr 15, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ gem 'rake'

group :jekyll_plugins do
gem 'github-pages'
gem 'jekyll-toc'
end
5 changes: 4 additions & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,8 @@ GEM
jekyll-seo-tag (~> 2.0)
jekyll-titles-from-headings (0.5.1)
jekyll (~> 3.3)
jekyll-toc (0.12.1)
nokogiri (~> 1.9)
jekyll-watch (2.1.2)
listen (~> 3.0)
jemoji (0.10.2)
Expand All @@ -205,7 +207,7 @@ GEM
jekyll-seo-tag (~> 2.1)
minitest (5.11.3)
multipart-post (2.0.0)
nokogiri (1.10.1)
nokogiri (1.10.2)
mini_portile2 (~> 2.4.0)
octokit (4.13.0)
sawyer (~> 0.8.0, >= 0.5.3)
Expand Down Expand Up @@ -244,6 +246,7 @@ PLATFORMS

DEPENDENCIES
github-pages
jekyll-toc
rake

BUNDLED WITH
Expand Down
4 changes: 4 additions & 0 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,12 @@ plugins:
- jekyll-sitemap
twitter:
card: summary
toc:
min_level: 2
max_level: 5
defaults:
- scope:
path: ""
values:
image: https://avatars.githubusercontent.com/u/4223
toc: true
2 changes: 1 addition & 1 deletion rails
Submodule rails updated 154 files
8 changes: 4 additions & 4 deletions src/_layouts/default.html
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@
</div>
</nav>

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

<main role="main" class="col-12 col-md-9 col-xl-10 py-md-3 pl-md-5">
<main role="main" class="col-12 col-md-9 col-xl-8 py-md-3 pl-md-5">
{{ content }}
<footer class="site-footer">
<!-- <span class="site-footer-credits">This page was generated by <a href="https://pages.github.com">GitHub Pages</a>.</span> -->
Expand Down
32 changes: 31 additions & 1 deletion src/_sass/railsdoc.scss
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,41 @@ code {
}
}

.toc-content {
.toc-content-sticky {
position: sticky;
order: 2;
top: $navbar-height;
height: calc(100vh - #{$navbar-height});
z-index: 100; /* Behind the navbar */
box-shadow: inset -1px 0 0 rgba(0, 0, 0, .1);

.toc-content {
padding-top: 20px;
padding-left: 10px;
padding-right: 10px;
}
}

.section-nav {
padding-left: 1rem;
border-left: 1px solid #eee;

ul {
padding-left: 1rem;
}

a {
color: rgba(0, 0, 0, .8);

&:hover {
color: $dark-red;
text-decoration: none;
}
}
}

.toc-entry {
display: block;
}

.sidebar-content {
Expand Down