middleman-page-toc
An extension to Middleman which provides a helper method to render table of contents of the specified page/resource.
Installation
Add this line to your application's Gemfile:
gem 'middleman-page-toc'
And then execute:
$ bundle
Or install it yourself as:
$ gem install middleman-page-toc
Settings
Use redcarpet as markdown engine and enable :toc_data option. and then activate this extension:
set :markdown_engine, :redcarpet
set :markdown, :fenced_code_blocks => true, :autolink => true,
:smartypants => true, :tables => true, :with_toc_data => true
activate :page_toc
Usage
use render_toc(page, options) helper function on your layout or page.
<%= render_toc(current_page) %>
options
- :use_collapsing
- :button_caption
- :expand
You must setup twitter-bootstrap css/js on your environment to use collapsing.
Contributing
- Fork it ( https://github.com/atarukoddaka/middleman-page-toc/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request