Sha256: edfdb92b7677649fcb2a12d3f1c4024fb4e876b369aa33ff3a57c55a200fdd98

Contents?: true

Size: 697 Bytes

Versions: 18

Compression:

Stored size: 697 Bytes

Contents

module Jekyll
  module FancyToCFilter
    def fancytoc(input)
      converter     = @context.registers[:site].converters.find { |c| c.is_a? Jekyll::Converters::Markdown }
      extensions    = converter.instance_variable_get(:@parser).instance_variable_get(:@redcarpet_extensions)
      toc_generator = Redcarpet::Markdown.new(Redcarpet::Render::HTML_TOC, extensions)
      toc           = toc_generator.render(input)

      <<-HTML unless toc.empty?
        <div class="toc well" data-spy="affix" data-offset-top="0" data-offset-bottom="0">
          <h4>Table of content</h4>
          #{toc}
        </div>
      HTML
    end
  end
end

Liquid::Template.register_filter(Jekyll::FancyToCFilter)

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
foreman_remote_execution-1.3.7 doc/plugins/toc.rb
foreman_remote_execution-1.3.6 doc/plugins/toc.rb
foreman_remote_execution-1.4.1 doc/plugins/toc.rb
foreman_remote_execution-1.3.5 doc/plugins/toc.rb
foreman_remote_execution-1.3.4 doc/plugins/toc.rb
foreman_remote_execution-1.3.3 doc/plugins/toc.rb
foreman_remote_execution-1.3.2 doc/plugins/toc.rb
foreman_remote_execution-1.3.1 doc/plugins/toc.rb
foreman_remote_execution-1.3.0 doc/plugins/toc.rb
foreman_remote_execution-1.2.2 doc/plugins/toc.rb
foreman_remote_execution-1.2.1 doc/plugins/toc.rb
foreman_remote_execution-1.2.0 doc/plugins/toc.rb
foreman_remote_execution-1.1.1 doc/plugins/toc.rb
foreman_remote_execution-1.1.0 doc/plugins/toc.rb
foreman_remote_execution-1.0.0 doc/plugins/toc.rb
foreman_remote_execution-0.3.2 doc/plugins/toc.rb
foreman_remote_execution-0.3.1 doc/plugins/toc.rb
foreman_remote_execution-0.3.0 doc/plugins/toc.rb