Class: Jekyll::TocTag

Inherits:
Liquid::Tag
  • Object
show all
Defined in:
lib/jekyll-toc.rb

Overview

toc tag for Jekyll

Instance Method Summary collapse

Instance Method Details

#render(context) ⇒ Object



10
11
12
13
14
15
16
# File 'lib/jekyll-toc.rb', line 10

def render(context)
  return '' unless context.registers[:page]['toc']

  content_html = context.registers[:page]['content']
  toc_config = context.registers[:site].config['toc'] || {}
  TableOfContents::Parser.new(content_html, toc_config).build_toc
end