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 28
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 34
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)
  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 46
def toc_config
  @context.registers[:site].config['toc'] || {}
end
toc_enabled?() click to toggle source
# File lib/jekyll-toc.rb, line 42
def toc_enabled?
  @context.registers[:page]['toc'] == true
end