module Jekyll::TableOfContentsFilter
Jekyll Table of Contents filter plugin
Public Instance Methods
inject_anchors(html)
click to toggle source
# File lib/jekyll-toc.rb, line 30 def inject_anchors(html) return html unless toc_enabled? TableOfContents::Parser.new(html, toc_config).inject_anchors_into_html end
toc(html)
click to toggle source
# File lib/jekyll-toc.rb, line 36 def toc(html) return html unless toc_enabled? TableOfContents::Parser.new(html, toc_config).toc end
toc_only(html)
click to toggle source
Deprecated method. Removed in v1.0.
# File lib/jekyll-toc.rb, line 22 def toc_only(html) Jekyll.logger.warn 'Deprecation: toc_only filter is deprecated and will be remove in jekyll-toc v1.0.', 'Use `{% toc %}` instead of `{{ content | toc_only }}`.' return '' unless toc_enabled? TableOfContents::Parser.new(html, toc_config).build_toc end
Private Instance Methods
toc_config()
click to toggle source
# File lib/jekyll-toc.rb, line 48 def toc_config @context.registers[:site].config['toc'] || {} end
toc_enabled?()
click to toggle source
# File lib/jekyll-toc.rb, line 44 def toc_enabled? @context.registers[:page]['toc'] == true end