Project

simple_toc

0.0
No commit activity in last 3 years
No release in over 3 years
'simple-toc' makes a simple table of contents from DOM structure.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.13
~> 10.0

Runtime

 Project Readme

SimpleToc

Gem Version MIT License

'simple-toc' makes a simple table of contents from DOM structure.

Installation

gem 'simple_toc'

And then execute:

$ bundle

Or install it yourself as:

$ gem install simple_toc

Usage

To require this plguin, add the following to your application.js:

//= require simpleToc

This plugin require jQuery.

$(function() {
  # simple case
  $('#toc').simpleToc();

  # advance case
  $('#toc').simpleToc({
      listType: '<ol/>',
      selectors: 'h1,h2,h3',
      prefix: 'toc',
  });
});
<div id="toc"></div>

<h2>hoge</h2>
<h2>fuga</h2>
<h3>fuga > fuga</h3>
<h2>piyo</h2>

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/miraoto/simple_toc. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

License

The gem is available as open source under the terms of the MIT License.