jekyll-toc 0.9.1 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 705551195e11b692852b8515218169cd4c9c338824817b13591f5427d9921da2
4
- data.tar.gz: 497a38ad31db5eddca9c7f7723cb65310732ad8dc07946fa08686258b1aa18c4
3
+ metadata.gz: a2c1e79e71caeb6e93026f4111464e4dc7ac4d8040b7af5c9fe0d5b426c0cfd5
4
+ data.tar.gz: c93040f18d95262ce323cbf660a21cd41b1d9afe756bf617f9a434c791d43dcb
5
5
  SHA512:
6
- metadata.gz: bfad59fcefb5a35f2c332ba948d16e3db883178eb413cc6729ab2c088e6efdc79c26c8f459b676b7ba9cd8ff27a17cfe637f20c87023187418f22cd9445dbdf9
7
- data.tar.gz: d6d020c0adc84111b1e9dd4919412b65a5d60d4f913e0eec4fcebc85acdc04c6da9bc535b0d096c9d1a69848553f3fb5f7079e08b8eac5c2c8b6b232c6de5788
6
+ metadata.gz: c7b9e1971a2c442d34104a698efe9625b6defa110c6833751b6767ef959d4257ad18ea6b6f9c1f93e756a44daf936eea79a62dd24f638b20621aa91bd7ab2ed2
7
+ data.tar.gz: ed6afcf94eeb1813607311b6c5caef82f905314fe5e76bee044a0bdc008692d1218989ae97c9f5c8517154d034d325525c4471b521ca730a89444a0599a5a8e1
data/README.md CHANGED
@@ -9,6 +9,8 @@
9
9
 
