jekyll-toc 0.12.0 → 0.12.1
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 +4 -4
- data/README.md +5 -3
- data/lib/jekyll-toc.rb +1 -1
- data/lib/table_of_contents/configuration.rb +3 -1
- data/lib/table_of_contents/parser.rb +1 -2
- data/lib/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 79d1409209555ff59be7d83d30b1576ca4ae792835a934fa2618e9efb13c0a61
|
4
|
+
data.tar.gz: 1008538004cb196a363fca3748988f1156d21e6ff72b30505d4a4f20ad0c1600
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4a4f68a3f04691f78bfe05f8a5b3e5e59f0b75b26e43cdb199ba8a5aa08192c397fd7bc2ffbbf458d5923b136369d986dac1f1a6556ef6c820faa95365873a8e
|
7
|
+
data.tar.gz: 83ad420d0a58ca60ef99635b1ed13b85e2f17f7a638c35724f22c0f6b628121cf73c25ae4a9d6e2c65d909dcae72355220c3465471bd3f14d858f9af5c143764
|
data/README.md
CHANGED
@@ -66,7 +66,7 @@ This filter places the TOC directly above the content.
|
|
66
66
|
|
67
67
|
If you'd like separated TOC and content, you can use `toc_only` and `inject_anchors` filters.
|
68
68
|
|
69
|
-
#### ~~`toc_only` filter~~
|
69
|
+
#### ~~`toc_only` filter~~ `toc` tag
|
70
70
|
|
71
71
|
⚠️ Please use `{% toc %}` instead of `{{ content | toc_only }}`.
|
72
72
|
|
@@ -74,8 +74,6 @@ Generates the TOC itself as described [below](#generated-html).
|
|
74
74
|
Mostly useful in cases where the TOC should _not_ be placed immediately
|
75
75
|
above the content but at some other place of the page, i.e. an aside.
|
76
76
|
|
77
|
-
#### toc tag
|
78
|
-
|
79
77
|
```html
|
80
78
|
<div>
|
81
79
|
<div id="table-of-contents">
|
@@ -87,6 +85,10 @@ above the content but at some other place of the page, i.e. an aside.
|
|
87
85
|
</div>
|
88
86
|
```
|
89
87
|
|
88
|
+
#### Current Limitation
|
89
|
+
|
90
|
+
**`{% toc %}` can be available only in [Jekyll Posts](https://jekyllrb.com/docs/step-by-step/08-blogging/) and [Jekyll Collections](https://jekyllrb.com/docs/collections/). If any concern or issue, please report it on [issue](https://github.com/toshimaru/jekyll-toc/issues/new).**
|
91
|
+
|
90
92
|
#### `inject_anchors` filter
|
91
93
|
|
92
94
|
Injects HTML anchors into the content without actually outputting the TOC itself.
|
data/lib/jekyll-toc.rb
CHANGED
@@ -21,7 +21,7 @@ module Jekyll
|
|
21
21
|
# Deprecated method. Removed in v1.0.
|
22
22
|
def toc_only(html)
|
23
23
|
Jekyll.logger.warn 'Deprecation: toc_only filter is deprecated and will be remove in jekyll-toc v1.0.',
|
24
|
-
'Use `{% toc %}` instead of `{{
|
24
|
+
'Use `{% toc %}` instead of `{{ content | toc_only }}`.'
|
25
25
|
return '' unless toc_enabled?
|
26
26
|
|
27
27
|
TableOfContents::Parser.new(html, toc_config).build_toc
|
@@ -4,7 +4,8 @@ module Jekyll
|
|
4
4
|
module TableOfContents
|
5
5
|
# jekyll-toc configuration class
|
6
6
|
class Configuration
|
7
|
-
attr_accessor :toc_levels, :
|
7
|
+
attr_accessor :toc_levels, :no_toc_class, :no_toc_section_class,
|
8
|
+
:list_class, :sublist_class, :item_class, :item_prefix
|
8
9
|
|
9
10
|
DEFAULT_CONFIG = {
|
10
11
|
'min_level' => 1,
|
@@ -20,6 +21,7 @@ module Jekyll
|
|
20
21
|
options = generate_option_hash(options)
|
21
22
|
|
22
23
|
@toc_levels = options['min_level']..options['max_level']
|
24
|
+
@no_toc_class = 'no_toc'
|
23
25
|
@no_toc_section_class = options['no_toc_section_class']
|
24
26
|
@list_class = options['list_class']
|
25
27
|
@sublist_class = options['sublist_class']
|
@@ -4,7 +4,6 @@ module Jekyll
|
|
4
4
|
module TableOfContents
|
5
5
|
# Parse html contents and generate table of contents
|
6
6
|
class Parser
|
7
|
-
NO_TOC_CLASS_NAME = 'no_toc'
|
8
7
|
PUNCTUATION_REGEXP = /[^\p{Word}\- ]/u
|
9
8
|
|
10
9
|
def initialize(html, options = {})
|
@@ -39,7 +38,7 @@ module Jekyll
|
|
39
38
|
headers = Hash.new(0)
|
40
39
|
|
41
40
|
(@doc.css(toc_headings) - @doc.css(toc_headings_in_no_toc_section))
|
42
|
-
.reject { |n| n.classes.include?(
|
41
|
+
.reject { |n| n.classes.include?(@configuration.no_toc_class) }
|
43
42
|
.inject([]) do |entries, node|
|
44
43
|
text = node.text
|
45
44
|
id = node.attribute('id') || text
|
data/lib/version.rb
CHANGED
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.12.
|
4
|
+
version: 0.12.1
|
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: 2019-04-
|
12
|
+
date: 2019-04-07 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: nokogiri
|