From 0b40ba13afa1c23e43c46c813703b254f0f9fa16 Mon Sep 17 00:00:00 2001 From: Achilleas Pipinellis Date: Sat, 23 May 2020 21:21:21 +0200 Subject: [PATCH 1/2] Add table of contents to the integrations pages This adds a table of contents (ToC) in the integration pages for quick content scanning. In order to disable it, `toc: false` needs to be added in the YAML frontmatter. --- Gemfile | 1 + Gemfile.lock | 4 ++++ _config.yml | 19 +++++++++++++++++++ sass/custom/_paulus.scss | 12 +++++++++++- .../asides/component_navigation.html | 6 ++++++ 5 files changed, 41 insertions(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index 591c4fc1b50d..57b4baf6b1c0 100644 --- a/Gemfile +++ b/Gemfile @@ -15,6 +15,7 @@ group :jekyll_plugins do gem 'jekyll-sitemap', '1.4.0' gem 'jekyll-time-to-read', '0.1.2' gem 'jekyll-commonmark', '1.3.1' + gem 'jekyll-toc', '0.14.0' end gem 'sinatra', '2.1.0' diff --git a/Gemfile.lock b/Gemfile.lock index d71301672322..84b3567e375a 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -56,6 +56,9 @@ GEM jekyll (>= 3.7, < 5.0) jekyll-time-to-read (0.1.2) jekyll + jekyll-toc (0.14.0) + jekyll (>= 3.8) + nokogiri (~> 1.10) jekyll-watch (2.2.1) listen (~> 3.0) kramdown (2.3.0) @@ -124,6 +127,7 @@ DEPENDENCIES jekyll-paginate (= 1.1.0) jekyll-sitemap (= 1.4.0) jekyll-time-to-read (= 0.1.2) + jekyll-toc (= 0.14.0) nokogiri (= 1.10.10) rake (= 13.0.1) sass-globbing (= 1.1.5) diff --git a/_config.yml b/_config.yml index d5494fa77e97..d6e76b4b8b0d 100644 --- a/_config.yml +++ b/_config.yml @@ -46,6 +46,7 @@ highlighter: none plugins: - jekyll-time-to-read + - jekyll-toc paginate: 10 # Posts per page on the blog index paginate_path: "blog/posts/:num" # Directory base for pagination URLs eg. /posts/2/ @@ -123,6 +124,7 @@ defaults: featured: false # Defaults for blogs posts - scope: + path: "" type: posts values: layout: post @@ -130,9 +132,26 @@ defaults: footer: true sharing: true sidebar: true + # Enable table of contents for integrations + # + # To set toc as a default value, we need to set the scope with an empty path + # and the collection as type + # https://github.com/toshimaru/jekyll-toc/issues/116#issuecomment-644205770 + # + - scope: + path: "" + type: integrations + values: + toc: true # Support for files Jekyll will normally exclude include: - "_headers" - "_redirects" - ".well-known" + +# Table of contents +# https://github.com/toshimaru/jekyll-toc +toc: + min_level: 2 # default: 1 + max_level: 3 # default: 6 diff --git a/sass/custom/_paulus.scss b/sass/custom/_paulus.scss index 00a611e2689a..f821159f5dbd 100644 --- a/sass/custom/_paulus.scss +++ b/sass/custom/_paulus.scss @@ -422,6 +422,16 @@ p.note, div.note { .aside-module { .section { margin-bottom: 10px; + + ul.section-nav { + margin-left: 16px; + + li.toc-entry { + ul { + margin-left: 16px; + } + } + } } .brand-logo-container { @@ -596,4 +606,4 @@ code { border: 1px solid #ddd; border-radius: 0.4em; padding: .1em .4em -} \ No newline at end of file +} diff --git a/source/_includes/asides/component_navigation.html b/source/_includes/asides/component_navigation.html index 65d5a97f23b4..a5e54266097d 100644 --- a/source/_includes/asides/component_navigation.html +++ b/source/_includes/asides/component_navigation.html @@ -66,6 +66,12 @@

Categories

{%- endif -%} + + {%- unless page.no_toc -%} +
+

On this page

+ {% toc %} + {%- endunless -%} From 7ceeb62ead0fe309c1b7f602ec0eddafcc911795 Mon Sep 17 00:00:00 2001 From: Franck Nijhof Date: Mon, 16 Nov 2020 22:20:10 +0100 Subject: [PATCH 2/2] Small styling improvement --- sass/custom/_paulus.scss | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/sass/custom/_paulus.scss b/sass/custom/_paulus.scss index f821159f5dbd..51c07a9b0f18 100644 --- a/sass/custom/_paulus.scss +++ b/sass/custom/_paulus.scss @@ -424,11 +424,16 @@ p.note, div.note { margin-bottom: 10px; ul.section-nav { - margin-left: 16px; + margin-left: 0px; li.toc-entry { + list-style-type: none; + li { + list-style-type: circle; + margin-left: 1em; + } ul { - margin-left: 16px; + margin-left: 1em; } } }