10
10
  - [Installation](#installation)
11
11
  - [Usage](#usage)
12
+ - [1. Basic Usage](#1-basic-usage)
13
+ - [2. Advanced Usage](#2-advanced-usage)
12
14
  - [Generated HTML](#generated-html)
13
15
  - [Customization](#customization)
14
16
  - [Skip TOC](#skip-toc)
@@ -64,13 +66,13 @@ If you'd like separated TOC and content, you can use `toc_only` and `inject_anch
64
66
 
65
67
  #### `toc_only` filter
66
68
 
67
- Generates the TOC itself as described [below](#generated-table-of-contents-html).
69
+ Generates the TOC itself as described [below](#generated-html).
68
70
  Mostly useful in cases where the TOC should _not_ be placed immediately
69
71
  above the content but at some other place of the page, i.e. an aside.
70
72
 
71
73
  #### `inject_anchors` filter
72
74
 
73
- Injects HTML anchors into the content without actually outputing the TOC itself.
75
+ Injects HTML anchors into the content without actually outputting the TOC itself.
74
76
  They are of the form:
75
77
 
76
78
  ```html
@@ -82,9 +84,7 @@ They are of the form:
82
84
  This is only useful when the TOC itself should be placed at some other
83
85
  location with the `toc_only` filter.
84
86
 
85
- ### Generated HTML
86
-
87
- ![screenshot](https://user-images.githubusercontent.com/803398/28401295-0dcfb7ca-6d54-11e7-892b-2f2e6ca755a7.png)
87
+ ## Generated HTML
88
88
 
89
89
  jekyll-toc generates an unordered list. The HTML output is as follows.
90
90
 
@@ -110,9 +110,11 @@ jekyll-toc generates an unordered list. The HTML output is as follows.
110
110
  </ul>
111
111
  ```
112
112
 
113
- ### Customization
113
+ ![screenshot](https://user-images.githubusercontent.com/803398/28401295-0dcfb7ca-6d54-11e7-892b-2f2e6ca755a7.png)s
114
+
115
+ ## Customization
114
116
 
115
- #### Skip TOC
117
+ ### Skip TOC
116
118
 
117
119
  The heading is ignored in the toc when you add `no_toc` to the class.
118
120
 
@@ -122,7 +124,7 @@ The heading is ignored in the toc when you add `no_toc` to the class.
122
124
  <h2>h2</h2>
123
125
  ```
124
126
 
125
- #### Skip TOC Section
127
+ ### Skip TOC Section
126
128
 
127
129
  The headings are ignored inside the element which has `no_toc_section` class.
128
130
 
@@ -144,17 +146,17 @@ toc:
144
146
  no_toc_section_class: exclude # default: no_toc_section
145
147
  ```
146
148
 
147
- Configuring mutiple classes are allowed:
149
+ Configuring multiple classes for `no_toc_section_class` is allowed:
148
150
 
149
151
  ```yml
150
152
  toc:
151
- no_toc_section_class:
153
+ no_toc_section_class:
152
154
  - no_toc_section
153
155
  - exclude
154
156
  - your_custom_skip_class_name
155
157
  ```
156
158
 
157
- #### TOC levels
159
+ ### TOC levels
158
160
 
159
161
  The toc levels can be configured on `_config.yml`:
160
162
 
@@ -180,7 +182,7 @@ toc:
180
182
 
181
183
  The default level range is `<h1>` to `<h6>`.
182
184
 
183
- #### CSS Styling
185
+ ### CSS Styling
184
186
 
185
187
  The toc can be modified with CSS. The sample CSS is the following.
186
188
 
data/jekyll-toc.gemspec CHANGED
@@ -17,7 +17,7 @@ Gem::Specification.new do |spec|
17
17
 
18
18
  spec.required_ruby_version = '>= 2.3'
19
19
 
20
- spec.add_runtime_dependency 'nokogiri', '~> 1.8'
20
+ spec.add_runtime_dependency 'nokogiri', '~> 1.9'
21
21
 
22
22
  spec.add_development_dependency 'appraisal'
23
23
  spec.add_development_dependency 'jekyll', '>= 3.5'
data/lib/jekyll-toc.rb CHANGED
@@ -16,7 +16,7 @@ module Jekyll
16
16
  # Jekyll Table of Contents filter plugin
17
17
  module TableOfContentsFilter
18
18
  def toc_only(html)
19
- return html unless toc_enabled?
19
+ return '' unless toc_enabled?
20
20
 
21
21
  ::Jekyll::TableOfContents::Parser.new(html, toc_config).build_toc
22
22
  end
data/lib/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module JekyllToc
4
- VERSION = '0.9.1'
4
+ VERSION = '0.10.0'
5
5
  end
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'test_helper'
4
+
5
+ class TestTableOfContentsFilter < Minitest::Test
6
+ include Jekyll::TableOfContentsFilter
7
+
8
+ DUMMY_HTML = "<div>Dummy HTML Content</div>"
9
+
10
+ def setup
11
+ stubbed_context = Struct.new(:registers)
12
+ @context = stubbed_context.new(page: "xxx")
13
+ @context
14
+ end
15
+
16
+ def test_toc_only
17
+ assert_empty toc_only(DUMMY_HTML)
18
+ end
19
+
20
+ def test_inject_anchors
21
+ assert_equal inject_anchors(DUMMY_HTML), DUMMY_HTML
22
+ end
23
+
24
+ def test_toc
25
+ assert_equal toc(DUMMY_HTML), DUMMY_HTML
26
+ end
27
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-toc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.1
4
+ version: 0.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - toshimaru
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2018-11-27 00:00:00.000000000 Z
12
+ date: 2019-03-23 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: nokogiri
@@ -17,14 +17,14 @@ dependencies:
17
17
  requirements:
18
18
  - - "~>"
19
19
  - !ruby/object:Gem::Version
20
- version: '1.8'
20
+ version: '1.9'
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
25
  - - "~>"
26
26
  - !ruby/object:Gem::Version
27
- version: '1.8'
27
+ version: '1.9'
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: appraisal
30
30
  requirement: !ruby/object:Gem::Requirement
@@ -148,6 +148,7 @@ files:
148
148
  - lib/version.rb
149
149
  - test/test_helper.rb
150
150
  - test/test_inject_anchors_filter.rb
151
+ - test/test_jekyll-toc.rb
151
152
  - test/test_kramdown_list.rb
152
153
  - test/test_option_error.rb
153
154
  - test/test_toc_filter.rb
@@ -172,14 +173,14 @@ required_rubygems_version: !ruby/object:Gem::Requirement
172
173
  - !ruby/object:Gem::Version
173
174
  version: '0'
174
175
  requirements: []
175
- rubyforge_project:
176
- rubygems_version: 2.7.6
176
+ rubygems_version: 3.0.3
177
177
  signing_key:
178
178
  specification_version: 4
179
179
  summary: Jekyll Table of Contents plugin
180
180
  test_files:
181
181
  - test/test_helper.rb
182
182
  - test/test_inject_anchors_filter.rb
183
+ - test/test_jekyll-toc.rb
183
184
  - test/test_kramdown_list.rb
184
185
  - test/test_option_error.rb
185
186
  - test/test_toc_filter.rb