-
-
Notifications
You must be signed in to change notification settings - Fork 492
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added table of contents and ability to override the favicon
- Loading branch information
1 parent
42dcd22
commit 547e88c
Showing
12 changed files
with
159 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
{% capture tocWorkspace %} | ||
{% comment %} | ||
Version 1.0.8 | ||
https://github.com/allejo/jekyll-toc | ||
{% endcomment %} | ||
|
||
{% capture my_toc %}{% endcapture %} | ||
{% assign orderedList = include.ordered | default: false %} | ||
{% assign minHeader = include.h_min | default: 1 %} | ||
{% assign maxHeader = include.h_max | default: 6 %} | ||
{% assign nodes = include.html | split: '<h' %} | ||
{% assign firstHeader = true %} | ||
|
||
{% capture listModifier %}{% if orderedList %}1.{% else %}-{% endif %}{% endcapture %} | ||
|
||
{% for node in nodes %} | ||
{% if node == "" %} | ||
{% continue %} | ||
{% endif %} | ||
|
||
{% assign headerLevel = node | replace: '"', '' | slice: 0, 1 | times: 1 %} | ||
|
||
{% if headerLevel < minHeader or headerLevel > maxHeader %} | ||
{% continue %} | ||
{% endif %} | ||
|
||
{% if firstHeader %} | ||
{% assign firstHeader = false %} | ||
{% assign minHeader = headerLevel %} | ||
{% endif %} | ||
|
||
{% assign indentAmount = headerLevel | minus: minHeader %} | ||
{% assign _workspace = node | split: '</h' %} | ||
|
||
{% assign _idWorkspace = _workspace[0] | split: 'id="' %} | ||
{% assign _idWorkspace = _idWorkspace[1] | split: '"' %} | ||
{% assign html_id = _idWorkspace[0] %} | ||
|
||
{% assign _classWorkspace = _workspace[0] | split: 'class="' %} | ||
{% assign _classWorkspace = _classWorkspace[1] | split: '"' %} | ||
{% assign html_class = _classWorkspace[0] %} | ||
|
||
{% if html_class contains "no_toc" %} | ||
{% continue %} | ||
{% endif %} | ||
|
||
{% capture _hAttrToStrip %}{{ _workspace[0] | split: '>' | first }}>{% endcapture %} | ||
{% assign header = _workspace[0] | replace: _hAttrToStrip, '' %} | ||
|
||
{% assign space = '' %} | ||
{% for i in (1..indentAmount) %} | ||
{% assign space = space | prepend: ' ' %} | ||
{% endfor %} | ||
|
||
{% unless include.item_class == blank %} | ||
{% capture listItemClass %}{:.{{ include.item_class | replace: '%level%', headerLevel }}}{% endcapture %} | ||
{% endunless %} | ||
|
||
{% capture heading_body %}{% if include.sanitize %}{{ header | strip_html }}{% else %}{{ header }}{% endif %}{% endcapture %} | ||
{% capture my_toc %}{{ my_toc }} | ||
{{ space }}{{ listModifier }} {{ listItemClass }} [{{ heading_body | replace: "|", "\|" }}]({% if include.baseurl %}{{ include.baseurl }}{% endif %}#{{ html_id }}){% if include.anchor_class %}{:.{{ include.anchor_class }}}{% endif %}{% endcapture %} | ||
{% endfor %} | ||
|
||
{% if include.class %} | ||
{% capture my_toc %}{:.{{ include.class }}} | ||
{{ my_toc | lstrip }}{% endcapture %} | ||
{% endif %} | ||
|
||
{% if include.id %} | ||
{% capture my_toc %}{: #{{ include.id }}} | ||
{{ my_toc | lstrip }}{% endcapture %} | ||
{% endif %} | ||
{% endcapture %}{% assign tocWorkspace = '' %} | ||
|
||
<div class="contents"> | ||
<div class="menu"> | ||
<p class="menu-label">{{ include.contents_title }}</p> | ||
{{ my_toc | markdownify | strip }} | ||
</div> | ||
</div> | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,3 +23,9 @@ div.highlight { | |
} | ||
} | ||
} | ||
|
||
.contents { | ||
box-shadow: $box-shadow; | ||
padding: 1.5rem; | ||
margin-bottom: 3rem; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,15 +2,15 @@ | |
|
||
Gem::Specification.new do |spec| | ||
spec.name = "bulma-clean-theme" | ||
spec.version = "0.5.7" | ||
spec.version = "0.5.8" | ||
spec.authors = ["chrisrhymes"] | ||
spec.email = ["[email protected]"] | ||
|
||
spec.summary = "Clean and simple theme using Bulma" | ||
spec.summary = "Clean and simple Jekyll theme built using Bulma" | ||
spec.homepage = "https://www.github.com/chrisrhymes/bulma-clean-theme" | ||
spec.license = "MIT" | ||
|
||
spec.files = `git ls-files -z`.split("\x0").select { |f| f.match(%r!^(assets|_layouts|_includes|_sass|_posts|blog|LICENSE|README|package|node_modules|favicon.png|changelog.txt)!i) } | ||
spec.files = `git ls-files -z`.split("\x0").select { |f| f.match(%r!^(assets|_layouts|_includes|_sass|_posts|blog|LICENSE|README|package|node_modules|favicon)!i) } | ||
|
||
spec.add_runtime_dependency "jekyll", "~> 3.8" | ||
spec.add_runtime_dependency "jekyll-feed", "~> 0.11" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
--- | ||
layout: page | ||
title: Page With Contents | ||
subtitle: Example page with contents | ||
toc: true | ||
#toc_title: Custom Title | ||
menubar: example_menu | ||
show_sidebar: false | ||
--- | ||
|
||
## Introduction | ||
|
||
This is an example page with contents that are generated from the page content. | ||
|
||
The page contents are generated automatically using [Jekyll TOC](https://github.com/allejo/jekyll-toc). | ||
|
||
## Set Up | ||
|
||
To add contents to your page add `toc: true` to the page's front matter. | ||
|
||
### Contents Title | ||
|
||
To overwrite the default title for the contents, set `toc_title: My Custom Title` in the page's front matter. | ||
|
||
### Example Front Matter | ||
|
||
```yaml | ||
layout: page | ||
title: Page With Contents | ||
toc: true | ||
toc_title: Custom Title | ||
``` |