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 24
def inject_anchors(html)
  return html unless toc_enabled?

  ::Jekyll::TableOfContents::Parser.new(html, toc_config).inject_anchors_into_html
end
toc(html) click to toggle source
# File lib/jekyll-toc.rb, line 30
def toc(html)
  return html unless toc_enabled?

  ::Jekyll::TableOfContents::Parser.new(html, toc_config).toc
end
toc_only(html) click to toggle source
# File lib/jekyll-toc.rb, line 18
def toc_only(html)
  return html unless toc_enabled?

  ::Jekyll::TableOfContents::Parser.new(html, toc_config).build_toc
end

Private Instance Methods

toc_config() click to toggle source
# File lib/jekyll-toc.rb, line 42
def toc_config
  @context.registers[:site].config['toc'] || {}
end
toc_enabled?() click to toggle source
# File lib/jekyll-toc.rb, line 38
def toc_enabled?
  @context.registers[:page]['toc'] == true
end