From 32871afafd8451a58a6d5f809f0b473d9bf527c0 Mon Sep 17 00:00:00 2001 From: Nick Huang Date: Mon, 14 Feb 2022 01:05:30 +0800 Subject: [PATCH] [feature] Add the jekyll-code-tabs plugin - refer to https://github.com/clustergarage/jekyll-code-tabs/pull/5 --- Gemfile | 1 + Gemfile.lock | 8 ++++++ _config.yml | 2 ++ _includes/head.html | 63 ++++++++++++++++++++++++++++++++++++++++++++ assets/css/main.scss | 62 +++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 136 insertions(+) create mode 100644 _includes/head.html create mode 100644 assets/css/main.scss diff --git a/Gemfile b/Gemfile index 1903d08..e82b8f2 100644 --- a/Gemfile +++ b/Gemfile @@ -20,6 +20,7 @@ group :jekyll_plugins do gem "jekyll-sitemap" gem "jekyll-feed", "~> 0.12" gem "jekyll-archives" + gem "jekyll-code-tabs", git: "https://github.com/nickhuang9527/jekyll-code-tabs" end # Windows and JRuby does not include zoneinfo files, so bundle the tzinfo-data gem diff --git a/Gemfile.lock b/Gemfile.lock index dda2154..51293d3 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,3 +1,10 @@ +GIT + remote: https://github.com/nickhuang9527/jekyll-code-tabs + revision: 79e527ff0aa9b877cb454680ae5b49e0af489a30 + specs: + jekyll-code-tabs (1.2.0) + jekyll (>= 3.0, < 5.0) + GEM remote: https://rubygems.org/ specs: @@ -278,6 +285,7 @@ PLATFORMS DEPENDENCIES github-pages (~> 219) jekyll-archives + jekyll-code-tabs! jekyll-feed (~> 0.12) jekyll-include-cache jekyll-sitemap diff --git a/_config.yml b/_config.yml index ffcb972..f3a2ebf 100644 --- a/_config.yml +++ b/_config.yml @@ -228,6 +228,7 @@ plugins: - jekyll-gist - jekyll-feed - jekyll-include-cache + - jekyll-code-tabs # mimic GitHub Pages with --safe whitelist: @@ -236,6 +237,7 @@ whitelist: - jekyll-gist - jekyll-feed - jekyll-include-cache + - jekyll-code-tabs # Archives # Type diff --git a/_includes/head.html b/_includes/head.html new file mode 100644 index 0000000..ab4370c --- /dev/null +++ b/_includes/head.html @@ -0,0 +1,63 @@ + + +{% include seo.html %} {% unless site.atom_feed.hide %} + +{% endunless %} + + + + + + + + + + + +{% if site.head_scripts %} {% for script in site.head_scripts %} + +{% endfor %} {% endif %} + + diff --git a/assets/css/main.scss b/assets/css/main.scss new file mode 100644 index 0000000..10b615a --- /dev/null +++ b/assets/css/main.scss @@ -0,0 +1,62 @@ +--- +# Only the main Sass file needs front matter (the dashes are enough) +--- + +@charset "utf-8"; + +@import "minimal-mistakes/skins/{{ site.minimal_mistakes_skin | default: 'default' }}"; // skin +@import "minimal-mistakes"; // main partials + +/* TABS */ + +/* Style the tab */ +.tab { + overflow: hidden; + border: 1px solid #ccc; + background-color: #f1f1f1; +} + +/* Style the buttons that are used to open the tab content */ +.tab button { + background-color: inherit; + float: left; + border: none; + outline: none; + cursor: pointer; + padding: 14px 16px; + transition: 0.3s; +} + +/* Change background color of buttons on hover */ +.tab button:hover { + background-color: #ddd; +} + +/* Create an active/current tablink class */ +.tab button.active { + background-color: #ccc; +} + +/* Style the tab content */ +.tabcontent { + display: none; + padding: 6px 12px; + border: 1px solid #ccc; + border-top: none; +} + +.tabcontent { + animation: fadeEffect 0.5s; /* Fading effect takes 1 second */ +} + +/* Go from zero to full opacity */ +@keyframes fadeEffect { + from { + opacity: 0.5; + } + to { + opacity: 1; + } +} + +/* END TABS */